
/**********************************************************************************/
//       *********  ROTACIÓN DE IMÁGENES                  *********
/************************************************************************************/


var posicion = 0;
var transicion = 0;
var listaImg = new Array('../../../COMUN/ImagenesCabecera/1.jpg',
						 '../../../COMUN/ImagenesCabecera/2.jpg',
						 '../../../COMUN/ImagenesCabecera/3.jpg',
						 '../../../COMUN/ImagenesCabecera/4.jpg',
						 '../../../COMUN/ImagenesCabecera/5.jpg',
						 '../../../COMUN/ImagenesCabecera/6.jpg');


function actualizar (pos,tran){
	if (document.all){
		if (parseFloat(navigator.appVersion)>=4){
			document.miImagen.filters[0].apply();
			document.miImagen.filters[0].transition=tran;
			document.miImagen.src=listaImg[posicion];
			document.miImagen.filters[0].play();
		}else{
			document.miImagen.src=listaImg[posicion];
		}
	}else{
		if (parseFloat(navigator.appVersion)>=4){
			document.miImagen.src=listaImg[posicion];
		}else{
			document.miImagen.src=listaImg[posicion];
		}	
	}
	thetimer = setTimeout("siguiente()",6000);
}

function siguiente() {
	if (document.images && posicion < listaImg.length-1) {
		posicion++;
	}else{
		posicion = 0;
	}
	if (document.images && transicion < 23) {
		transicion++;
	}else{
		transicion = 0;
	}
	actualizar (posicion,transicion);
		
}
/*
*ESTA FUNCIÓN SIMPLEMENTE CREA EL MOVIMIENTO EN EL CARRUSEL DE IMÁGENES EN EL CASO
*EN EL QUE SEA LA PORTADA DE CLMTURISMO. EN CASO CONTRARIO NO HACE NADA.
*/
function InicioCarrusel(EsLaPortada){
	if (EsLaPortada=='True') {
		setTimeout('siguiente()',6000);
	}
}



/**********************************************************************************/
//       *********  OPACIDAD DE IMÁGENES                  *********
/************************************************************************************/


function o_down(theobject){
     object=theobject
     while(object.filters.alpha.opacity>60){
     object.filters.alpha.opacity+=-10}
}

function o_up(theobject){
     object=theobject
     while(object.filters.alpha.opacity<100){
     object.filters.alpha.opacity+=10}
}


/**********************************************************************************/
//       *********  CARGA INICIAL DE PÁGINA                  *********
/************************************************************************************/

function Inicio() {
	window.defaultStatus='Cultura de Castilla - La Mancha';
	window.name='PortadaCultura';
	/*Maximizar();*/
}


/**********************************************************************************/
//       *********  MAXIMIZAR VENTANA                  *********
/************************************************************************************/
function Maximizar() {
	
	
	/*SI NO ESTÁ COMPLETAMENTE MAXIMIZADA LA VENTANA ENTONCES LA MAXIMIZAMOS TODO LO QUE PODAMOS*/
	
	if(	document.body.clientWidth/screen.width < 0.97 || document.body.clientHeight/screen.height < 0.97) {
		if (document.all) {
			window.moveTo(0,0);
			top.window.resizeTo(screen.availWidth,screen.availHeight);
		}
		else {
			if (document.layers||document.getElementById) {
				if (top.window.outerHeight<screen.availHeight || top.window.outerWidth<screen.availWidth){
					top.window.outerHeight = screen.availHeight;
					top.window.outerWidth = screen.availWidth;
				}
			}
		}
	}
				
}

/**********************************************************************************/
//       *********  MUESTRA VENTANA NUEVA Y CROMADA                       *********
/************************************************************************************/


