var isJsOneOne = false;
var lista_imagenes = new Array();
var i; 
isJsOneOne = true;

//Generar Ajax 

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; 
}

//Busqueda Rapida de peliculas

function cargaContenido()
{
	var valor=document.getElementById("cmb_cines").value;
	if(valor==0)
	{
		
	}
	else
	{
		ajax=nuevoAjax();
		
		ajax.open("GET", "get_peliculas.php?seleccionado="+valor, true);
		ajax.onreadystatechange=function() 
		{ 


			if (ajax.readyState==1)
			{
				
			}
			if (ajax.readyState==4)
			{ 
				//alert(ajax.responseText);
				document.getElementById("dv_cmb_peliculas").innerHTML=ajax.responseText;
				createEditableSelect(document.forms[0].cmb_peliculas);
			} 
		}
		ajax.send(null);
		
	}
}

function get_detalle_ref_busqueda()
{
	document.getElementById("cine").value=document.getElementById("cmb_cines").value;
	document.getElementById("pelicula").value=document.getElementById("cmb_peliculas").value;
	var str_cine = document.getElementById("cine").value;
	var str_pelicula = document.getElementById("pelicula").value;	
	if (str_cine=="Seleccione Cine" || str_pelicula=="Seleccione Pelicula" )
	{
			
	}
	else
	{
			document.frm.submit();
	}

}

//Menu de Cartelera

function mostrar() {
	menu.style.visibility  = "visible";
	//if (isJsOneOne) cartelera.src='images/cartelera_on.gif';	
}
function ocultar() {
	menu.style.visibility = "hidden";
}
function cambiar_color_over(celda){
		celda.style.backgroundColor="#125194"
}
function cambiar_color_out(celda){
		celda.style.backgroundColor="#1461A9"
}
function cambia_color(){
		celda = document.getElementById("celda" + document.fcolor.celda.value)
		celda.style.backgroundColor=document.fcolor.micolor.value
}

//Script del combo box

	var arrowImage = 'images/flecha-select2.gif';	// Regular arrow
	var arrowImageOver = 'images/flecha-select2.gif';	// Mouse over
	var arrowImageDown = 'images/flecha-select2.gif';	// Mouse down
	
	var selectBoxIds = 0;
	var currentlyOpenedOptionBox = false;
	var editableSelect_activeArrow = false;
	
	function selectBox_switchImageUrl()
	{
		if(this.src.indexOf(arrowImage)>=0){
			this.src = this.src.replace(arrowImage,arrowImageOver);	
		}else{
			this.src = this.src.replace(arrowImageOver,arrowImage);
		}
	}
	
	function selectBox_showOptions()
	{
		if(editableSelect_activeArrow && editableSelect_activeArrow!=this){
			editableSelect_activeArrow.src = arrowImage;
			
		}
		editableSelect_activeArrow = this;
		
		var numId = this.id.replace(/[^\d]/g,'');
		var optionDiv = document.getElementById('selectBoxOptions' + numId);
		if(optionDiv.style.display=='block'){
			optionDiv.style.display='none';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId).style.display='none';
			this.src = arrowImageOver;			
		}else{			
			optionDiv.style.display='block';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId).style.display='block';
			this.src = arrowImageDown;	
			if(currentlyOpenedOptionBox && currentlyOpenedOptionBox!=optionDiv)
			currentlyOpenedOptionBox.style.display='none';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId).style.display='none';
			currentlyOpenedOptionBox= optionDiv;			
		}
	}
	
	function selectOptionValue()
	{
		var parentNode = this.parentNode.parentNode;
		var textInput = parentNode.getElementsByTagName('INPUT')[0];
		textInput.value = this.innerHTML;
		var cmb_texto= document.getElementById("cmb_cines").value;
		this.parentNode.style.display='none';
		document.getElementById('arrowSelectBox' + parentNode.id.replace(/[^\d]/g,'')).src = arrowImageOver;
		if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + parentNode.id.replace(/[^\d]/g,'')).style.display='none';
		if(textInput.value==cmb_texto)
		{
		cargaContenido();
		}
	}
	var activeOption;
	function highlightSelectBoxOption()
	{
		if(this.style.backgroundColor=='#316AC5'){
			this.style.backgroundColor='#666666';
			this.style.color='';
		}else{
			this.style.backgroundColor='#FFFFFF';
			this.style.color='#000000';			
		}	
		
		if(activeOption){
			activeOption.style.backgroundColor='';
			activeOption.style.color='';			
		}
		activeOption = this;
		
	}
	
	function createEditableSelect(dest)
	{

		//alert(dest);	
		dest.className='selectBoxInput';		
		var div = document.createElement('DIV');
		div.style.styleFloat = 'left';
		div.style.width = dest.offsetWidth + 16 + 'px';
		div.style.position = 'relative';
		div.id = 'selectBox' + selectBoxIds;
		var parent = dest.parentNode;
		parent.insertBefore(div,dest);
		div.appendChild(dest);	
		div.className='selectBox';
		div.style.zIndex = 10000 - selectBoxIds;

		var img = document.createElement('IMG');
		img.src = arrowImage;
		img.className = 'selectBoxArrow';
		
		img.onmouseover = selectBox_switchImageUrl;
		img.onmouseout = selectBox_switchImageUrl;
		img.onclick = selectBox_showOptions;
		img.id = 'arrowSelectBox' + selectBoxIds;

		div.appendChild(img);
		
		var optionDiv = document.createElement('DIV');
		optionDiv.id = 'selectBoxOptions' + selectBoxIds;
		optionDiv.className='selectBoxOptionContainer';
		optionDiv.style.width = div.offsetWidth-2 + 'px';
		div.appendChild(optionDiv);
		
		if(navigator.userAgent.indexOf('MSIE')>=0){
			var iframe = document.createElement('<IFRAME src="about:blank" frameborder=0>');
			iframe.style.width = optionDiv.style.width;
			iframe.style.height = optionDiv.offsetHeight + 'px';
			iframe.style.display='none';
			iframe.id = 'selectBoxIframe' + selectBoxIds;
			div.appendChild(iframe);
		}
		
		if(dest.getAttribute('selectBoxOptions')){
			var options = dest.getAttribute('selectBoxOptions').split(';');
			var optionsTotalHeight = 0;
			var optionArray = new Array();
			optionDiv.style.height = options.length * 14 + 'px';
			for(var no=0;no<options.length;no++){
				var anOption = document.createElement('DIV');
				anOption.innerHTML = options[no];
				anOption.className='selectBoxAnOption';
				anOption.onclick = selectOptionValue;
				anOption.style.width = optionDiv.style.width.replace('px','') - 2 + 'px'; 
				anOption.onmouseover = highlightSelectBoxOption;
				optionDiv.appendChild(anOption);				
				optionsTotalHeight = optionsTotalHeight + anOption.offsetHeight;
				optionArray.push(anOption);
			}
			if(optionsTotalHeight > optionDiv.offsetHeight){				
				for(var no=0;no<optionArray.length;no++){
					optionArray[no].style.width = optionDiv.style.width.replace('px','') - 22 + 'px'; 	
				}	
			}		
			optionDiv.style.display='none';
			optionDiv.style.visibility='visible';
		}
		
		selectBoxIds = selectBoxIds + 1;
	}



