/// VARIA DREAMWEABER /////////

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];}
}
///////////////////////////////////


///// IGUALAR ALTURA DE CAPAS ////////////
//<![CDATA[
function same_height()
{
  
  /*document.getElementById('left_column').style.height=
  document.getElementById('content').offsetHeight+"px";*/
  if (document.getElementById('left_content').offsetHeight<=document.getElementById('right_content').offsetHeight)
  	{
		
		document.getElementById('content').style.height=
  		document.getElementById('right_content').offsetHeight+"px";
		
		document.getElementById('center_content').style.height=
  		document.getElementById('right_content').offsetHeight+"px";
		
		document.getElementById('left_column').style.height=
		document.getElementById('right_content').offsetHeight+"px";
	}
	
  else 
  	{
		
		document.getElementById('content').style.height=
  		document.getElementById('left_content').offsetHeight+"px";
		
		document.getElementById('left_column').style.height=
  		document.getElementById('left_content').offsetHeight+"px";
		
		document.getElementById('center_content').style.height=
  		document.getElementById('left_content').offsetHeight+"px";
	}
  
}

function same_height_programa()
{
  
  /*document.getElementById('left_column').style.height=
  document.getElementById('content').offsetHeight+"px";*/
  if (document.getElementById('left_content').offsetHeight<=document.getElementById('right_content').offsetHeight)
  	{
		
		document.getElementById('content').style.height=
  		document.getElementById('right_content').offsetHeight+"px";
		
		document.getElementById('center_content').style.height=
  		document.getElementById('right_content').offsetHeight+"px";
		
		document.getElementById('left_column').style.height=
		document.getElementById('right_content').offsetHeight+"px";
	}
	
  else 
  	{
		
		document.getElementById('content').style.height=
  		document.getElementById('left_content').offsetHeight+document.getElementById('titular_programa').offsetHeight+11+"px";
		
		document.getElementById('left_column').style.height=
  		document.getElementById('left_content').offsetHeight+document.getElementById('titular_programa').offsetHeight+11+"px";
		
		document.getElementById('center_content').style.height=
  		document.getElementById('left_content').offsetHeight+document.getElementById('titular_programa').offsetHeight+11+"px";
	}
  
}

function same_height_web()
{
  
  	if (document.getElementById('left_content').offsetHeight<=document.getElementById('right_content').offsetHeight)
  		{
		
		document.getElementById('content').style.height=
  		document.getElementById('right_content').offsetHeight+"px";
			
		document.getElementById('center_content').style.height=
  		document.getElementById('right_content').offsetHeight+"px";
		
		}
		
	else
		{
		
		document.getElementById('content').style.height=
  		document.getElementById('left_content').offsetHeight+"px";
			
		document.getElementById('center_content').style.height=
  		document.getElementById('left_content').offsetHeight+"px";
		}
  
}
//]]>
//////////////////////////////////////////

///// CAMBIAR ESTILO DE UN ELEMENTO ////////////
function cambiar_estilo(id,estilo){
	document.getElementById(id).className=estilo;   
}
/////////////////////////////////////////////////

/////// TOGGLE CAPA ///////////
function down(capa){
capa="#"+capa;
$(capa).slideDown("fast");
}

function up(capa){
capa="#"+capa;
$(capa).slideUp("fast");
}

function muestra(capa) {
	document.getElementById(capa).style.visibility="visible"; 
}
function oculta(capa) {
	document.getElementById(capa).style.visibility="hidden"; 
}
///////////////////////////////

//// CARGA AJAX /////////////
function load_content(capa,url){
capa="#"+capa;
$(capa).fadeOut(350,function()
							  {
							  $(capa).load(
										   url,function(){
											   			 $(capa).delay(800).slideDown(1500,function(){same_height();});
											   			 }
										   );
							  }
			    );
}
/////////////////////////////
//// CARGA AJAX 2/////////////
function load_content_fade(capa,url){
capa="#"+capa;
$(capa).fadeOut(350,function()
							  {
							  $(capa).load(
										   url,function(){
											   			 $(capa).delay(750).fadeIn(500,function(){same_height();});
											   			 }
										   );
							  }
			    );
}

//// CARGA AJAX PROGRAMA/////////////
function load_content_programa(capa,url){
capa="#"+capa;
$(capa).fadeOut(350,function()
							  {
							  $(capa).load(
										   url,function(){
											   			 $(capa).delay(800).slideDown(1500,function(){same_height_programa();});
											   			 }
										   );
							  }
			    );
}
/////////////////////////////
//// CARGA AJAX PROGRAMA 2/////////////
function load_content_fade_programa(capa,url){
capa="#"+capa;
$(capa).fadeOut(350,function()
							  {
							  $(capa).load(
										   url,function(){
											   			 $(capa).delay(750).fadeIn(500,function(){same_height_programa();});
											   			 }
										   );
							  }
			    );
}

////////// ID ////////////////
//// CARGA FOTOS FLICKR INDEX Y PROGRAMA /////////
function load_flickr_images(capa,url){
capa="#"+capa;
$(capa).empty().html('<img style="margin:43px 0px 0px 40px;" src="../imagenes/loading.png" />');
$(capa).load(url);
}

