// JavaScript Document
function nuevoAjax(){
	var xmlhttp=false;
	try{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(E){
			xmlhttp = false;
		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	
	return xmlhttp;
}

function change_content(id,ref){

        id_change=document.getElementById("id_content_info1").value;
        values='?id='+id+'&type=1';
        ajax_u=nuevoAjax();
        ajax_u.open("GET", "content_rotator.php"+values, true);
        ajax_u.onreadystatechange=function() 
        {
            if (ajax_u.readyState==4)
            { 
                document.getElementById("show_new").innerHTML=ajax_u.responseText;
                
                
                values='?id='+id_change+'&type=2'+'&ref='+ref;
                ajax_s=nuevoAjax();
                ajax_s.open("GET", "content_rotator.php"+values, true);
                ajax_s.onreadystatechange=function() 
                {
                    if (ajax_s.readyState==4)
                    { 
                        document.getElementById("cont_"+ref).innerHTML=ajax_s.responseText;
                    } 
                }
                ajax_s.send(null);
                
            } 
        }
        ajax_u.send(null);
        
        
        return true;
}
function showoldcontent(where)
{
	if(where==1)
	{
				ajax_u=nuevoAjax();
				ajax_u.open("GET", "hidecontent.php?old=ok", true);
				ajax_u.onreadystatechange=function() 
				{
					if (ajax_u.readyState==4)
					{ 
						document.getElementById("hidcontent").value=ajax_u.responseText;
					} 
				}
				ajax_u.send(null);

		  document.getElementById("newc").style.display="none";
		  document.getElementById("old").style.display="block";
	} else
			{
		
				ajax_u=nuevoAjax();
				ajax_u.open("GET", "hidecontent.php?news=ok", true);
				ajax_u.onreadystatechange=function() 
				{
					if (ajax_u.readyState==4)
					{ 
						document.getElementById("hidcontent").value=ajax_u.responseText;
					} 
				}
				ajax_u.send(null);
        
			  document.getElementById("old").style.display="none";
		      document.getElementById("newc").style.display="block";
			  
		return true;
		}
	
}
function change_content_state(id,chk,type){
if(type==1){
values='?id_content='+id+'&change='+chk+'&type=1';
}else{
values='?id_content='+id+'&change='+chk;
}
        
        
        ajax_u=nuevoAjax();
        ajax_u.open("GET", "change_content_state.php"+values, true);
        ajax_u.onreadystatechange=function() 
        {
            if (ajax_u.readyState==4)
            { 
                document.getElementById("change_content_state_resp").innerHTML=ajax_u.responseText;
            } 
        }
        ajax_u.send(null);
        return true;
}


function change_search(type,srch){

values='?type='+type+'&search='+srch;

        
        
        ajax_u=nuevoAjax();
        ajax_u.open("GET", "change_search_type.php"+values, true);
        ajax_u.onreadystatechange=function() 
        {
            if (ajax_u.readyState==4)
            { 
                document.getElementById("search_responce").innerHTML=ajax_u.responseText;
            } 
        }
        ajax_u.send(null);
        return true;
}

