<!--POWERED BY PUNKNOMAS@HOTMAIL.COM-->

function objetoAjax(){

	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 confirmacion(texto,url)
{
if (msg=confirm(texto))
{
window.location=url;	
}
}









function cargar(capa,url,tiempo){
	

	divresultado=document.getElementById(capa);

	var Aleatorio=parseInt(Math.random()*99999999);

	ajax=new objetoAjax();
	
	//aki sacamos la varia que seguira a la url si es un & o ?
	
	if (url.indexOf("?")>0){encadenar="&";}else{encadenar="?";}
	 
	ajax.open("GET",url + encadenar +"rand=" + Aleatorio,true);
	
	ajax.onreadystatechange=useHttpResponse;
	
	setTimeout("ajax.send(null)",tiempo);	

}





function detenerError() 
{ 
return true 
} 
window.onerror=detenerError 


function  validar_contactenos(frm)

{
	var var1=frm.Nombres.value;
	var var2=frm.Apellidos.value;
	var var3=frm.Email.value;
	var var4=frm.Telefono.value;
	var var5=frm.Consulta.value;
	
	if (var1=="")
	{
	alert('Debe ingresar el campo Nombres')	;
	frm.Nombres.focus();
	return false;
	}
	
	if (var2=="")
	{
	alert('Debe ingresar el campo Apellidos')	;
	frm.Apellidos.focus();
	return false;
	}
	
	if (var3=="")
	{
	alert('Debe ingresar el campo Email')	;
	frm.Email.focus();
	return false;
	}
	
	if (var4=="")
	{
	alert('Debe ingresar el campo Telefono')	;
	frm.Telefono.focus();
	return false;
	}
	
	if (var5=="")
	{
	alert('Debe ingresar el campo Consulta')	;
	frm.Consulta.focus();
	return false;
	}
	return true
	
	
}


function validar_solicitud(frm)
{
	
	var var1=frm.codigo.value;
	var var2=frm.producto.value;
	var var3=frm.nombres.value;
	var var4=frm.apellidos.value;
	var var5=frm.email.value;
	var var6=frm.telefono.value;
	var var7=frm.comentario.value;
	var var8=frm.contac_captcha.value;
	
	
	if (var1=="")
	{
	alert('Debe ingresar el campo codigo')	;
	frm.codigo.focus();
	return false;
	}
	
	if (var2=="")
	{
	alert('Debe ingresar el campo producto')	;
	frm.producto.focus();
	return false;
	}
	
	if (var3=="")
	{
	alert('Debe ingresar el campo nombres')	;
	frm.nombres.focus();
	return false;
	}
	
	if (var4=="")
	{
	alert('Debe ingresar el campo apellidos')	;
	frm.apellidos.focus();
	return false;
	}
	
	if (var5=="")
	{
	alert('Debe ingresar el campo email')	;
	frm.email.focus();
	return false;
	}
	
	if (var6=="")
	{
	alert('Debe ingresar el campo telefono')	;
	frm.telefono.focus();
	return false;
	}
	
	if (var7=="")
	{
	alert('Debe ingresar el campo comentario')	;
	frm.comentario.focus();
	return false;
	}

	if (var8=="")
	{
	alert('Debe ingresar el codigo de seguridad')	;
	frm.contac_captcha.focus();
	return false;
	}

return true

}




function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



function useHttpResponse() {
  if (ajax.readyState == 4) 
   {
   		 if(ajax.status == 200) 
		{
divresultado.innerHTML=ajax.responseText;
		}
 } 
 else 
  {
  divresultado.innerHTML = '<center><img src="images/loading.gif" /></center>';
  }
}








function cargarcat(pagina){
		new Ajax.Updater("subdisciplina",pagina,{method:'get'});
	}
	function cargarsub(pagina){
		new Ajax.Updater("sub_disciplina",pagina,{method:'get'});
	}
	
	
	
function cuno(i){
	$('thumb_m'+i).onclick();
}
