

/*******************************************

content box:
	ctab onmouseover to unactivate active
	ctab onclick to activate unactive

/*******************************************/

function initialize_ctabs(){


}
function activate_input(a){
	$(x).disabled=false;
}

function deactivate_input(x){
	$(x).disabled=true;
}
function activate_div(a){
	$(a).style.display="block";
}

function deactivate_div(x){
	$(x).style.display="none";
}
function load_lightwindow_and_image(imgId){
	
	myLightWindow.activateWindow({
		href: 'home/lightwindow', 
		title: 'Waiting for the show to start in Las Vegas', 
		author: 'Jazzmatt', 
		caption: 'Mmmmmm Margaritas! And yes, this is me...', 
		type:'iframe'
	
	});
	
	a= $$('.large_light');
	total=a.length;
	i=0;
	while(i<total){
		
		alert(a[i].id);
		activate_div(a[i].id);
		/*activate_div('test1');*/
		i++;
		
	}
}

function show_accordion_tab(Id){
	var a = $$('.accordion_content');
	total=a.length;
	i=0;
	while(i<total){
		
	/*	alert(a[i].id);*/
		if(a[i].id!="con_"+Id){
		deactivate_div(a[i].id);
		}else{
			activate_div(a[i].id);
		}
		/*activate_div('test1');*/
		i++;
		
	}	
}


/*************************

packages selector
	- hotel onchange select
*******************************/


function filterby_selector(filterby,section, ele_id){
	auxiliar="."+section;
	var a = $$(auxiliar);
	total=a.length;
	i=0;
	//alert(filterby +  " " + ele_id);
	switch (filterby){
		case "therapies":
		if(ele_id >= 0){
		
			while(i<total){
				var x = a[i].id;
				aux= x.split("_");
				
				if(ele_id==aux[1])
					activate_div(a[i].id);
				else{
					deactivate_div(a[i].id);
				}	
				i++;

			}

		}else{
			
				while(i<total){
					var x = a[i].id;

						activate_div(a[i].id);
					i++;

				}
		}
		break;
		case "treatment_type":
		if(ele_id >= 0){
		
			while(i<total){
				var x = a[i].id;
				aux= x.split("_");
				
				if(ele_id==aux[5])
					activate_div(a[i].id);
				else{
					deactivate_div(a[i].id);
				}	
				i++;

			}

		}else{
			
				while(i<total){
					var x = a[i].id;

						activate_div(a[i].id);
					i++;

				}
		}
		break;		
		case "location":
		a1= $('environment');
		a2= $('hotels');
		if(ele_id >= 0){
		
			while(i<total){
				var x = a[i].id;
				aux= x.split("_");
				
				if(ele_id==aux[3]){
					activate_div(a[i].id); 	a[i].addClassName("visible");}
				else{
					deactivate_div(a[i].id);		a[i].removeClassName("visible");
				}	
	
			/* 	i*/
				i++;

			}
			if(section=="dblcolumn"){
			if(ele_id==1){

					a1.disabled =true;
					a2.disabled =true;
				}else{

					/*a1.disabled =false;*/
					a2.disabled =false;
					
				}
			}
		}else{
			
				while(i<total){
					var x = a[i].id;

						activate_div(a[i].id);a[i].addClassName("visible");
					i++;

				}
				if(section=="dblcolumn"){
					a1.disabled =false;
				a1.selectedIndex=0;
				a2.disabled =false;
				a2.selectedIndex=0;
			}
				
		}

		break;
		case "hotel":
			if(ele_id > 0){
			
				while(i<total){
					var x = a[i].id;
					aux= x.split("_");

					if(ele_id==aux[2]){
						activate_div(a[i].id);a[i].addClassName("visible");}
					else{
						deactivate_div(a[i].id);a[i].removeClassName("visible");
					}	
					i++;

				}

			}else{
				
					while(i<total){
						var x = a[i].id;

							activate_div(a[i].id);a[i].addClassName("visible");
						i++;

					}
			}
			
		break;
		case "environment":
			if(ele_id > 0){
			
				while(i<total){
					var x = a[i].id;
					aux= x.split("_");

					if(ele_id==aux[7])
						activate_div(a[i].id);
					else{
						deactivate_div(a[i].id);
					}	
					i++;
				}

			}else{
					while(i<total){
						var x = a[i].id;
							activate_div(a[i].id);
						i++;

					}
			}
			
		break;
	}
}
	function hide_paginate_if_necessary(){
		totalactive = $$('.visible');
	
		if(totalactive.length<6){
			deactivate_div('pag_pagenumber_pages_container');
			if(totalactive.length==0){
			/*	var code ="<img width='622' height='396' alt='State 1' src='/>";
				var d = document.createElement(code);*/

				activate_div("no_packages");

			}else{
			
				deactivate_div("no_packages")
				
			}
		}else{
			activate_div('pag_pagenumber_pages_container');
			
				deactivate_div("no_packages")
			
			
		}
	}