function fget_fechas()
{
	var valor=document.getElementById("fes_cines").value;
	document.getElementById("dv_fes_dia").innerHTML='<input id="fes_dia0" name="fes_dia0" type="text" value="Seleccionar fecha" selectboxoptions="" readonly="YES" />';
	document.getElementById("dv_fes_pais").innerHTML='<input id="fes_pais0" name="fes_pais0" type="text" value="Seleccionar país" selectboxoptions="" readonly="YES" />';
	createEditableSelect2(document.forms[0].fes_dia0);
	createEditableSelect2(document.forms[0].fes_pais0);
	if(valor==0)
	{
		
	}
	else
	{
		ajax=nuevoAjax();
		
		ajax.open("GET", "get_fechasxcine.php?seleccionado="+valor, true);
		ajax.onreadystatechange=function() 
		{ 


			if (ajax.readyState==1)
			{
				
			}
			if (ajax.readyState==4)
			{ 
				//alert(ajax.responseText);
				document.getElementById("dv_fes_dia").innerHTML=ajax.responseText;
				createEditableSelect2(document.forms[0].fes_dia);
			} 
		}
		ajax.send(null);
		fact_programacion0();
		
	}
}
function fget_paises0()
{
	
	var valor=document.getElementById("fes_cines").value;
	var valor2=document.getElementById("fes_dia0").value;
	
	var dia
	if(valor2=="Viernes 6 Agosto")
	{
	dia="06";	
	}
	if(valor2=="Sábado 7 Agosto")
	{
	dia="07";	
	}
	if(valor2=="Domingo 8 Agosto")
	{
	dia="08";	
	}	
	if(valor2=="Lunes 9 Agosto")
	{
	dia="09";	
	}
	if(valor2=="Martes 10 Agosto")
	{
	dia="10";	
	}
	if(valor2=="Miércoles 11 Agosto")
	{
	dia="11";	
	}
	if(valor2=="Jueves 12 Agosto")
	{
	dia="12";	
	}
	if(valor2=="Viernes 13 Agosto")
	{
	dia="13";	
	}
	if(valor2=="Sábado 14 Agosto")
	{
	dia="14";	
	}

	document.getElementById("fecha_festival").firstChild.nodeValue=valor2+" del 2010";
	if(valor==0)
	{
		
	}
	else
	{
		ajax=nuevoAjax();

		ajax.open("GET", "get_fechasxdiaxcine.php?seleccionado="+valor+"&seleccionado2="+dia, true);
		ajax.onreadystatechange=function() 
		{ 


			if (ajax.readyState==1)
			{
				
			}
			if (ajax.readyState==4)
			{ 
				/*alert(ajax.responseText);*/
				document.getElementById("dv_fes_pais").innerHTML=ajax.responseText;
				createEditableSelect2(document.forms[0].fes_pais);
			} 
		}
		ajax.send(null);
		fact_programacionx();
		
	}
}
function fget_paises()
{
	
	var valor=document.getElementById("fes_cines").value;
	var valor2=document.getElementById("fes_dia").value;

	var dia
	if(valor2=="Viernes 6 Agosto")
	{
	dia="06";	
	}
	if(valor2=="Sábado 7 Agosto")
	{
	dia="07";	
	}
	if(valor2=="Domingo 8 Agosto")
	{
	dia="08";	
	}	
	if(valor2=="Lunes 9 Agosto")
	{
	dia="09";	
	}
	if(valor2=="Martes 10 Agosto")
	{
	dia="10";	
	}
	if(valor2=="Miércoles 11 Agosto")
	{
	dia="11";	
	}
	if(valor2=="Jueves 12 Agosto")
	{
	dia="12";	
	}
	if(valor2=="Viernes 13 Agosto")
	{
	dia="13";	
	}
	if(valor2=="Sábado 14 Agosto")
	{
	dia="14";	
	}
	document.getElementById("fecha_festival").firstChild.nodeValue=valor2+" del 2008";
	if(valor==0)
	{
		
	}
	else
	{
		ajax=nuevoAjax();

		ajax.open("GET", "get_fechasxdiaxcine.php?seleccionado="+valor+"&seleccionado2="+dia, true);
		ajax.onreadystatechange=function() 
		{ 


			if (ajax.readyState==1)
			{
				
			}
			if (ajax.readyState==4)
			{ 
				/*alert(ajax.responseText);*/
				document.getElementById("dv_fes_pais").innerHTML=ajax.responseText;
				createEditableSelect2(document.forms[0].fes_pais);
			} 
		}
		ajax.send(null);
		fact_programacion1();
		
	}
}