function openchromeless(theURL,wname,W,H,X,Y,NONEgrf,CLOSEdwn,CLOSEup,CLOSEovr,MINIdwn,MINIup,MINIovr,CLOCKgrf,titHTML,titWIN,winBORDERCOLOR,winBORDERCOLORsel,winBGCOLOR,winBGCOLORsel){
	var isie=false
	var isv55=false
	var iswin=false
	if(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)>=4){isie=true;if(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE ")+5,navigator.appVersion.indexOf("MSIE ")+8)>=5.5)isv55=true}
	if(navigator.userAgent.toLowerCase().indexOf("win")!=-1)iswin=true
	if(X==null)X=Math.ceil((window.screen.width-W)/ 2)
	if(Y==null)Y=Math.ceil((window.screen.height-H)/ 2)
	if(isie){H=H+20+3;W=W+2;}
	var s=",width="+W+",height="+H;
	if(isie&&iswin){
	var chromeTIThtml=''+
	'<html>\n'+
	'<head>\n'+
	'<style type="text/css">\n'+
	'#crtMOVE {position:absolute;left:0px;top:0px;z-index:2;}\n'+
	'#txtTITLE {position:absolute;left:0px;top:0px;width:100%;height:20px;z-index:1;clip:rect(0,100%,20,0);}\n'+
	'#btnCLOSE {position:absolute;left:-20px;top:4px;width:11px;height:11px;z-index:3;clip:rect(0,11,11,0);}\n'+
	'#btnMINI {position:absolute;left:-20px;top:4px;width:11px;height:11px;z-index:3;clip:rect(0,11,11,0);}\n'+
	'#grfCLOCK {position:absolute;left:-20px;top:4px;width:11px;height:11px;z-index:3;clip:rect(0,11,11,0);}\n'+
	'</style>\n'+
	'<script language="javascript">\n'+
	'var imgCLOSEdwn=new Image();imgCLOSEdwn.src="'+CLOSEdwn+'"\n'+
	'var imgCLOSEup=new Image();imgCLOSEup.src="'+CLOSEup+'"\n'+
	'var imgCLOSEovr=new Image();imgCLOSEovr.src="'+CLOSEovr+'"\n'+
	'var imgMINIdwn=new Image();imgMINIdwn.src="'+MINIdwn+'"\n'+
	'var imgMINIup=new Image();imgMINIup.src="'+MINIup+'"\n'+
	'var imgMINIovr=new Image();imgMINIovr.src="'+MINIovr+'"\n'+
	'var CLOCKgrfImg=new Image();CLOCKgrfImg.src="'+CLOCKgrf+'"\n'+
	'document.onselectstart=new Function("return false;")\n'+
	'document.ondragstart=new Function("moveWIN();return false;")\n'+
	'document.oncontextmenu=new Function("return false;")\n'+
	'document.onmousemove=moveWIN\n'+
	'winSTATUS="up"\n'+
	'function setLAYOUT() {\n'+
	'document.all["btnCLOSE"].style.pixelLeft=document.body.clientWidth-18\n'+
	'if ( top.mainloaded ) {\n'+
	'document.all["grfCLOCK"].style.visibility="hidden"\n'
	if(isv55){
	chromeTIThtml+=''+
	'document.all["btnMINI"].style.visibility="visible"\n'+
	'document.all["btnMINI"].style.pixelLeft=document.body.clientWidth-38\n'
	}
	chromeTIThtml+=''+
	'}\n'+
	'else {\n'+
	'document.all["btnMINI"].style.visibility="hidden"\n'+
	'document.all["grfCLOCK"].style.pixelLeft=document.body.clientWidth-38\n'+
	'setTimeout("setLAYOUT()",500)\n'+
	'}\n'+
	'}\n'+
	'function minimizeWIN() {\n'+
	'top.window.moveTo(0,-4000)\n'+
	'if ( (top.opener) && (!top.opener.closed) ) { top.opener.window.focus();}\n'+
	'top.window.blur()\n'+
	'}\n'+
	'function moveWIN() {\n'+
	'if ( winSTATUS=="down") {\n'+
	'document.body.bgColor="'+winBGCOLORsel+'"\n'+
	'parent.bordeM.document.body.bgColor="'+winBORDERCOLORsel+'"\n'+
	'parent.bordeT.document.body.bgColor="'+winBORDERCOLORsel+'"\n'+
	'parent.bordeB.document.body.bgColor="'+winBORDERCOLORsel+'"\n'+
	'parent.bordeL.document.body.bgColor="'+winBORDERCOLORsel+'"\n'+
	'parent.bordeR.document.body.bgColor="'+winBORDERCOLORsel+'"\n'+
	'ofx=event.x\n'+
	'ofy=event.y\n'+
	'winSTATUS="drag"\n'+
	'}\n'+
	'else if ( winSTATUS=="drag") {\n'+
	'px=event.screenX-ofx-1\n'+
	'py=event.screenY-ofy-1\n'+
	'top.window.x=px\n'+
	'top.window.y=py\n'+
	'top.window.moveTo(px,py)\n'+
	'} else {\n'+
	'document.body.bgColor="'+winBGCOLOR+'"\n'+
	'parent.bordeM.document.body.bgColor="'+winBORDERCOLOR+'"\n'+
	'parent.bordeT.document.body.bgColor="'+winBORDERCOLOR+'"\n'+
	'parent.bordeB.document.body.bgColor="'+winBORDERCOLOR+'"\n'+
	'parent.bordeL.document.body.bgColor="'+winBORDERCOLOR+'"\n'+
	'parent.bordeR.document.body.bgColor="'+winBORDERCOLOR+'"\n'+
	'winStatus="up"\n'+
	'}\n'+
	'}\n'+
	'</script>\n'+
	'</head>\n'+
	'<body onresize="setLAYOUT()" bgcolor='+winBGCOLOR+'>\n'+
	'<div id=crtMOVE><img onmousedown="winSTATUS=\'down\';moveWIN()" onmouseup="winSTATUS=\'up\';moveWIN()" border=0 src="'+NONEgrf+'" width=110% height=500></div>\n'+
	'<div id=txtTITLE>'+'<table width=100% height=20 border=0 cellpadding=0 cellspacing=0><tr><td valign=middle align=left>'+titHTML+'</td></tr></table>'+'</div>\n'+
	'<div id=btnCLOSE><img name=imgCLOSE src="'+CLOSEup+'" border=0 width=11 height=11 onmouseover="this.src=imgCLOSEovr.src" onmouseout="btnSTATUS=false;this.src=imgCLOSEup.src" onmouseup="this.src=imgCLOSEup.src" onmousedown="this.src=imgCLOSEdwn.src" onclick="top.window.close()"></div>\n'+
	'<div id=btnMINI><img name=imgMINI src="'+MINIup+'" border=0 width=11 height=11 onmouseover="this.src=imgMINIovr.src" onmouseout="btnSTATUS=false;this.src=imgMINIup.src" onmouseup="this.src=imgMINIup.src" onmousedown="this.src=imgMINIdwn.src" onclick="minimizeWIN()"></div>\n'+
	'<div id=grfCLOCK><img name=imgCLOCK src="'+CLOCKgrf+'" border=0 width=11 height=11></div>\n'+
	'<script>setLAYOUT()</script>\n'+
	'</body>\n'+
	'</html>\n'
	var chromeFRMhtml=''+
	'<HTML>\n'+
	'<HEAD>\n'+
	'<TITLE>'+titWIN+'</TITLE>\n'+
	'</HEAD>\n'+
	'<script>\n'+
	'top.mainloaded=false\n'+
	'function generatetitle() {\n'+
	'if( window.frames["frmTIT"] && window.frames["bordeL"] && window.frames["bordeB"] && window.frames["bordeR"] && window.frames["bordeM"] ) {\n'+
	'frmTIT.document.bgColor="'+winBGCOLOR+'"\n'+
	'frmTIT.document.open()\n'+
	'frmTIT.document.write( "'+quitasaltolinea(chromeTIThtml)+'" )\n'+
	'frmTIT.document.close()\n'+
	'bordeM.document.bgColor="'+winBORDERCOLOR+'"\n'+
	'bordeL.document.bgColor="'+winBORDERCOLOR+'"\n'+
	'bordeR.document.bgColor="'+winBORDERCOLOR+'"\n'+
	'bordeB.document.bgColor="'+winBORDERCOLOR+'"\n'+
	'bordeT.document.bgColor="'+winBORDERCOLOR+'"\n'+
	'} else {\n'+
	'setTimeout("generatetitle()",20)\n'+
	'}\n'+
	'}\n'+
	'top.window.h='+H+'\n'+
	'top.window.w='+W+'\n'+
	'top.window.x='+X+'\n'+
	'top.window.y='+Y+'\n'+
	'generatetitle()\n'+
	'</script>\n'+
	'<frameset onload="top.mainloaded=true" onfocus="top.window.moveTo(top.window.x,top.window.y)" border=0 framespacing=0 frameborder=0 cols="1,100%,1">\n'+
	'<frame name=bordeL src="about:blank" scrolling=no noresize>\n'+
	'<frameset border=0 framespacing=0 frameborder=0 rows="1,20,1,100%,1">\n'+
	'<frame name=bordeT src="about:blank" scrolling=no noresize>\n'+
	'<frame name=frmTIT src="about:blank" scrolling=no noresize>\n'+
	'<frame name=bordeM src="about:blank" scrolling=no noresize>\n'+
	'<frame name=main src="'+theURL+'">\n'+
	'<frame name=bordeB src="about:blank" scrolling=no noresize>\n'+
	'</frameset>\n'+
	'<frame name=bordeR src="about:blank" scrolling=no noresize>\n'+
	'</frameset>\n'+
	'</HTML>'
	var CWIN=window.open("",wname,"fullscreen=1"+s)
	CWIN.resizeTo(Math.ceil(W),Math.ceil(H))
	CWIN.moveTo(Math.ceil(X),Math.ceil(Y))
	CWIN.document.open()
	CWIN.document.write(chromeFRMhtml)
	CWIN.document.close()
	}
	else{
		var CWIN=window.open(theURL,wname,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0"+s,true)
			CWIN.moveTo(Math.ceil(X),Math.ceil(Y))
	}
	CWIN.focus()
	return CWIN
}
function quitasaltolinea(txt){
	var salida=txt.toString()
	var re=/\\/g;var salida=salida.replace(re,"\\\\");
	re=/\//g;var salida=salida.replace(re,"\\\/");
	re=/\"/g;var salida=salida.replace(re,"\\\"");
	re=/\'/g;var salida=salida.replace(re,"\\\'");
	re=/\n/g;var salida=salida.replace(re,"\\n");
	return salida
}
function openIT (theURL,W,H,X,Y, wname, title) {
	CLOSEdwn 		= "/clmturiocio/Contenidos/donde_dormir/imagenes/img_ventana/close_dwn.gif"
	CLOSEup 		= "/clmturiocio/Contenidos/donde_dormir/imagenes/img_ventana/close_up.gif"
	CLOSEovr 		= "/clmturiocio/Contenidos/donde_dormir/imagenes/img_ventana/close_ovr.gif"
	MINIdwn 		= "/clmturiocio/Contenidos/donde_dormir/imagenes/img_ventana/mini_dwn.gif"
	MINIup 			= "/clmturiocio/Contenidos/donde_dormir/imagenes/img_ventana/mini_up.gif"
	MINIovr 		= "/clmturiocio/Contenidos/donde_dormir/imagenes/img_ventana/mini_ovr.gif"
	NONEgrf 		= "/clmturiocio/Contenidos/donde_dormir/imagenes/img_ventana/none.gif"
	CLOCKgrf		= "/clmturiocio/Contenidos/donde_dormir/imagenes/img_ventana/clock.gif"
	titHTML 	    	= title
	titWIN			= 'Leyenda'
	winBORDERCOLOR   	= "#000099"
	winBORDERCOLORsel	= "#000000"
	winBGCOLOR    		= "#FFFFFF"
	winBGCOLORsel 		= "#FFFFFF"
	return openchromeless(theURL, wname, W, H, X, Y, NONEgrf, CLOSEdwn, CLOSEup, CLOSEovr, MINIdwn, MINIup, MINIovr, CLOCKgrf, titHTML, titWIN, winBORDERCOLOR, winBORDERCOLORsel, winBGCOLOR, winBGCOLORsel)
}
function MovilistoPopUp (html,anch, alt,titulo) {
	//los dos parámetros centrales es la posición en la que va a salir HORZ y VERT
	mywinname04=openIT(html, anch, alt, 300,180, 'mywinname04',titulo);
}











/**********************************************************************************/
//       *********  CONTADOR DE CLICK'S                  *********
/************************************************************************************/
var TRACKfrObj;

function TRACKlink(CounterScript) {
  if (!document.createElement) { return true };
  var TRACKfrDoc;
  if (!TRACKfrObj && document.createElement) {
    try {
      var TRACKfrtemp=document.createElement('iframe');
      TRACKfrtemp.setAttribute('id','TRACKframe');
      TRACKfrtemp.style.border='0px';
      TRACKfrtemp.style.width='0px';
      TRACKfrtemp.style.height='0px';
      TRACKfrObj = document.body.appendChild(TRACKfrtemp);
      if (document.frames) {TRACKfrObj = document.frames['TRACKframe']; }
    }
    catch(exception) {
      TRACKhf='\<iframe id=" TRACKframe" style="';
      TRACKhf+='border:0px;';
      TRACKhf+='width:0px;';
      TRACKhf+='height:0px;';
      TRACKhf+='"><\/iframe>';
      document.body.innerHTML+= TRACKhf;
      TRACKfrObj = new Object();
      TRACKfrObj.document = new Object();
      TRACKfrObj.document.location = new Object();
      TRACKfrObj.document.location.iframe = document.getElementById('TRACKframe');
      TRACKfrObj.document.location.replace = function(location)
        { this.iframe.src = location; }
    }
  }
  if (navigator.userAgent.indexOf('Gecko') !=-1 && ! TRACKfrObj.contentDocument)
    {setTimeout(' TRACKtrack()',10); return false;}
  // Browser tipo/version NS6
  if (TRACKfrObj.contentDocument) {TRACKfrDoc = TRACKfrObj.contentDocument;}
  // Browser tipo/version IE5.5 & IE6
  else if (TRACKfrObj.contentWindow) {TRACKfrDoc = TRACKfrObj.contentWindow.document;}
  // Browser tipo/version IE5
  else if (TRACKfrObj.document) {TRACKfrDoc = TRACKfrObj.document;}
  else { return true; }
  TRACKfrDoc.location.replace(CounterScript);
  return false;
}


/**********************************************************************************/
//       *********  OTRAS FUNCIONES                  *********
/************************************************************************************/

/*ESTA FUNCIÓN SIRVE PARA IMPRIMIR LA PÁGINA (pag) PASADA POR PARÁMETRO.
  idioma SIRVE PARA SACAR LA INFORMACIÓN (TEXTO EN BOTONES, Y DEMÁS) EN LA PANTALLA
  TAMBIÉN EN EL MISMO IDIOMA DEL TEXTO
*/
function ImprimirPagina(directorio,idioma,titulo,estilo,pag) {
	window.open('/'+directorio+'/'+idioma+'/Utilidades/Imprimir.asp?Pagina='+pag+'&Titulo='+titulo+'&Estilo='+estilo,'_blank','resizable=no,scrollbars=yes,menubar=no,directories=no,status=no,location=no,width=616,heigth=400')
}

function ImprimirPagina2(directorio,idioma,titulo,estilo,pag) {
	window.open('/'+directorio+'/'+idioma+'/Utilidades/Imprimir.asp?Pagina='+pag+'&Titulo='+titulo+'&Estilo='+estilo,'_blank','resizable=yes,scrollbars=yes,menubar=no,directories=no,status=no,location=no,width=618,heigth=550')
}


/*CAMBIA LA IMAGEN CON NOMBRE IMAGEN POR OTRA CON LA SIGUIENTE RUTA: RUTA+IMAGEN+ESTADO*/
function CambioImagen(ruta,imagen,estado){
	document.images(imagen).src=ruta + imagen + estado + ".gif";
}

function ira(pagina){
	window.open(pagina,"_self")
}
function abreventana(pagina){
	window.open(pagina,"window2","scrollbars=yes,resizable=yes,menubar=yes,directories=yes,status=yes,location=yes,width=900,height=600");				
}
function ImprimirRestaurante(Restaurante){
	window.open("Restaurantes/imprimir.asp?id="+Restaurante,"_blank","resizable=no,scrollbars=yes,menubar=no,directories=no,status=no,location=no,width=616,heigth=400");
}

function cambioImagen(cual, imagen)
{
	//cambio de la imagen
	cual.src = imagen;
	return true;
}
function CambiarImagen(img_ID,NuevaImagen) {
	var NuevoSRC='';
	var oImagen = document.getElementById(img_ID);
	var miMatriz = oImagen.src.split('/');
	var nElementos = miMatriz.length
				
	miMatriz[nElementos-1]=NuevaImagen;
	NuevoSRC=miMatriz.join('/');
	oImagen.src=NuevoSRC;
}

function ventanaSecundaria (URL){ 
   window.open(URL,"ventana1","width=250,height=250,scrollbars=NO,resizable=NO") 
}					

function EnviarPostal(Postal) {
	document.frmPostales.FicheroPostal.value=Postal;
	document.frmPostales.submit();
}
function ValidarEmail(email) {
    var cadena = "Direccion de correo no valida: " + email
      + "\nPor favor, introduce bien tu direccion";

    if( email.indexOf('@',0) <= 0  || email.indexOf('.',0) <= 0
     || email.indexOf(' ',0) != -1 || email.indexOf('/',0) != -1
     || email.indexOf(';',0) != -1 || email.indexOf('<',0) != -1
     || email.indexOf('>',0) != -1 || email.indexOf('*',0) != -1
     || email.indexOf('|',0) != -1 || email.indexOf('`',0) != -1
     || email.indexOf('&',0) != -1 || email.indexOf('$',0) != -1
     || email.indexOf('!',0) != -1 || email.indexOf('"',0) != -1
     || email.indexOf(':',0) != -1 ){
     
      
		alert(cadena); 
		return false; 
	}
    else 
		return true;
}


function Comprueba(valor) {	
	/*Asignamos el valor del tipo de petición (VISTA PREVIA ó ENVIAR)*/
	document.envia.Accion.value=valor;
	
	
	tunombre=document.envia.tunombre.value;
	tuemail=document.envia.tucorreo.value;
	sunombre=document.envia.sunombre1.value;
	suemail=document.envia.sucorreo1.value;



	if (tunombre==""){
		alert("Debes indicar tu nombre");
	}
	else {
	
		if (ValidarEmail(tuemail)){
		
			if (sunombre=="") {
				alert("Debes indicar el nombre de la persona a la quien vas a enviar la postal");
			}
			else {
				if (ValidarEmail(suemail)){
					document.envia.submit();
				}
			}
		}
	}		
	
}




/**********************************************************************************/
//       *********  EFECTOS VARIADOS                  *********
/************************************************************************************/

/*DA BORDE A LA IMAGEN CUANDO EL RATÓN SE POSICIONA SOBRE ELLA, SE LO QUITA CUANDO SALE*/
function borderit(which,color){
	if (document.all||document.getElementById){
		which.style.borderColor=color
	}
}