/*	actions to restart
	- set map to original one (no stars)
	- set both auxiliar var to 0 
	- hide ul result and show brand selector 
*/
function branded_spas_initialize(){
var posx = [0,-77,231,154,77];
	hCarousel.scrollTo(0);
	$('numberclicks').innerHTML="0";
	$('brandselect').innerHTML="0";
	
	 $('resultselector').style.display="none";
 $('brandselector').style.display="block";
	allmaps = $$('.mapscrollto');
	cc = 0;
	while(cc<5){
		activex = posx[cc]+"px 0px";
		allmaps[cc].style.backgroundPosition= activex;		
		cc++;
	}
	
}

                                                                                                                               


/**
double action
scroll hcarousel to map
and hide all hotels not belonging to location in the resultselector item
*/

function location_navbardouble(scrollto, locationshow){

	vara =$('brandselect').innerHTML;
	varb =$('numberclicks').innerHTML;
	lts = varb -1;
	brd = vara -1;
	hCarousel.scrollTo(scrollto);
	var a = $$('#resultselector .result_item');
	total=a.length;
	i=0;

	while(i<total){
		var x = a[i].id;
		aux= x.split("_");
				
		/*	alert(aux[5]);
			alert(vara);alert(a[i].id);*/

		if (aux.length>1){

		
			if(vara == "0"){
			/**filter by location in the case no brand was selected**/
				if(varb > 0){ 
				
					if(aux[3]==lts){
						activate_div(a[i].id);
					}else{
							if((varb=="4")&&(aux.length=="7")){
						 		activate_div(a[i].id);
							}else{
								deactivate_div(a[i].id);
							}
						}
				}else{//case its the world map
					activate_div(a[i].id); //activate all (on the big map)
				}	
			}else{
		
			/**filter by location w/ brand  selected**/
				if(varb > 0){
	
					if((aux[3]==lts)&&(aux[5]==brd)){
						activate_div(a[i].id);
				
					}else{
						if((varb=="4")&&(aux.length=="7")&&(aux[5]==brd)){
					 		activate_div(a[i].id);
						}else{
							deactivate_div(a[i].id);
						}
					}
				}else{

					if(aux[5]==brd){
						activate_div(a[i].id); //activate all (on the big map belonging to brand)

					}
				}
	
	
			}
		}
		i++;
	}	
/*	 $('resultselector').style.display="block";
 $('brandselector').style.display="none";*/
	
}

