// JavaScript Document
function ajax(){
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;
}
//////////////////Corners////////////////////////////////
$('.noticias').corner("15px right");
$('.videos').corner("15px right");
$('.imagenes').corner("15px right");
$('.cont_detalle').corner("15px left");
$('.cont_detalle').corner("1px bottom");
$('.smp_cont').corner("8px top");

/////////////////////////////////////////////////////////



function verNoticia(id){
	var resultado=document.getElementById('contenedor');
	var request=ajax();
	request.open("POST", "includes/content_not/index.php", true);
	request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	request.send("id="+id);	
	request.onreadystatechange=function()
	{ 	
		switch(request.readyState)
		{
			case 4:
			{
				resultado.innerHTML=request.responseText;
			}
			break;
		}
	}	
}




function changueTitIndex(act,desc,modo){
	var activar=document.getElementById(act);
	var desactivar=document.getElementById(desc);
	if(modo=="1"){	
	activar.style.background="url(img/ciudades_new.jpg) no-repeat 0 -683px";
	desactivar.style.background="url(img/ciudades_new.jpg) no-repeat -380px 0";		
	}
	else if(modo=="2"){	
	activar.style.background="url(img/ciudades_new.jpg) no-repeat 0 0";
	desactivar.style.background="url(img/ciudades_new.jpg) no-repeat 0 -342px";			
	}
}

function activar_submenu(mar,let,med){
	var marco=document.getElementById("smp_cont_"+mar);
	var letra=document.getElementById(let);
	//alert(allTrim(marco.style.backgroundColor));
	if(marco.style.backgroundColor=="" || marco.style.backgroundColor=="rgb(255, 255, 255)" || marco.style.backgroundColor=="rgb(255,255,255)")
	{
		marco.style.backgroundColor="rgb(137,127,111)";
		letra.style.background="url(img/sub_menus_prov.png) no-repeat "+med+"px 0";
	}
	else if(marco.style.backgroundColor=="rgb(137, 127, 111)" || marco.style.backgroundColor=="rgb(137,127,111)")
	{
		marco.style.backgroundColor="rgb(255,255,255)";
		letra.style.background="url(img/sub_menus_prov.png) no-repeat "+med+"px -15px";		
	}
}