function fact_programacion0()
{


	
	var valor=document.getElementById("fes_cines").value;
	//document.getElementById("fecha_festival").firstChild.nodeValue="Jueves 07 Agosto del 2008";
	document.getElementById("fecha_festival").firstChild.nodeValue="Viernes 06 Agosto del 2010";
	var dia="06";
	document.getElementById("scroll_text").innerHTML="<img src='http://www.cineplanet.com.pe/festivaldelima/images/loading_form.gif' width='16' height='16'> <span class='Subtitulo_verd10bold'>Procesando</span>"
	if(valor==0)
	{
		
	}
	else
	{
		ajaxact_pro=nuevoAjax();
		
		ajaxact_pro.open("GET", "programacion0.php?seleccionado="+valor+"&seleccionado2="+dia, true);
		ajaxact_pro.onreadystatechange=function() 
		{ 


			if (ajaxact_pro.readyState==1)
			{
				
			}
			if (ajaxact_pro.readyState==4)
			{ 
				
				document.getElementById("scroll_text").innerHTML=ajaxact_pro.responseText;
				var cadena="";
//alert(document.getElementById("nregistros").value);
for(i=0;i<document.getElementById("nregistros").value;i=i+1)
{  
nombrealto="alto"+i;
nombreficha="nuevo"+i;
document.getElementById(nombrealto).value=document.getElementById(nombreficha).offsetHeight;
document.getElementById(nombreficha).style.display="none";
}
			} 
		}
		ajaxact_pro.send(null);
		
	}
}
function fact_programacion1()
{
	var valor=document.getElementById("fes_cines").value;
	var valor2=document.getElementById("fes_dia").value;
	
	var dia
	if(valor2=="Viernes 6 Agosto")
	{
	dia="06";	
	}
	if(valor2=="Sábado 7 Agosto")
	{
	dia="07";	
	}
	if(valor2=="Domingo 8 Agosto")
	{
	dia="08";	
	}	
	if(valor2=="Lunes 9 Agosto")
	{
	dia="09";	
	}
	if(valor2=="Martes 10 Agosto")
	{
	dia="10";	
	}
	if(valor2=="Miércoles 11 Agosto")
	{
	dia="11";	
	}
	if(valor2=="Jueves 12 Agosto")
	{
	dia="12";	
	}
	if(valor2=="Viernes 13 Agosto")
	{
	dia="13";	
	}
	if(valor2=="Sábado 14 Agosto")
	{
	dia="14";	
	}
	document.getElementById("scroll_text").innerHTML="<img src='http://www.cineplanet.com.pe/festivaldelima/images/loading_form.gif' width='16' height='16'> <span class='Subtitulo_verd10bold'>Procesando</span>";
	if(valor==0)
	{
		
	}
	else
	{
		ajaxact_pro1=nuevoAjax();
		
	ajaxact_pro1.open("GET", "programacion1.php?seleccionado="+valor+"&seleccionado2="+dia, true);
		ajaxact_pro1.onreadystatechange=function() 
		{ 


			if (ajaxact_pro1.readyState==1)
			{
				
			}
			if (ajaxact_pro1.readyState==4)
			{ 
				//alert(ajax.responseText);
				document.getElementById("scroll_text").innerHTML=ajaxact_pro1.responseText;
				for(i=0;i<document.getElementById("nregistros").value;i=i+1)
{  
nombrealto="alto"+i;
nombreficha="nuevo"+i;
document.getElementById(nombrealto).value=document.getElementById(nombreficha).offsetHeight;
document.getElementById(nombreficha).style.display="none";
}
			} 
		}
		ajaxact_pro1.send(null);
		
	}
}
function fact_programacionx()
{
	var valor=document.getElementById("fes_cines").value;
	var valor2=document.getElementById("fes_dia0").value;

	var dia
	if(valor2=="Viernes 6 Agosto")
	{
	dia="06";	
	}
	if(valor2=="Sábado 7 Agosto")
	{
	dia="07";	
	}
	if(valor2=="Domingo 8 Agosto")
	{
	dia="08";	
	}	
	if(valor2=="Lunes 9 Agosto")
	{
	dia="09";	
	}
	if(valor2=="Martes 10 Agosto")
	{
	dia="10";	
	}
	if(valor2=="Miércoles 11 Agosto")
	{
	dia="11";	
	}
	if(valor2=="Jueves 12 Agosto")
	{
	dia="12";	
	}
	if(valor2=="Viernes 13 Agosto")
	{
	dia="13";	
	}
	if(valor2=="Sábado 14 Agosto")
	{
	dia="14";	
	}
	document.getElementById("scroll_text").innerHTML="<img src='http://www.cineplanet.com.pe/festivaldelima/images/loading_form.gif' width='16' height='16'> <span class='Subtitulo_verd10bold'>Procesando</span>";
	if(valor==0)
	{
		
	}
	else
	{
		ajaxact_pro1=nuevoAjax();
		
	ajaxact_pro1.open("GET", "programacion1.php?seleccionado="+valor+"&seleccionado2="+dia, true);
		ajaxact_pro1.onreadystatechange=function() 
		{ 


			if (ajaxact_pro1.readyState==1)
			{
				
			}
			if (ajaxact_pro1.readyState==4)
			{ 
				//alert(ajax.responseText);
				document.getElementById("scroll_text").innerHTML=ajaxact_pro1.responseText;
				for(i=0;i<document.getElementById("nregistros").value;i=i+1)
{  
nombrealto="alto"+i;
nombreficha="nuevo"+i;
document.getElementById(nombrealto).value=document.getElementById(nombreficha).offsetHeight;
document.getElementById(nombreficha).style.display="none";
}
			} 
		}
		ajaxact_pro1.send(null);
		
	}
}