function brand_navbartriple(scrollto, location,brand){

	if(brand<1){
		
	}
		

}
/*************************

packages expand functionality

*******************************/
function alertfulldescheight(action,hotel_id,package_id){
	
	aux1 = "truncate_"+hotel_id+"_"+package_id;
	aux2 = "infoholder_"+hotel_id+"_"+package_id;
	aux3 = "fulldesc_"+hotel_id+"_"+package_id;
	aux6 = "reflected_"+hotel_id+"_"+package_id;
	aux6b = "tablereflected_"+hotel_id+"_"+package_id;
	aux5 = "imageh_"+hotel_id+"_"+package_id;
	aux6_container = "sngcolumn_container_"+hotel_id+"_"+package_id;
	book = "book_this_"+hotel_id+"_"+package_id;
	imgtoreflect = "image_"+hotel_id+"_"+package_id;
	
	aux7 = "related_share_this_"+hotel_id+"_"+package_id;
	aux4 = "imgholder_"+hotel_id+"_"+package_id;
	other = $(aux7);
 	imgholder = $(aux4);
	fulldesc = $(aux3);
	infoholder = $(aux2);
	reflected = $(aux6);
 	image = $(aux5);
	truncate = $(aux1);	
	sngcolumncontainer=$(aux6_container);
	tt= $(aux6b);
	
	switch(action){
		case "expand":
			if(detect_ie()==false){
			Reflection.add($(imgtoreflect),"");
			}
			imgholder.removeClassName('closed');
			sngcolumncontainer.style.height="100%";
			activate_div(book);
			deactivate_div(truncate.id);
			activate_div(fulldesc.id);
			activate_div(other.id);
			
		break;
		case "shrink":
			if(detect_ie()==false){
				Reflection.remove($(imgtoreflect));
			}
				deactivate_div(book);
			imgholder.addClassName('closed');
				sngcolumncontainer.style.height="82px";
			activate_div(truncate.id);
			deactivate_div(fulldesc.id); 
			deactivate_div(other.id);
		break;
	}


	
	
}







function package_expand_shrink_functionality(action, hotel_id, package_id){
aux1 = "largepackage_"+hotel_id+"_"+package_id;

aux2 = "truncate_"+hotel_id+"_"+package_id;
aux3 = "fulldesc_"+hotel_id+"_"+package_id;

aux4 = "imgholder_"+hotel_id+"_"+package_id;
aux5 = "image_"+hotel_id+"_"+package_id;
aux6 = "reflected_"+hotel_id+"_"+package_id;
aux7 = "related_share_this_"+hotel_id+"_"+package_id;
	
	var largepackage = $(aux1);
	var truncate = $(aux2);	
	var fulldes = $(aux3);		
	var imgholder = $(aux4);
	var image = $(aux5);
	var reflected = $(aux6);
	var other = $(aux7);
	
	switch(action){
		case "expand":
			/*alert(image.id);*/
			if(detect_ie()==false){
				deactivate_div(image.id);
				activate_div(reflected.id);	
			}
			imgholder.removeClassName('closed');
			deactivate_div(truncate.id);
			activate_div(fulldes.id);
			activate_div(other.id);
			$('packagecontent').innerHTML = truncate.innerHTML 
			 truncate.innerHTML	= fulldes.innerHTML
			/*fulldes.style.marginTop="45px";*/
			/*fulldes.remove();*/
			/*new Insertion.Bottom()*/
		break;
		case "shrink":
			if(detect_ie()==false){
				activate_div(image.id);
				deactivate_div(reflected.id);
			}
			imgholder.addClassName('closed');

			
			activate_div(truncate.id);
			deactivate_div(fulldes.id); 


			truncate.innerHTML=	$('packagecontent').innerHTML;
			$('packagecontent').innerHTML = ""			
			deactivate_div(other.id);
		break;
	}
}

function detect_ie(){
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
	 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	 if (ieversion>=8)
	  return false;
	 else if (ieversion>=7)
	  return true;
	 else if (ieversion>=6)
	  return true;
	 else if (ieversion>=5)
	  return true;
	}else{
		return false;
	}
	
}

function closealltooltips(){
a= $$('.tooltip');
	
total=a.length;
i=0;
	while(i<total){
	
			deactivate_div(a[i].id);
	i++;
	}	
}


function setactivemenu(menucontroller){
	var menu = ['home','concept','spas','therapies','packages','media'];
	var nav = ['#mh','#mc','#ms','#mt','#mp','#mm'];
	var navw= [0,-76,-174,-248,-359,-465];
	a = $$('.activated');

	a[0].style.backgroundPosition="-0px -44px ";
	a[0].style.cursor="normal";
	
}



