// JavaScript Document

//--------------------------------------- EN EL CLIC--------------------------------------------

function trim(str) 
{
        return str.replace(/^\s+|\s+$/g,"");    
}
	
function CLIC(id)
{
	switch (id)
		{
		case 'eventos':
			//alert("caca");
			window.location = "eventos/";
			break;
		case 'fotos':
			//alert("caca");
			window.location = "fotos/";
			break;
		case 'noticias':
			//alert("caca");
			window.location = "noticias/";
			break;
		case 'resultados_admin':
			//alert("caca");
			window.location = "resultados/";
			break;
		case 'estadisticas':
			//alert("caca");
			window.location = "estadisticas/";
			break;
		case 'inicio':
			//alert("caca");
			window.location = "http://www.clasificarg.com/index.php";
			break;
			
		case 'somos':
			//alert("caca");
			window.location = "http://www.clasificarg.com/quienes/index.php";
			break;
			
		case 'servicio':
			//alert("caca");
			window.location = "http://www.clasificarg.com/servicio/index.php";
			break;
			
		case 'clientes':
			//alert("caca");
			window.location = "http://www.clasificarg.com/clientes/index.php";
			break;
			
		case 'calendario':
			//alert("caca");
			window.location = "http://www.clasificarg.com/calendario/index.php";
			break;
			
		case 'resultados':
			//alert("caca");
			window.location = "http://www.clasificarg.com/resultados/index.php";
			break;
			
		case 'contacto':
			//alert("caca");
			window.location = "http://www.clasificarg.com/contacto/index.php";
			break;
		}

}

//----------------------------------------------------------------------------------------------

//-------------------------------------- IDIOMA ------------------------------------------------

function IDIOMA(id)
{
	switch(id)
	{
		case "en":
			alert("Language not available");
		break;
		
	
	}
}

//-------------------------------------- FIN IDIOMA --------------------------------------------

//---------------------------------------- ABRIR -----------------------------------------------

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 abrir(div1,div2,web,params,divaux)
{  
 if ((g(div1)==null)||(g(div2)==null))
 {//alert("No existe div " + div1 + " / " + div2); 
 return; }
	var ajax = nuevoAjax();
	
	//CARGANDO
	if (div1=='filtro_resultados_iframe')
	{
		g(div1).innerHTML="<table border='0' width='100%'><tr><td align='left' height='10'></td><td align='center'></td><td align='left'></td></tr><tr><td align='left'></td><td align='center'><img src='../img/cargando_iframe.gif' width='50' height='50'/><br><span class='titulitos_iframe'>Cargando resultados...</span></td><td align='left'></td></tr></table>";
	}
	else 
	{
		g(div1).innerHTML="<table border='0' width='100%'><tr><td align='left' height='10'></td><td align='center'></td><td align='left'></td></tr><tr><td align='left'></td><td align='center'><img src='../img/cargando.gif' width='50' height='50'/><br><span class='cabecera_resultados'>Cargando resultados...</span></td><td align='left'></td></tr></table>";
	}
	// FIN
	
	ajax.open("POST", web, true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send(params);
	ajax.onreadystatechange=function()
		{
		if(ajax.readyState==4)
			{ 
//if (ajax.responseText.indexOf("mysql_fetch_array")<=0)
//{
		 	switch (ajax.responseText.substr(0,2))
				{
					case "NO":
						g(div2).innerHTML = "Intente mas tarde"; 
					break;
					case "US":
						g(div2).innerHTML = "Session finished";
					break;
					case "OK":
						result = ajax.responseText.substr(2,ajax.responseText.length-2);
						g(div1).innerHTML = result;
						break;
					case "MS":
						  g(div2).innerHTML = ajax.responseText.substr(2,ajax.responseText.length-2);
						  break;
					default:
					{
						 g(div2).innerHTML = "<span class='chiquito'> </span>"; //"Intente m&aacute;s tarde."; 
						 
					break;
					
					} 
			//	g(div1).innerHTML = ajax.responseText;
				};//end swithc
				if (g(divaux))
				{
				g(divaux).value =	web;
				}
//}
}//end readyState
		}//end readyStateChange
}//end funct 

// -------------------------------------- FIN ABRIR --------------------------------------------

// ------------------------------- MOSTRAR OCULTAR --------------------------------------------




// ---------------------- FIN MOSTRAR OCULTAR ------------------------------------------------