function fact_programacion2()
{
	var valor=document.getElementById("fes_cines").value;
	//alert("Hola");
	if (document.getElementById("fes_dia") != null) {
	var valor2=document.getElementById("fes_dia").value;
	} else {
	var valor2=document.getElementById("fes_dia0").value;
	}

	//var valor2=document.getElementById("fes_dia").value;
	
	var valor3=document.getElementById("fes_pais").value;

	var dia
	if(valor2=="Viernes 6 Agosto")
	{
	dia="06";	
	}
	if(valor2=="Sábado 7 Agosto")
	{
	dia="07";	
	}
	if(valor2=="Domingo 8 Agosto")
	{
	dia="08";	
	}	
	if(valor2=="Lunes 9 Agosto")
	{
	dia="09";	
	}
	if(valor2=="Martes 10 Agosto")
	{
	dia="10";	
	}
	if(valor2=="Miércoles 11 Agosto")
	{
	dia="11";	
	}
	if(valor2=="Jueves 12 Agosto")
	{
	dia="12";	
	}
	if(valor2=="Viernes 13 Agosto")
	{
	dia="13";	
	}
	if(valor2=="Sábado 14 Agosto")
	{
	dia="14";	
	}
	document.getElementById("scroll_text").innerHTML="<img src='http://www.cineplanet.com.pe/festivaldelima/images/loading_form.gif' width='16' height='16'> <span class='Subtitulo_verd10bold'>Procesando</span>";
	if(valor==0)
	{
		
	}
	else
	{
		ajaxact_pro1=nuevoAjax();
		
	ajaxact_pro1.open("GET", "programacion2.php?seleccionado="+valor+"&seleccionado2="+dia+"&seleccionado3="+valor3, true);
		ajaxact_pro1.onreadystatechange=function() 
		{ 


			if (ajaxact_pro1.readyState==1)
			{
				
			}
			if (ajaxact_pro1.readyState==4)
			{ 
				//alert(ajax.responseText);
				document.getElementById("scroll_text").innerHTML=ajaxact_pro1.responseText;
				for(i=0;i<document.getElementById("nregistros").value;i=i+1)
{  
nombrealto="alto"+i;
nombreficha="nuevo"+i;
document.getElementById(nombrealto).value=document.getElementById(nombreficha).offsetHeight;
document.getElementById(nombreficha).style.display="none";
}
			} 
		}
		ajaxact_pro1.send(null);
		
	}
}
// Script del Combo box 2

	var arrowImage2 = 'images/flecha-select1.gif';	// Regular arrow
	var arrowImageOver2 = 'images/flecha-select1.gif';	// Mouse over
	var arrowImageDown2 = 'images/flecha-select1.gif';	// Mouse down
	
	//var selectBoxIds2 = 0;
	var currentlyOpenedOptionBox2 = false;
	var editableSelect_activeArrow2 = false;
	
	function selectBox_switchImageUrl2()
	{
		if(this.src.indexOf(arrowImage2)>=0){
			this.src = this.src.replace(arrowImage2,arrowImageOver2);	
		}else{
			this.src = this.src.replace(arrowImageOver2,arrowImage2);
		}
	}
	
	function selectBox_showOptions2()
	{
		if(editableSelect_activeArrow2 && editableSelect_activeArrow2!=this){
			editableSelect_activeArrow2.src = arrowImage2;
		}
		editableSelect_activeArrow2 = this;
		
		var numId2 = this.id.replace(/[^\d]/g,'');
		var optionDiv2 = document.getElementById('selectBoxOptions' + numId2);
		if(optionDiv2.style.display=='block'){
			optionDiv2.style.display='none';
			if(navigator.userAgent.indexOf('MSIE')>=0)
			document.getElementById('selectBoxIframe' + numId2).style.display='none';
			this.src = arrowImageOver2;			
		}else{
			optionDiv2.style.display='block';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId2).style.display='block';
			this.src = arrowImageDown2;	
			if(currentlyOpenedOptionBox2 && currentlyOpenedOptionBox2!=optionDiv2)
			currentlyOpenedOptionBox2.style.display='none';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId2).style.display='none';
			currentlyOpenedOptionBox2= optionDiv2;			
		}
	}
	
	function selectOptionValue2()
	{
		var parentNode2 = this.parentNode.parentNode;
		var textInput2 = parentNode2.getElementsByTagName('INPUT')[0];
		textInput2.value = this.innerHTML;
		var current_id=textInput2.getAttribute('id');
//		alert(current_id);		
		var numero_id=current_id.substr(6);
		
		this.parentNode.style.display='none';
//		document.getElementById('arrowSelectBox' + parentNode2.id.replace(/[^\d]/g,'')).src = arrowImageOver2;
//alert(textInput2.name);
		if(textInput2.name=="fes_cines")
		{
//			alert("Elegio Cine");
			fget_fechas();
			/*fact_programacion0();*/
		}
		if(textInput2.name=="fes_dia")
		{
			//alert("Elegio Cine");
			fget_paises();
			/*fact_programacion0();*/
		}
		if(textInput2.name=="fes_dia0")
		{
			//alert("Elegio Cine");
			fget_paises0();
			/*fact_programacion0();*/
		}
		if(textInput2.name=="fes_pais")
		{
			//alert("Elegio Cine");
			fact_programacion2();
			/*fact_programacion0();*/
		}
		if(navigator.userAgent.indexOf('MSIE')>=0)
		{
			//document.getElementById('selectBoxIframe' + parentNode2.id.replace(/[^\d]/g,'')).style.display='none';
		}
				
	}
	var activeOption2;
	function highlightSelectBoxOption2()
	{
		if(this.style.backgroundColor=='#316AC5'){
			this.style.backgroundColor='#666666';
			this.style.color='';
		}else{
			this.style.backgroundColor='#FFFFFF';
			this.style.color='#000000';			
		}	
		
		if(activeOption2){
			activeOption2.style.backgroundColor='';
			activeOption2.style.color='';			
		}
		activeOption2 = this;
		
	}
	
	function createEditableSelect2(dest)
	{

		dest.className='selectBoxInput2';		
		var div2 = document.createElement('DIV');
		div2.style.styleFloat = 'left';
		div2.style.width = dest.offsetWidth + 16 + 'px';
		div2.style.position = 'relative';
		div2.id = 'selectBox2' + selectBoxIds;
		var parent2 = dest.parentNode;
		parent2.insertBefore(div2,dest);
		div2.appendChild(dest);	
		div2.className='selectBox2';
		div2.style.zIndex = 10000 - selectBoxIds;

		var img2 = document.createElement('IMG');
		img2.src = arrowImage2;
		img2.className = 'selectBoxArrow2';
		
		img2.onmouseover = selectBox_switchImageUrl2;
		img2.onmouseout = selectBox_switchImageUrl2;
		img2.onclick = selectBox_showOptions2;
		img2.id = 'arrowSelectBox' + selectBoxIds;

		div2.appendChild(img2);
		
		var optionDiv2 = document.createElement('DIV');
		optionDiv2.id = 'selectBoxOptions' + selectBoxIds;
		optionDiv2.className='selectBoxOptionContainer2';
		optionDiv2.style.width = div2.offsetWidth-2 + 'px';
		div2.appendChild(optionDiv2);
		
		if(navigator.userAgent.indexOf('MSIE')>=0){
			var iframe2 = document.createElement('<IFRAME src="about:blank" frameborder=0>');
			iframe2.style.width = optionDiv2.style.width;
			iframe2.style.height = optionDiv2.offsetHeight + 'px';
			iframe2.style.display='none';
			iframe2.id = 'selectBoxIframe' + selectBoxIds;
			div2.appendChild(iframe2);
		}
		
		if(dest.getAttribute('selectBoxOptions')){
			var options2 = dest.getAttribute('selectBoxOptions').split(';');
			var optionsTotalHeight2 = 0;
			var optionArray2 = new Array();
			optionDiv2.style.height = options2.length * 16 + 'px';
			if(options2.length==3)
			{
			optionDiv2.style.height  = 70 + 'px';
			}
			for(var no2=0;no2<options2.length;no2++){
				var anOption2 = document.createElement('DIV');
				anOption2.innerHTML = options2[no2];
				anOption2.className='selectBoxAnOption2';
				anOption2.onclick = selectOptionValue2;
				//anOption2.style.width = optionDiv2.style.width.replace('px','') - 2 + 'px'; 
				anOption2.onmouseover = highlightSelectBoxOption2;
				optionDiv2.appendChild(anOption2);				
				optionsTotalHeight2 = optionsTotalHeight2 + anOption2.offsetHeight2;
				optionArray2.push(anOption2);
			}
			if(optionsTotalHeight2 > optionDiv2.offsetHeight2){				
				for(var no2=0;no2<optionArray2.length;no2++){
					optionArray2[no2].style.width = optionDiv2.style.width.replace('px','') - 22 + 'px'; 	
				}	
			}		
			optionDiv2.style.display='none';
			optionDiv2.style.visibility='visible';
		}
		
		selectBoxIds = selectBoxIds + 1;
	}
	