/***hidealltherapies**/
function alltherapies(act){
	therapies = $$(".dblcolumn");
	th_c = 0;
	switch(act){
		case "hide":
			$("therapiesholder").style.display="none";
			$('fulltherapycontainer').style.display="block"
	/*		$("therapy_paginator").style.display="none";*/
			$("indexfooter").style.display="none";
		break;
	
		case "show":
			$("therapiesholder").style.display="block";
			$('fulltherapycontainer').style.display="none";
		/*	$("therapy_paginator").style.display="block";*/
			$("indexfooter").style.display="block";
		break;
	}
}

function showallheaders(){
	heads = $$(".full_the");
/*	alert(heads.length);*/
	ch = 0;
	while(ch<heads.length){
		heads[ch].style.visibility="visible";
		ch++;
	}
	headst = $$(".showtherapy_title");
	/*alert(headst.length);*/
	cht = 0;
	while(cht<headst.length){
		headst[cht].style.visibility="visible";
		cht++;
	}
}
function showallheaders_typeface(){
	heads = $$(".typeface-js");
/*	alert(heads.length);*/
	ch = 0;
	while(ch<heads.length){
		heads[ch].style.visibility="visible";
		ch++;
	}
}

function showallheadersie(){
	heads = $$(".fttitle");
/*	alert(heads.length);*/
	ch = 0;
	while(ch<heads.length){
		heads[ch].style.visibility="visible";
		ch++;
	}

}

function alert_selectedindexes(){
	a1= $('environment');a1.disabled=true;
	a2= $('hotels');a2.disabled=true;
	/*alert('env :'+a1.selectedIndex+"hotel "+a2.selectedIndex );*/
}

function swap_background(bg,state){
	//aux="url(.."+bg+")
	body_id =[['body_caverock','light'], ['body_colour','dark'], ['body_darkwood','light'],['body_lightwood','dark'],['body_light','dark']];
/*	body = $('bodyloli');*/
	body = parent.document.getElementById('bodyloli');
	cont=0;
	while(cont<5){
		if(body_id[cont][0]==bg){
			body.addClassName(bg);
		}else{
			body.removeClassName(body_id[cont][0]);
		}
		cont++;
	}
parent.swap_menu(state);
parent.swap_links(state);

}


function swap_menu(state){
	allmenu = $$('.menuitem');
	oldstate=$('menu_style').innerHTML;
	os="menu_"+oldstate;
	contmenu = 0;
	s="menu_"+state;

		while(contmenu<allmenu.length){
				if(allmenu[contmenu].hasClassName('menu_dark')){
				allmenu[contmenu].removeClassName('menu_dark');
				}else if(allmenu[contmenu].hasClassName('menu_light')){
					allmenu[contmenu].removeClassName('menu_light');
				}	
				
				
				allmenu[contmenu].addClassName(s);			
				
			contmenu++;
		}
		
	/*	alert(state);*/
		parent.swap_links(state);

}

function swap_links(state){
	parent.swap_footer_logo(state);	parent.swap_sfooter_logo(state);

	all_links = $$('.systemlink');
	oldstate=$('menu_style').innerHTML;
	str ="";
	contmenu = 0;

		while(contmenu<all_links.length){
			
			if(all_links[contmenu].hasClassName('light')){
				all_links[contmenu].removeClassName('light');
			}else if (all_links[contmenu].hasClassName('dark')){
				all_links[contmenu].removeClassName('dark');
			}
				
			all_links[contmenu].addClassName(state);
	
			contmenu++;
	}
}