///////////////////////////////////////////////////
function id(id)
{
 if (id==0)
 {
 		cambiar_estilo('0','texto_menu2');
		cambiar_estilo('1','texto_menu');
		cambiar_estilo('2','texto_menu');
		cambiar_estilo('3','texto_menu');
		cambiar_estilo('4','texto_menu');
		cambiar_estilo('5','texto_menu');	
 }
  if (id==1)
 {
 		cambiar_estilo('0','texto_menu');
		cambiar_estilo('1','texto_menu2');
		cambiar_estilo('2','texto_menu');
		cambiar_estilo('3','texto_menu');
		cambiar_estilo('4','texto_menu');
		cambiar_estilo('5','texto_menu');
 }
 if (id==2)
 {
 		cambiar_estilo('0','texto_menu');
		cambiar_estilo('1','texto_menu');
		cambiar_estilo('2','texto_menu2');
		cambiar_estilo('3','texto_menu');
		cambiar_estilo('4','texto_menu');
		cambiar_estilo('5','texto_menu');
 }
 if (id==3)
 {
 		cambiar_estilo('0','texto_menu');
		cambiar_estilo('1','texto_menu');
		cambiar_estilo('2','texto_menu');
		cambiar_estilo('3','texto_menu2');
		cambiar_estilo('4','texto_menu');
		cambiar_estilo('5','texto_menu');
 }
 if (id==4)
 {
 		cambiar_estilo('0','texto_menu');
		cambiar_estilo('1','texto_menu');
		cambiar_estilo('2','texto_menu');
		cambiar_estilo('3','texto_menu');
		cambiar_estilo('4','texto_menu2');
		cambiar_estilo('5','texto_menu');
 }
  if (id==5)
 {
 		cambiar_estilo('0','texto_menu');
		cambiar_estilo('1','texto_menu');
		cambiar_estilo('2','texto_menu');
		cambiar_estilo('3','texto_menu');
		cambiar_estilo('4','texto_menu');
		cambiar_estilo('5','texto_menu2');
 }
}
//////////////////////////////////////////////

//////////////////////////////////////////////
///////////////////////////////////////////////////
function id_ruta(id)
{
 if (id=='ruta_1')
 {
 		cambiar_estilo('ruta_1','texto_menu2');
		cambiar_estilo('ruta_2','texto_menu');
		cambiar_estilo('ruta_3','texto_menu');
		cambiar_estilo('ruta_4','texto_menu');
 }
  if (id=='ruta_2')
 {
 		cambiar_estilo('ruta_1','texto_menu');
		cambiar_estilo('ruta_2','texto_menu2');
		cambiar_estilo('ruta_3','texto_menu');
		cambiar_estilo('ruta_4','texto_menu');
 }
 if (id=='ruta_3')
 {
 		cambiar_estilo('ruta_1','texto_menu');
		cambiar_estilo('ruta_2','texto_menu');
		cambiar_estilo('ruta_3','texto_menu2');
		cambiar_estilo('ruta_4','texto_menu');
 }
 if (id=='ruta_4')
 {
 		cambiar_estilo('ruta_1','texto_menu');
		cambiar_estilo('ruta_2','texto_menu');
		cambiar_estilo('ruta_3','texto_menu');
		cambiar_estilo('ruta_4','texto_menu2');
		
 }

}
//////////////////////////////////////////////


function enviar_busqueda()
{
	var dia=document.form_buscador.dia.value;
	alert (dia);
	var tipo_evento=document.form_buscador.tipo_evento.value;
	alert(tipo_evento);
	var organiza=document.form_buscador.organiza.value;
	alert(organiza);
	var palabra=document.form_buscador.palabra.value;
	alert(palabra);
	var busqueda='s';
	alert(busqueda);
	var url='programa';
	alert(url);
	//$.scrollTo('#header',1000,{easing:'easeInOutQuart', onAfter: function(){load_content_programa_busqueda('left_content','busqueda_eventos.php');}})
	 $('#left_content').load('busqueda_eventos.php',{dia:dia,tipo_evento:tipo_evento,organiza:organiza,palabra:palabra,busqueda:busqueda,url:url});
}

/* evluar funciones javascript*/
function runJS() 
{ 
 
    var search = 'CONTENIDO DE LA RESPUESTA AJAX';
    var script;
 
    while( script = search.match(/(<script[^>]+javascript[^>]+>\s*(<!--)?)/i)) 
    { 
      search = search.substr(search.indexOf(RegExp.$1) + RegExp.$1.length); 
 
      if (!(endscript = search.match(/((-->)?\s*<\/script>)/))) break; 
 
      block = search.substr(0, search.indexOf(RegExp.$1)); 
      search = search.substring(block.length + RegExp.$1.length); 
 
      var oScript = document.createElement('script'); 
      oScript.text = block; 
      document.getElementsByTagName("head").item(0).appendChild(oScript); 
    } 
}
/*							  */