// Script del Combo box 3

	var arrowImage3 = 'images/flecha-select1.gif';	// Regular arrow
	var arrowImageOver3 = 'images/flecha-select1.gif';	// Mouse over
	var arrowImageDown3 = 'images/flecha-select1.gif';	// Mouse down
	
	//var selectBoxIds2 = 0;
	var currentlyOpenedOptionBox3 = false;
	var editableSelect_activeArrow3 = false;
	
	function selectBox_switchImageUrl3()
	{
		if(this.src.indexOf(arrowImage3)>=0){
			this.src = this.src.replace(arrowImage3,arrowImageOver3);	
		}else{
			this.src = this.src.replace(arrowImageOver3,arrowImage3);
		}
	}
	
	function selectBox_showOptions3()
	{
		if(editableSelect_activeArrow3 && editableSelect_activeArrow3!=this){
			editableSelect_activeArrow3.src = arrowImage3;
		}
		editableSelect_activeArrow3 = this;
		
		var numId3 = this.id.replace(/[^\d]/g,'');
		var optionDiv3 = document.getElementById('selectBoxOptions' + numId3);
		if(optionDiv3.style.display=='block'){
			optionDiv3.style.display='none';
			if(navigator.userAgent.indexOf('MSIE')>=0)
			document.getElementById('selectBoxIframe' + numId3).style.display='none';
			this.src = arrowImageOver3;			
		}else{
			optionDiv3.style.display='block';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId3).style.display='block';
			this.src = arrowImageDown3;	
			if(currentlyOpenedOptionBox3 && currentlyOpenedOptionBox3!=optionDiv3)
			currentlyOpenedOptionBox3.style.display='none';
			if(navigator.userAgent.indexOf('MSIE')>=0)document.getElementById('selectBoxIframe' + numId3).style.display='none';
			currentlyOpenedOptionBox3= optionDiv3;			
		}
	}
	
	function selectOptionValue3()
	{
		var parentNode3 = this.parentNode.parentNode;
		var textInput3 = parentNode3.getElementsByTagName('INPUT')[0];
		textInput3.value = this.innerHTML;
		var current_id=textInput3.getAttribute('id');
		var numero_id=current_id.substr(6);
		var name_page= document.getElementById("pagina").value;
		this.parentNode.style.display='none';
//		document.getElementById('arrowSelectBox' + parentNode2.id.replace(/[^\d]/g,'')).src = arrowImageOver2;
		if(navigator.userAgent.indexOf('MSIE')>=0)
		{
			//document.getElementById('selectBoxIframe' + parentNode2.id.replace(/[^\d]/g,'')).style.display='none';
		}
	}
	var activeOption3;
	function highlightSelectBoxOption3()
	{
		if(this.style.backgroundColor=='#316AC5'){
			this.style.backgroundColor='#666666';
			this.style.color='';
		}else{
			this.style.backgroundColor='#FFFFFF';
			this.style.color='#000000';			
		}	
		
		if(activeOption3){
			activeOption3.style.backgroundColor='';
			activeOption3.style.color='';			
		}
		activeOption3 = this;
		
	}
	
	function createEditableSelect3(dest)
	{

		dest.className='selectBoxInput3';		
		var div3 = document.createElement('DIV');
		div3.style.styleFloat = 'left';
		div3.style.width = dest.offsetWidth + 16 + 'px';
		div3.style.position = 'relative';
		div3.id = 'selectBox3' + selectBoxIds;
		var parent3 = dest.parentNode;
		parent3.insertBefore(div3,dest);
		div3.appendChild(dest);	
		div3.className='selectBox3';
		div3.style.zIndex = 10000 - selectBoxIds;

		var img3 = document.createElement('IMG');
		img3.src = arrowImage3;
		img3.className = 'selectBoxArrow3';
		
		img3.onmouseover = selectBox_switchImageUrl3;
		img3.onmouseout = selectBox_switchImageUrl3;
		img3.onclick = selectBox_showOptions3;
		img3.id = 'arrowSelectBox' + selectBoxIds;

		div3.appendChild(img3);
		
		var optionDiv3 = document.createElement('DIV');
		optionDiv3.id = 'selectBoxOptions' + selectBoxIds;
		optionDiv3.className='selectBoxOptionContainer3';
		optionDiv3.style.width = div3.offsetWidth-2 + 'px';
		div3.appendChild(optionDiv3);
		
		if(navigator.userAgent.indexOf('MSIE')>=0){
			var iframe3 = document.createElement('<IFRAME src="about:blank" frameborder=0>');
			iframe3.style.width = optionDiv3.style.width;
			iframe3.style.height = optionDiv3.offsetHeight + 'px';
			iframe3.style.display='none';
			iframe3.id = 'selectBoxIframe' + selectBoxIds;
			div3.appendChild(iframe3);
		}
		
		if(dest.getAttribute('selectBoxOptions')){
			var options3 = dest.getAttribute('selectBoxOptions').split(';');
			var optionsTotalHeight3 = 0;
			var optionArray3 = new Array();
			optionDiv3.style.height = options3.length * 16 + 'px';
			if(options3.length==3)
			{
			optionDiv3.style.height  = 70 + 'px';
			}
			for(var no3=0;no3<options3.length;no3++){
				var anOption3 = document.createElement('DIV');
				anOption3.innerHTML = options3[no3];
				anOption3.className='selectBoxAnOption3';
				anOption3.onclick = selectOptionValue3;
				//anOption2.style.width = optionDiv2.style.width.replace('px','') - 2 + 'px'; 
				anOption3.onmouseover = highlightSelectBoxOption3;
				optionDiv3.appendChild(anOption3);				
				optionsTotalHeight3 = optionsTotalHeight3 + anOption3.offsetHeight3;
				optionArray3.push(anOption3);
			}
			if(optionsTotalHeight3 > optionDiv3.offsetHeight3){				
				for(var no3=0;no3<optionArray3.length;no3++){
					optionArray3[no3].style.width = optionDiv3.style.width.replace('px','') - 22 + 'px'; 	
				}	
			}		
			optionDiv3.style.display='none';
			optionDiv3.style.visibility='visible';
		}
		
		selectBoxIds = selectBoxIds + 1;
	}