function swaplogo_and_placeit(logo){
	brand= ['yhispa','granmelia','melia','me','paradisus'];
	brandurl=['logo.png','logobox_granmelia.jpg','logobox_melia.jpg','logobox_me.jpg','logobox_paradisus.jpg'];

	vary= brand.indexOf(logo);
	menuline = "menu_line_"+$('locale').innerHTML;
	if(vary>0){
		theurl="url(/images/system/menu/"+brandurl[vary]+")";
		$('menu_logo').removeClassName('no_logo');		$('menu_logo').addClassName('brand_logo');
		$('menulinetop').removeClassName('mno_logo');
		$('menulinebottom').removeClassName('mno_logo');
		$(menuline).removeClassName('mno_logo');
		$('menulinetop').addClassName('mbrand_logo');
		$('menulinebottom').addClassName('mbrand_logo');
		$(menuline).addClassName('mbrand_logo');
		$('menulineright').addClassName('mrbrand_logo');
	/*	$('menu_logo').style.backgroundImage=theurl;*/
		$('menu_logo').setStyle({backgroundImage: theurl});
		if(detect_ie()){
		set_logo_for_ie(logo);	
		}	
	}else{

	}
}
function swaplogo_and_placeit_v2(logo){
	brand= ['yhispa','granmelia','melia','me','paradisus'];
	brandurl=['logo.png','logobox_granmelia.jpg','logobox_melia.jpg','logobox_me.jpg','logobox_paradisus.jpg'];

	vary= brand.indexOf(logo);
	menuline = "menu_line_"+$('locale').innerHTML;
	if(vary>0){
		theurl="url(/images/system/menu/"+brandurl[vary]+")";
		$('menu_logo').removeClassName('no_logo');		$('menu_logo').addClassName('brand_logo');
		$('menulinetop').removeClassName('mno_logo');
		$('menulinebottom').removeClassName('mno_logo');
		$(menuline).removeClassName('mno_logo');
		$('menulinetop').addClassName('mbrand_logo');
		$('menulinebottom').addClassName('mbrand_logo');
		$(menuline).addClassName('mbrand_logo');
		$('menulineright').addClassName('mrbrand_logo');
	/*	$('menu_logo').style.backgroundImage=theurl;*/
		$('menu_logo').setStyle({backgroundImage: theurl});

	}else{
		theurl="url(/images/system/menu/"+brandurl[vary]+")";
		$('menu_logo').removeClassName('brand_logo');		$('menu_logo').addClassName('no_logo');
		$('menulinetop').removeClassName('mbrand_logo');
		$('menulinebottom').removeClassName('mbrand_logo');
		$(menuline).removeClassName('mbrand_logo');
		$('menulinetop').addClassName('mno_logo');
		$('menulinebottom').addClassName('mno_logo');
		$(menuline).addClassName('mno_logo');
		
		$('menulineright').removeClassName('mrbrand_logo');
		$('menulineright').addClassName('mrno_logo');
		$('menu_logo').style.backgroundImage=theurl;	
	}
}

function set_logo_for_ie(logo){
	brand= ['yhispa','granmelia','melia','me','paradisus'];
	brandurl=['logo.png','logobox_granmelia.jpg','logobox_melia.jpg','logobox_me.jpg','logobox_paradisus.jpg'];

	vary= brand.indexOf(logo);
	theurl="url(/images/system/menu/"+brandurl[vary]+")";
	$('menu_logo').addClassName(logo);
	/*alert(theurl);
	,filter:'none'}*/
}	


