//Juan Antonio Mayans
//Development 12-08-2003
//Formentera - Spain
//jmayans@arrakis.es
//obri finestra oer ses imatges
colorOk="#ffffff";
colorNok="#FFEADF";
colorNok2="#E6FFFF";
colorNok3="#ccffcc";

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function XTCmostra(estat){
document.getElementById('precarga').style.visibility = estat;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function XTCplus(id,tit,alt){
var windowX = (screen.width/2)-(800/2);
var windowY = (screen.height/2)-(600/2);
var localitzar = window.open("./foto.php?id="+id+"&tit="+tit+"&alt="+alt,"imatge","width=300,height=225,scrollbars=no");
localitzar.moveTo(windowX,windowY);
localitzar.focus();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function XTCbgcolor(objNom,color){
document.getElementById(objNom).style.backgroundColor=color;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function XTCvalidar(objFormulari,camps){//camps: camps del formulari a validar - tipus: tipus de dades del camp de formulari
	msg="";
	msg="<? echo $missatges[0];?>\n";
	with(objFormulari){
	entrada = new Date(ano.value,mes.value,dia.value);
	salida = new Date(ano2.value,mes2.value,dia2.value);
	window.status=entrada + " - " + salida;
		if (entrada>salida){//Si entrada mayor salida
		XTCbgcolor('ano',colorNok2);
		XTCbgcolor('mes',colorNok2);
		XTCbgcolor('dia',colorNok2);
		XTCbgcolor('ano2',colorNok2);
		XTCbgcolor('mes2',colorNok2);
		XTCbgcolor('dia2',colorNok2);
		msg+="Mayor";
		}
		else if (String(entrada)==String(salida)){//Si entrada igual que salida
		XTCbgcolor('ano',colorNok2);
		XTCbgcolor('mes',colorNok2);
		XTCbgcolor('dia',colorNok2);
		msg+="Igual";
		}
		else{
			XTCbgcolor('ano',colorOk);
			XTCbgcolor('mes',colorOk);
			XTCbgcolor('dia',colorOk);
			XTCbgcolor('ano2',colorOk);
			XTCbgcolor('mes2',colorOk);
			XTCbgcolor('dia2',colorOk);
		}
		separador="-";
		arrCamps=camps.split("-");
    	for (var i=0; i < arrCamps.length; i++) {
			if (eval(arrCamps[i]).value==""){
				XTCbgcolor(arrCamps[i],colorNok);
				msg +="\n\t-"+arrCamps[i];	
			}else{XTCbgcolor(arrCamps[i],colorOk);}
		}
		//alert(adultos.options[adultos.selectedIndex].value);
		if ((adultos.value==0)&&(ninos.value==0)){
			XTCbgcolor('adultos',colorNok3);
			XTCbgcolor('ninos',colorNok3);
			}
			else{
			XTCbgcolor('adultos',colorOk);
			XTCbgcolor('ninos',colorOk);
			}		
	}

	if (msg!="<? echo $missatges[0];?>\n"){
		//alert(msg);
		return false;
	}
		else{
			//return true;
			return false;
			}
	}	
	
/*	
			tmp=Xtacy_is_email(form1.Email.value);
			if (tmp==false){msg+="\n\t-" + Xtacy_msg(11);}
									//}
	if (form1.Fax.value==""){msg+="\n\t-" +Xtacy_msg(12);}
	if (form1.Pais.value==""){msg+="\n\t-" +Xtacy_msg(13);}
	if (form1.Telefono.value==""){msg+="\n\t-" +Xtacy_msg(14);}
	
    tmp= Xtacy_is_date(date1);
		if (tmp!=0) msg+="\n\t-" + Xtacy_msg(tmp) + "(<? echo $contacte[3];?>)";
	tmp= Xtacy_is_date(date2);
		if (tmp!=0) msg+="\n\t-" + Xtacy_msg(tmp) + "(<? echo $contacte[4];?>)";
		
	//if (form1.Comentarios.value==""){msg+="\n\t-" +Xtacy_msg(9);}*/
	
	
////////////////////////////////////////	
// crecer imagenes INICIO
///////////////////////////////////////
var ns4 = (document.layers); 
var ie4 = (document.all && !document.getElementById); 
var ie5 = (document.all && document.getElementById); 
var ns6 = (!document.all && document.getElementById); 
function attach(id)
{
 var obj
  if(ns4) obj = document.layers[id];
  else if(ie4) obj = document.all[id];
   else if(ie5 || ns6) obj = document.getElementById(id);
  return obj
} //var hab1=new Image(); 
//hab1.src="misc/suite_big.jpg"; position: relative
//var hab2=new Image(); 
//hab2.src="misc/room_big.jpg";  visibility: visible;
 
function damunt(Imatge,img,lay,w,h,step_h,step_v,count_lay,num_lay) { 
	if (document.images) {  
		old_img=document[Imatge].src;
		document[Imatge].src=img; 
		//rttreterte/
		//alert(lay);
		temp_Obj = attach(lay);
		//step_h = 10;
		//step_v = 10;
		//temp_Obj = attach(id); 
		if(ns4) { temp_Obj.visibility = "hidden";temp_Obj.zIndex = parseInt(3);document.parent.zIndex = parseInt(15);temp_Obj.top = parseInt(temp_Obj.top) - step_v; temp_Obj.left = parseInt(temp_Obj.left) - step_h; temp_Obj.visibility = "visible";
		}
		else {
			temp_Obj.style.visibility = "hidden";
			temp_Obj.style.zIndex = parseInt(100);
			temp_Obj.style.top = parseInt(temp_Obj.style.top) - step_v; 
			temp_Obj.style.left = parseInt(temp_Obj.style.left) - step_h; 
			temp_Obj.style.visibility = "visible";
				//*****************************************
				for (x=0;x<count_lay;x++){
				if(x==num_lay){
				document.getElementById("parent_"+x).style.zIndex=100;
				document.getElementById("lay_"+x).style.zIndex=101;
				}else{
					document.getElementById("parent_"+x).style.zIndex=x;
					document.getElementById("lay_"+x).style.zIndex=x;
					}
				}
				//window.status=lay+"-"+parent_1.style.zIndex;
				//*******************************************
		}
		document[Imatge].width=w;  
		document[Imatge].height=h;  
		//alert(temp_Obj.style.zIndex);
	} 
return temp_Obj;} 

function fora(Imatge,lay,w,h,step_h,step_v,count_lay) {  
	if (document.images) { 
		document[Imatge].src=old_img; 
		temp_Obj = attach(lay);
		//step_h = 10;
		//step_v = 10;
		//temp_O????? ???A:bj = attach(id);
		if(ns4) {temp_Obj.zIndex = parseInt(1);temp_Obj.top = parseInt(temp_Obj.top) + step_v; temp_Obj.left = parseInt(temp_Obj.left) + step_h; }
		else {temp_Obj.style.zIndex = parseInt(1);temp_Obj.style.top = parseInt(temp_Obj.style.top) + step_v; temp_Obj.style.left = parseInt(temp_Obj.style.left) + step_h; }
				//*****************************************
				for (x=0;x<count_lay;x++){
				
					document.getElementById("parent_"+x).style.zIndex=x;
					document.getElementById("lay_"+x).style.zIndex=x;
					
				}
				//window.status=lay+"-"+parent_1.style.zIndex;
				//*******************************************
		document[Imatge].width=w;
		document[Imatge].height=h;    
	} 
 return temp_Obj;} 

////////////////////////////////////////	
// crecer imagenes FIN
///////////////////////////////////////