function ver_modulos(modulo)
{
	var marquito1=document.getElementById('smp_cont_1');
	var marquito2=document.getElementById('smp_cont_2');
	var marquito3=document.getElementById('smp_cont_3');
	var marquito4=document.getElementById('smp_cont_4');
	
	var letra1=document.getElementById('smp_ec');	
	var letra2=document.getElementById('smp_ex');	
	var letra3=document.getElementById('smp_au');	
	var letra4=document.getElementById('smp_en');	
	//alert(modulo.substr(0,modulo.length-7));
	var pagina=modulo.split(".");			
	if(pagina[0]=="cronogramasAT" || pagina[0]=="cronograma" || pagina[0]=="cronogramaT" || pagina[0]=="cronogramaA")
	{
		marquito1.style.backgroundColor="rgb(137,127,111)";
		letra1.style.background="url(img/sub_menus_prov.png) no-repeat 0 0";	
		marquito1.onmouseover="";
		marquito1.onmouseout="";	
				
		marquito2.style.backgroundColor="rgb(255,255,255)";
		letra2.style.background="url(img/sub_menus_prov.png) no-repeat -228px -15px";
		marquito2.onmouseover=function(){activar_submenu('2','smp_ex','-228');};
		marquito2.onmouseout=function(){activar_submenu('2','smp_ex','-228');};		
		
		marquito3.style.backgroundColor="rgb(255,255,255)";
		letra3.style.background="url(img/sub_menus_prov.png) no-repeat -368px -15px";
		marquito3.onmouseover=function(){activar_submenu('3','smp_au','-368');};
		marquito3.onmouseout=function(){activar_submenu('3','smp_au','-368');};
				
		marquito4.style.backgroundColor="rgb(255,255,255)";
		letra4.style.background="url(img/sub_menus_prov.png) no-repeat -482px -15px";
		marquito4.onmouseover=function(){activar_submenu('4','smp_en','-482');};
		marquito4.onmouseout=function(){activar_submenu('4','smp_en','-482');};			
	}
	else if(pagina[0]=="expositoresAT" || pagina[0]=="expositores")
	{
		marquito1.style.backgroundColor="rgb(255,255,255)";
		letra1.style.background="url(img/sub_menus_prov.png) no-repeat 0 -15px";	
		marquito1.onmouseover=function(){activar_submenu('1','smp_ec','0');};
		marquito1.onmouseout=function(){activar_submenu('1','smp_ec','0');};	
					
		marquito2.style.backgroundColor="rgb(137,127,111)";		
		letra2.style.background="url(img/sub_menus_prov.png) no-repeat -228px 0";	
		marquito2.onmouseover="";
		marquito2.onmouseout="";
		
		marquito3.style.backgroundColor="rgb(255,255,255)";
		letra3.style.background="url(img/sub_menus_prov.png) no-repeat -368px -15px";
		marquito3.onmouseover=function(){activar_submenu('3','smp_au','-368');};
		marquito3.onmouseout=function(){activar_submenu('3','smp_au','-368');};
				
		marquito4.style.backgroundColor="rgb(255,255,255)";
		letra4.style.background="url(img/sub_menus_prov.png) no-repeat -482px -15px";
		marquito4.onmouseover=function(){activar_submenu('4','smp_en','-482');};
		marquito4.onmouseout=function(){activar_submenu('4','smp_en','-482');};		
	}	
	else if(pagina[0]=="auspiciadores")
	{
		marquito1.style.backgroundColor="rgb(255,255,255)";
		letra1.style.background="url(img/sub_menus_prov.png) no-repeat 0 -15px";	
		marquito1.onmouseover=function(){activar_submenu('1','smp_ec','0');};
		marquito1.onmouseout=function(){activar_submenu('1','smp_ec','0');};			
		
		marquito2.style.backgroundColor="rgb(255,255,255)";
		letra2.style.background="url(img/sub_menus_prov.png) no-repeat -228px -15px";
		marquito2.onmouseover=function(){activar_submenu('2','smp_ex','-228');};
		marquito2.onmouseout=function(){activar_submenu('2','smp_ex','-228');};
				
		marquito3.style.backgroundColor="rgb(137,127,111)";
		letra3.style.background="url(img/sub_menus_prov.png) no-repeat -368px 0";
		marquito3.onmouseover="";
		marquito3.onmouseout="";
				
		marquito4.style.backgroundColor="rgb(255,255,255)";
		letra4.style.background="url(img/sub_menus_prov.png) no-repeat -482px -15px";
		marquito4.onmouseover=function(){activar_submenu('4','smp_en','-482');};
		marquito4.onmouseout=function(){activar_submenu('4','smp_en','-482');};			
	}	
	else if(pagina[0]=="entradasAT" || pagina[0]=="entradas")
	{
		marquito1.style.backgroundColor="rgb(255,255,255)";
		letra1.style.background="url(img/sub_menus_prov.png) no-repeat 0 -15px";	
		marquito1.onmouseover=function(){activar_submenu('1','smp_ec','0');};
		marquito1.onmouseout=function(){activar_submenu('1','smp_ec','0');};	
				
		marquito2.style.backgroundColor="rgb(255,255,255)";
		letra2.style.background="url(img/sub_menus_prov.png) no-repeat -228px -15px";
		marquito2.onmouseover=function(){activar_submenu('2','smp_ex','-228');};
		marquito2.onmouseout=function(){activar_submenu('2','smp_ex','-228');};
				
		marquito3.style.backgroundColor="rgb(255,255,255)";
		letra3.style.background="url(img/sub_menus_prov.png) no-repeat -368px -15px";
		marquito3.onmouseover=function(){activar_submenu('3','smp_au','-368');};
		marquito3.onmouseout=function(){activar_submenu('3','smp_au','-368');};
				
		marquito4.style.backgroundColor="rgb(137,127,111)";
		letra4.style.background="url(img/sub_menus_prov.png) no-repeat -482px 0";
		marquito4.onmouseover="";
		marquito4.onmouseout="";				
	}			
	
	var resultado=document.getElementById('modulos_recep');
	var request=ajax();
	request.open("POST", "includes/ajax.modulos.php", true);
	request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	request.send("tipo="+modulo);	
	request.onreadystatechange=function()
	{ 	
		switch(request.readyState)
		{
			case 4:
			{
				resultado.innerHTML=request.responseText;
			}
			break;
		}
	}
}