function swap_footer_logo(state){
all_logos = $$('.footerlogo');
cont=0;
	while(cont<all_logos.length){
			aux = all_logos[cont].id
			v=aux.split("_");	
			if(state==aux[2]){
				
			}else{
				newid = v[0]+"_"+v[1]+"_"+state;
				all_logos[cont].id = newid;
			}
		cont++;
	}
}
function swap_sfooter_logo(state){
all_logos = $$('.sfooterlogo');
cont=0;
	while(cont<all_logos.length){
			aux = all_logos[cont].id
			v=aux.split("_");	
			if(state==aux[2]){
				
			}else{
				newid = v[0]+"_"+v[1]+"_"+state;
				all_logos[cont].id = newid;
			}
		cont++;
	}
}
function checkmenustyle(state,controller,logo){
	
	if(state == ""){
		swap_menu('dark');
	}else{
		swap_menu(state);
	}
	if(logo == ""){
       
	}else{
		if(!detect_ie()){
		swaplogo_and_placeit(logo);
		}
	}
}
function checkmenustyle_spas(state,controller,logo){
	
	if(state == ""){
		swap_menu('dark');
	}else{
		swap_menu(state);
	}
	if(logo == ""){
       
	}else{
		swaplogo_and_placeit_v2(logo);
	}
}
function checkdate(val_in, val_out){
	alert(val_in+" / "+val_out);
}
/*('<%= @locale %>','<%= package.id %>','<%= @hotel.id %>',$('e_date').value,$('x_date').value)*/
function showpackage(loc,pack,hotel){
	if((BrowserDetect.version =="6")&&(BrowserDetect.browser=="Explorer")){
			alert("packages cannot be reserved at this moment");
			
		}else{
		if(($('e_date').value!="")&&($('x_date').value!="")){
	
			var cin = $('e_date').value;
			var aux = cin.replace( ", ", "_" );
			var in_aux = aux.replace(" ", "_");
		/*	vcheckin = cin.split("/");
			checkin = vcheckin[0]+"_"+vcheckin[1]+"_"+vcheckin[2];*/
			var cout = $('x_date').value;
			var aux2 = cout.replace( ", ", "_" );
			var out_aux = aux2.replace(" ", "_");
			/*vcheckout = cout.split("/");
			checkout = vcheckout[0]+"_"+vcheckout[1]+"_"+vcheckout[2];*/ 

		
			str = "/"+loc+"/packages/"+pack+"/hotel/"+hotel+"/date_in/"+in_aux+"/date_out/"+out_aux;
			
			document.location.href=str;
		}else{
			alert("date is empty");
		}	
	}	
}

function therapy_checklocal(){
	if($('locations').value == "1"){
				$('environment').disabled =true;
				$('environment').selectedIndex=0;
				$('hotels').disabled =true;
				/*$('hotels').selectedIndex=0;*/
	}else{
			$('environment').disabled =false;

			$('hotels').disabled =false;

	}
}