//Scroll div nuestros Cines
  function move_dat() {
    scroll_clipper.scrollTop = 0;
  }
  function move_ser() {
    scroll_clipper.scrollTop = 215;
  }
  function move_pre() {
    scroll_clipper.scrollTop = 395;
  }
  function move_pro() {
    scroll_clipper.scrollTop = 535;
  }
// Scroll div planet Premium
  function move_des() {
    scroll_clipper.scrollTop = 0;
  }
  function move_afi() {
    scroll_clipper.scrollTop = 110;
  }
  function move_acu() {
    scroll_clipper.scrollTop = 205;
  }
  function move_ben() {
    scroll_clipper.scrollTop = 285;
  }
  function move_preg() {
    scroll_clipper.scrollTop = 465;
  }
  function move_con() {
    scroll_clipper.scrollTop = 910;
  }
// Obtener datos del cine
function cargaDAT()
{
	var idcine=document.getElementById("cines").value;
	if(idcine=="SELECCIONAR CINE:")
	{
	idcine="CinePlanet Alcázar";
	document.getElementById("cineplanet_alcazar").style.display="Block";
	document.getElementById("cine_ante").value="cineplanet_alcazar";
	}
	else
	{
	nom_map_ant=document.getElementById("cines").value;	
	nom_div_min=nom_map_ant.toLowerCase();
	nom_div_esp=nom_div_min.replace(" ","_");
	nom_div_esp2=nom_div_esp.replace(" ","_");
	nom_div=nom_div_esp2.replace("á","a");
	anterior_com=nom_div;
		if(document.getElementById("cine_ante").value==anterior_com)
		{
		anterior_repe=document.getElementById("cine_ante").value;	
		}
		else
		{
		anterior_norepe=document.getElementById("cine_ante").value;	
		document.getElementById(anterior_com).style.display="Block";	
		document.getElementById(anterior_norepe).style.display="none";
		document.getElementById("cine_ante").value=anterior_com;
		}

	}
	
	document.getElementById("complejo").value=idcine;
	var decine=document.getElementById("complejo").value;
	document.getElementById("des_cine").firstChild.nodeValue=decine.toUpperCase();
	nom=decine.substr(11,100);
	nom_min=nom.toLowerCase();
	nom_til=nom_min.replace("á","a");
	nom_esp=nom_til.replace(" ","-");
	nom_fot="<img src='../../11encuentro_culminado_beta/js/images/cines/cine-planet_"+nom_esp+".jpg' width='310' height='89' />";
	document.getElementById("foto_cine").innerHTML=nom_fot;
	ajax_dat=nuevoAjax();
		ajax_dat.open("GET", "get_cine_dat.php?seleccionado="+idcine, true);
		
		ajax_dat.onreadystatechange=function() 
		{ 

			if (ajax_dat.readyState==1)
			{
				//cargando	
			}
			if (ajax_dat.readyState==4)
			{ 
				document.getElementById("dat_cine").innerHTML=ajax_dat.responseText;
			} 
		}
		ajax_dat.send(null);
}
// Obtener detalle de pelicula referencia nuestros cines
function get_detalle(pelicula)
{
	if(document.getElementById("cines").value=="SELECCIONAR CINE:")
	{
	idcine="CinePlanet Alcázar";
	}
	else
	{
	idcine=document.getElementById("cines").value;
	}
	document.getElementById("cine").value=idcine;
	document.getElementById("pelicula").value=pelicula;
	document.frm.submit();
}
//
function get_detalle_ref_cartelera(num)
{
	var i_idpelicula="idpelicula"+num;
	var i_idcine="idcine"+num;
	document.getElementById("pelicula").value=document.getElementById(i_idpelicula).value;
	document.getElementById("cine").value=document.getElementById(i_idcine).value;
	document.frm.submit();
}
// Obtener datos de la noticia
function get_noticia(codnoticia)
{
	var idnoticia=codnoticia;
	nom_fot="<img src='../../11encuentro_culminado_beta/js/images/noticias/"+idnoticia+".jpg' width='371' height='89' />";
	document.getElementById("foto_noticia").innerHTML=nom_fot;
	ajax_dat=nuevoAjax();
		ajax_dat.open("GET", "get_noticia.php?seleccionado="+idnoticia, true);
		ajax_dat.onreadystatechange=function() 
		{ 
			if (ajax_dat.readyState==1)
			{
				//cargando	
			}
			if (ajax_dat.readyState==4)
			{ 
				document.getElementById("contenido_noticia").innerHTML=ajax_dat.responseText;
			} 
		}
		ajax_dat.send(null);
}
// Nuestra Empresa
function move_nh()
{
    document.getElementById("scroll_clipper").scrollTop = 0;
}
function move_nm()
{
	//alert("Hola");
	document.getElementById("scroll_clipper").scrollTop = 355;
    //this.scrollTop = 355;
}
function move_nv()
{
    document.getElementById("scroll_clipper").scrollTop = 455;
}
// Obtener datos de la promocion
function get_promocion(codnoticia)
{
	var idnoticia=codnoticia;
	//nom_fot="<img src='../../11encuentro_culminado_beta/js/images/noticias/"+idnoticia+".jpg' width='169' height='89' />";
	//document.getElementById("foto_noticia").innerHTML=nom_fot;
	ajax_dat=nuevoAjax();
		ajax_dat.open("GET", "get_promocion.php?seleccionado="+idnoticia, true);
		ajax_dat.onreadystatechange=function() 
		{ 
			if (ajax_dat.readyState==1)
			{
				//cargando	
			}
			if (ajax_dat.readyState==4)
			{ 
				document.getElementById("contenido_promocion").innerHTML=ajax_dat.responseText;
			} 
		}
		ajax_dat.send(null);
}
// estrenos
function move_to_movie(position) {
    scroll_clipper.scrollTop = position;
  }