function ver_cronog(tipo)
{
	var resultado=document.getElementById('recep_detalle_prov');
	var request=ajax();
	request.open("POST", "includes/ajax.cronog.php", true);
	request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	request.send("tipo="+tipo);	
	request.onreadystatechange=function()
	{ 	
		switch(request.readyState)
		{
			case 4:
			{
				resultado.innerHTML=request.responseText;
			}
			break;
		}
	}
}


function cambiar_tit_cron(id,noid){
	var tit=document.getElementById(id);
	var notit=document.getElementById(noid);
	//alert(tit.style.color+" - "+notit.style.color);
	if(tit.style.color=="rgb(212,0,80)" || tit.style.color=="rgb(212, 0, 80)"){
		tit.style.color="rgb(202,202,202)";
		notit.style.color="rgb(212,0,80)";}
	if(tit.style.color=="rgb(202,202,202)" || tit.style.color=="rgb(202, 202, 202)"){
		tit.style.color="rgb(212,0,80)";
		notit.style.color="rgb(202,202,202)";}
		
}



function volver(){
	location.href="index.php";
}

function verGaleriaUni(id)
{
	var foto=document.getElementById('foto_imag');
	var desc=document.getElementById('desc_imag');
	var titu=document.getElementById('tit_imag');
	var request=ajax();
	request.open("POST", "includes/ajax.galeria.php", true);
	request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	request.send("id="+id);	
	request.onreadystatechange=function()
	{ 	
		switch(request.readyState)
		{
			case 4:
			{
				var total=request.responseText.split("@");
				titu.innerHTML=total[0];								
				foto.innerHTML='<img src="img/galeria/'+total[1]+'" width="131" height="108" border="0" />';
				desc.innerHTML=total[2];
			}
			break;
		}
	}
}

function verVideoUni(id)
{
	var video=document.getElementById('ytb_video');
	var loadd=document.getElementById('ytb_video2');	
	
	var request=ajax();
	request.open("POST", "includes/ajax.video.php", true);
	request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	
	loadd.style.display='block';
	video.style.display='none';	
	
	setTimeout(function(){
	request.send("id="+id);	
	request.onreadystatechange=function()
	{ 	
		switch(request.readyState)
		{
			case 4:
			{
				loadd.style.display='none';
				video.style.display='block';	
				var total=request.responseText.split("@");						
				video.innerHTML='<object width="345" height="295"><param name="movie" value="'+total[1]+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+total[1]+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="345" height="295"></embed></object>';
			}
			break;
		}
	}
	},2000);
}

///////////////////validando formulario//////////////////////////////////////////////////
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
//////////////////////////////////////////////////////////////////////////////////////-->



//para los milisegundos


var _myTimer = null;
var _myDelta = 1; // 50 milliseconds
var mili=0;
function updateIt() {

	   var new_res=1000-theDelta();
	   
	   if(new_res<0)
	   {
		   new_res=theDelta()+1000;
	   }
	   
	   var text=String(new_res);
        mili = text.substring((text.length)-3,text.length);
}

  var _startTime = new Date();
  _myTimer = setInterval("updateIt()",_myDelta);

function theDelta() {
  var _tempTime = new Date();
  var resultado=_tempTime.getTime() - _startTime.getTime();
  return resultado;
}



/////

var futuro = new Date (2011,6,1,18,00,00);  
var actualiza = 1; 
function faltan(){ 
var ahora = new Date(); 
var faltan = futuro - ahora; 
if (faltan > 0){ 
var segundos = Math.round(faltan/1000); 
var minutos = Math.floor(segundos/60); 
var segundos_s = segundos%60; 
//transfromando en 00

var horas = Math.floor(minutos/60); 
var minutos_s = minutos%60; 
var dias = Math.floor(horas/24); 
var horas_s =((9 - ahora.getDay())*24+18)- ahora.getHours(); 
//var horas_s =horas%24; 
document.getElementById("div_reloj").innerHTML= horas_s + "<span style=\"font-size:0.65em;\">h</span>: "+minutos_s + "<span style=\"font-size:0.65em;\">m</span>: " +segundos_s+"<span style=\"font-size:0.65em;\">s</span>: "+mili;
setTimeout("faltan()",actualiza); 

} 
else { 
document.getElementById("div_reloj").innerHTML= "0 dias / 0:0:0" ; 
return true; 
} 
} 


/////////////////////////////////////////////////////////////////////////////////