function restart_typeface(){
/*	_typeface_js.typefaceInit();*/
	$('typeface').src = "/stylesheets/typeface-0.11.js";
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

/*************************************************/


var posx = [0,-77,231,154,77];
var actx=[0,2,1,3,4];
var ind=[0,1,2,3,4];
var locationtext=['WORLD','ASIA','CARRIBBEAN','EUROPE','SPAIN'];
var idx = ['filterworld','filterasia','filtercarr','filtereurope','filteriberia'];
var id = ['filterworld','filtercarr','filtereurope','filterasia','filteriberia'];
var brand = ['yhi','granmelia','melia','me','paradisus'];
var brandindex = [0,1,2,3,4];
var nav = ['mh','mc','ms','mt','mr','mm'];
var controller = ["home",'concept','spas','therapies','packages','media'];
var navw= ['0','-76px','-174px','-246px','-357px','-463px'];

/*************************************************/

function shownextactive(active){
	allinactive = $$('.inactive');
	alert(active);
	
}
function redirectoshowtherapy(glob,env,treat,hot,thera){
	
	url= "/"+$('locale').innerHTML+"/therapies/show/"+thera+"?global="+glob+"&location_therapy_id="+env+"&hotel_id="+hot+"&therapy_subsection_id="+treat;
	window.location.href=url;
}
if((BrowserDetect.browser =="Explorer")&&((BrowserDetect.version =="6" )||(BrowserDetect.version =="7" ))){
/*	alert("please change to a better browser, \n  we hear firefox is good");*/

}else{

	var headID = document.getElementsByTagName("head")[0];         
	var newScript = document.createElement('script');
	newScript.id="typeface";
	newScript.type = 'text/javascript';
	newScript.src = '/javascripts/typeface-0.11.js';
	headID.appendChild(newScript);
	
	var newScript2 = document.createElement('script');
	newScript2.id="opt_regular";
	newScript2.type = 'text/javascript';
	newScript2.src = '/javascripts/optimer_regular.typeface.js';
	headID.appendChild(newScript2);

	var newScript3 = document.createElement('script');
	newScript3.id="opt_bold";
	newScript3.type = 'text/javascript';
	newScript3.src = '/javascripts/optimer_bold.typeface.js';
	headID.appendChild(newScript3);
}

function update_reservation_prices(price){
	rawprice = $('reservationprice');
	rawpricecontent = price+" EUR";
	rawpriceunder = $('reservationpriceunder');
	rawpriceundercontent = "<p class='genericcontent'>"+price+" EUR</p>";
	rawpriceunder.innerHTML = rawpriceundercontent;
	

	
	taxprice = $('reservationtax');
	tax = (price * 16)/100;
	taxcontent = "<p class='genericcontent'>"+tax+" EUR</p>";
	taxprice.innerHTML = taxcontent;
	
	
	othertaxprice = $('reservationothertax');
	totalprice = $('reservationtotalprice');
	var total = tax + price + 17;
	totalprice.innerHTML=  "<p class='genericcontent'>"+total+" EUR</p>";
	hiddentotalprice = $('mailer_content[total_amount]');
	hiddentotalprice.value= total;
}	

function ishotel(){
auxiliar = document.location.href;
number = auxiliar.split("/");
x= number.indexOf('hotel');
	if(x != "-1"){return true;}
	else {return false;}
}	

function file_show_therapy(id){
	therapies = $$("table.accordion_toggle");
	auxstr = therapies.length+" therapy id:"+id;	
/*	alert(auxstr);*/
	total = therapies.length;
	cont =0;
	
	while(cont<total){
		if(therapies[cont].id == id){
		/*	alert(therapies[cont].id);*/
			/*row2 + row3*/
			row2= "row_2_"+id;
			row3= "row_3_"+id;
			activate_div(row2);
			$(row2).removeClassName("hidden_row");
			$(row3).removeClassName("hidden_row");
			activate_div(row3);
		}else{
			deactivate_div(therapies[cont].id);
		}
		cont++;
	}

}


function file_hide_therapy(id){
	therapies = $$("table.accordion_toggle");
	auxstr = therapies.length+" therapy id:"+id;	

	total = therapies.length;
	cont =0;
	
	while(cont<total){
		if(therapies[cont].id == id){
				row2= "row_2_"+id;
				row3= "row_3_"+id;
				$(row2).addClassName("hidden_row");
				$(row3).addClassName("hidden_row");
				deactivate_div(row2);
				deactivate_div(row3);
		}else{
			activate_div(therapies[cont].id);
		}
		cont++;
	}
}

function preload_important_images(){
	    if (document.images)
	    {
	      preload_image_object = new Image();
	      // set image url
	      image_url = new Array();
	      image_url[0] = "../images/system/myhi/myyhi.png";
	      image_url[1] = "../images/system/myhi/myyhi2.png";
	      image_url[2] = "../images/system/myhi/myyhi.gif";
	      image_url[3] = "../images/system/myhi/myyhi2.gif";
		  image_url[4] = "../images/system/menu/logo.png";
		  image_url[5] = "../images/system/menu/en/menu_navbox_dark.jpg";
		  image_url[6] = "../images/system/menu/en/menu_navbox_light.jpg";
		  image_url[7] = "../images/system/menu/es/menu_navbox_dark.jpg";
		  image_url[8] = "../images/system/menu/es/menu_navbox_light.jpg";
		  image_url[9] = "../images/system/menu/1_black.png";
		  image_url[10] = "../images/system/menu/2_black.png";
		  image_url[11] = "../images/system/menu/3_black.png";
		  image_url[12] = "../images/system/menu/4_black.png";
		  image_url[13] = "../images/system/menu/1_orange.png";
		  image_url[14] = "../images/system/menu/2_orange.png";
		  image_url[15] = "../images/system/menu/3_orange.png";
		  image_url[16] = "../images/system/menu/4_orange.png";
		  image_url[17] = "../images/system/menu/1_white.png";
		  image_url[18] = "../images/system/menu/2_white.png";
		  image_url[19] = "../images/system/menu/3_white.png";
		  image_url[20] = "../images/system/menu/4_white.png";
	       var i = 0;
	       for(i=0; i<21; i++) 
	         preload_image_object.src = image_url[i];
	    }
}

function preload_concept_images(i){
	url_dir = ["http://loveserv.latexlab.com:3004","http://www.yhispa.com"];
			index=1;
	    if (document.images)
	    {
	      preload_image_object = new Image();
	      // set image url
	      image_url = new Array();
	      image_url[0] =  url_dir[index]+"/images/system/myhi/concept_buttons_a_on.jpg";
	      image_url[1] =  url_dir[index]+"/images/system/myhi/concept_buttons_b_on.jpg";
	      image_url[2] =  url_dir[index]+"/images/system/myhi/concept_buttons_c_on.jpg";
	      image_url[3] =  url_dir[index]+"/images/system/myhi/concept_buttons_d_on.jpg";
		  image_url[4] =  url_dir[index]+"/images/system/myhi/concept_buttons_e_on.jpg";
			image_url[5] =  url_dir[index]+"/images/system/myhi/yhibanner_a_on.jpg";
			image_url[6] =  url_dir[index]+"/images/system/myhi/yhibanner_b_on.jpg";
			image_url[7] =  url_dir[index]+"/images/system/myhi/yhibanner_c_on.jpg";
			image_url[8] =  url_dir[index]+"/images/system/myhi/yhibanner_d_on.jpg";
			image_url[9] =  url_dir[index]+"/images/system/myhi/yhibanner_e_on.jpg";
		   for(i=0; i<10; i++) 
	         preload_image_object.src = image_url[i];
	    }
}
function preload_file_images(i){
		url_dir = ["http://loveserv.latexlab.com:3004","http://www.yhispa.com"];
		index=1;
	    if (document.images)
	    {
	      preload_image_object = new Image();
	      // set image url
	      image_url = new Array();
		  image_url[0] =  url_dir[index]+"/images/system/buttons/nav/nav_icons_zoom.png";
		  image_url[1] =  url_dir[index]+"/images/system/buttons/nav/nav_icons_zoom_over.png";
	   	  image_url[2] =  url_dir[index]+"/images/system/file/en/reserve_spa_off.jpg";
	   	  image_url[3] =  url_dir[index]+"/images/system/file/en/reserve_hotel_off.jpg";
	   	  image_url[4] =  url_dir[index]+"/images/system/file/en/reserve_spa_on.jpg";
	   	  image_url[5] =  url_dir[index]+"/images/system/file/en/reserve_hotel_on.jpg";

		   for(i=0; i<6; i++) 
	         preload_image_object.src = image_url[i];
	    }
}
function concept_show_div(letter){
	child = "yhispa_"+letter+"_img";
	auxs = "yhiconcept_"+letter;	
	vc_s = "vc_"+letter;
	vc_img = $(vc_s);
	src = "../images/system/myhi/concept_buttons_"+letter+"_on.jpg";
	vc_img.addClassName("active_concept");
	vc_img.src =src;
	content = $(auxs);
	content.style.display="block";
	$("conceptboxcontainer").style.display="none";
	$("spa_r").style.display="block";
}	

function concept_show_vertical(letter){

}	
function next_table_extras(){
/*$('downloads_block_0').style.display='none';$('downloads_block_1').style.display='block';this.style.display='none';*/
deactivate_div('downloads_block_0');deactivate_div('dnext');
activate_div('dprev');
activate_div('downloads_block_1');
}
	
function prev_table_extras(){
/*$('downloads_block_1').style.display='none';$('downloads_block_0').style.display='block';this.style.display='none';activate_div('dnext');*/
deactivate_div('downloads_block_1');
deactivate_div('dprev');
activate_div('dnext');
activate_div('downloads_block_0');
}
function function_rollover(index,style){
alert(index + "_" + style);
}
function function_rollout(index,style){

}