//detalle pelicula
function get_fechas()
{
	var idcine=document.getElementById("cines").value;
	var idpelicula=document.getElementById("pelicula").value;
	var idfecha=document.getElementById("fecha").value;
//	<input type="hidden" name="fecha" id="fecha" value="<? echo date("Y-m-d"); ?>" />
//+"&idfecha="+idfecha
//alert("get_fechas_funcion.php?idcine="+idcine+"&idpelicula="+idpelicula+"&idfecha="+idfecha);
	ajax_fecha=nuevoAjax();
	ajax_fecha.open("GET", "get_fechas_funcion.php?idcine="+idcine+"&idpelicula="+idpelicula+"&idfecha="+idfecha, true);
	ajax_fecha.onreadystatechange=function() 
		{ 
			if (ajax_fecha.readyState==1)
			{
				//script -- cargando
			}
			if (ajax_fecha.readyState==4)
			{ 
				document.getElementById("dv_fechas").innerHTML=ajax_fecha.responseText;
			} 
		}
	ajax_fecha.send(null);
	get_funciones(document.getElementById("fecha").value);	

}
function get_funciones(fecha)
{
	var idcine=document.getElementById("cines").value;
	var idpelicula=document.getElementById("pelicula").value;
	var idfecha=fecha;
	ajax_funciones=nuevoAjax();
	ajax_funciones.open("GET", "get_funciones.php?idcine="+idcine+"&idpelicula="+idpelicula+"&idfecha="+idfecha, true);
	ajax_funciones.onreadystatechange=function() 
		{ 
			if (ajax_funciones.readyState==1)
			{
				//script -- cargando
			}
			if (ajax_funciones.readyState==4)
			{
				//alert(ajax_funciones.responseText);
				document.getElementById("dv_dethorarios").innerHTML=ajax_funciones.responseText;
			} 
		}
		ajax_funciones.send(null);

}
