function showHideNavPop(elemID, showHide) {
		if(document.getElementById(elemID)) {
			document.getElementById(elemID).style.display = (showHide == 'show' ? 'block' : 'none');
		}
	}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;

  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
  	if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
	obj.display=v; }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

var d = document;
function showpic(pic) {
	if (d.images) {
		d.images['bigpic'].src = "themes/cit/images/hotels/"+pic;
		}
}

function OpenWin(u,n,w,h,s)
{
	var l = (screen.width)  ? (screen.width  - w)/2 : 0;
	var t = (screen.height) ? (screen.height - h)/2 : 0;
	var p = window.open(u,n,'width='+w+',height='+h+',scrollbars='+s+',left='+l+',top='+t+',resizable');
	p.focus();
}

function showWaiting() {
  MM_showHideLayers('container-content','','hide');
  MM_showHideLayers('menu_main_long','','show');
  MM_showHideLayers('waiting','','show');
}

function checkCheckBox(f){
if (f.acceptErrata.checked == false )
{
alert('Please confirm that you have read and agree\n to the information shown.');
return false;
}else
return true;
}

function doSubmit(formName,nextPage) {

	var formObject = MM_findObj(formName);

	if (formObject != null)
	{
		if (formObject.nextPage != null)
			formObject.nextPage.value = nextPage;

		formObject.submit();

		return false;
	}

	return true;
}

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_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_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];}
}
function spin(obj)
{
  var spinner = document.getElementById(obj);
  var spinner_content = document.getElementById(obj+"_body" );
  if ( spinner_content.style.visibility == 'visible' )
  {
    //spinner.innerHTML = 'open';
    spinner_content.style.visibility = 'hidden';
	spinner_content.style.display = 'none';
    spinner_content.style.height = '0px';
    spinner_content.style.margin = '0px';
  }
  else
  {
    //spinner.innerHTML = 'close';
    spinner_content.style.visibility = 'visible';
	spinner_content.style.display = 'block';
    spinner_content.style.height = 'auto';
    //spinner_content.style.margin = '5px 0px 20px 20px';
  }
}
function hoteDetails() {
	//alert ("This is hoteDetails")
	//window.location = "#top";
	window.scrollTo(0,0);
	MM_showHideLayers('container-content','','hide','popBook','','hide','booking_tabs','','hide','booking_details_div','','hide','hotel_details_div','','hide','searchresults','','hide','breadcrumbs','','hide','extra_details_div_left_col','','show');
    MM_showHideLayers('menu_main_long','','show');
	MM_showHideLayers('waiting','','show');
	MM_showHideLayers('resAccesCol','','show');
}
function qGetElementById(id)
{
	var elements = document.getElementsByName(id);

	for (var i = 0; i < elements.length; i++)
	{
		if (elements[i].name == elements[i].id)
		    return elements[i];
	}

	return MM_findObj(id);
}

function qDumpObject(object)
{
	var debugWindow = window.open('','debug','scrollbars,status,resizable,location,width=900,height=500');

	debugWindow.document.writeln("<html><head><title>Quatro Debug</title></head>");
	debugWindow.document.writeln("<body><pre>");

	debugWindow.document.writeln(object);

	for (var property in object)
		debugWindow.document.writeln(property + " = " + object[property]);

	debugWindow.document.writeln("</pre></body></html>");
	debugWindow.document.close();
	debugWindow.focus();
}

function validateform(form){
	if(form.fnm.value == "" || form.lnm.value == "" || form.uemail.value == "" || form.confirmEmail.value == "")
	{
		alert("Please supply all required information");
		return false;
	}
	else
	{
		if(form.uemail.value == form.confirmEmail.value)
		{
			var newwindow;
			newwindow = window.open('','NewsletterPopUp','width=400,height=150');
			form.submit()
			document.location.href = "viewPage.vm?viewName=generalConfirmation";
			return true;
		}
		else
		{
		alert("Email Address and Confirmation Email Address are not the same");
		return false;
		}
	}
}

var selected = false;
function changeSelect(select){
	if (!selected){
		var changeSelect = document.getElementById('lowCost');
		changeSelect.style.color = "#B53A59";

		selected = true;
	}else{
		var changeSelect = document.getElementById('lowCost');
		changeSelect.style.color = "#5b5b5b";
		selected = false;
	}
}

var accomSelected = false;
function changeAccomSelect(){

	if (!accomSelected){
		var changeSelect = document.getElementById('checkBoxThisAccom');
		changeSelect.style.color = "#B53A59";
		accomSelected = true;
	}else{
		var changeSelect = document.getElementById('checkBoxThisAccom');
		changeSelect.style.color = "#5b5b5b";
		accomSelected = false;
	}
}

function checkValueBoxAccom(){

		var checkBoxAccom = document.getElementById('checkBoxThisAccomCheck')
		if (checkBoxAccom.checked == true){
			accomSelected = true;
    		var changeSelect = document.getElementById('checkBoxThisAccom');
    		changeSelect.style.color = "#B53A59";

		}
}

var firstTime = true;

function checkValueBox(){
	var checkBoxCheck = document.getElementById('lowCostCheckBox');
	if (checkBoxCheck && checkBoxCheck.checked == true){
		selected = true;
		var changeSelect = document.getElementById('lowCost');
		changeSelect.style.color = "#B53A59";
	}
}

function checkFirstTime(){
	if (firstTime){
		var checkBoxCheck = document.getElementById('lowCostCheckBox');

		if (checkBoxCheck) {
    		checkBoxCheck.checked = true;
    		selected = true;
    		var changeSelect = document.getElementById('lowCost');
    		changeSelect.style.color = "#B53A59";
		}
	}
}

function ns_onclick (a, url, name, type, winopt){
var ns_l='http://uk.sitestat.com/firstchoice/citalia/s?';
ns_l+=name;ns_l+='&ns_type='+type+'&ns_action=view';
ns_l+='&ns__t='+(new Date()).getTime();if(!url)url=a.href;
var ns_0=document.referrer;if(ns_0.lastIndexOf('/')==ns_0.length-1)ns_0=ns_0.substring(ns_0.lastIndexOf('/'),0);
if (ns_0.length>0)ns_l+='&amp;ns_referrer='+escape(ns_0);
var ns_c=!a.target?"location.href='"+url+"';":"window.open('"+url+"','"+a.target+"','"+winopt+"');";
var ns_i=new Image();ns_i.onload=new Function(ns_c);
if(a.target)ns_i.onload();else setTimeout(ns_c, 5000);
ns_i.src=ns_l;
}

//IMAGE PAGINATION
function imgPaging(n){
	var count = document.getElementById("count");
	count.innerHTML = "Picture <strong>"+n+"</strong> of <strong>"+imgs.length+"</strong>";
}

function imgNext(){

	var match;
	targ = document.getElementById("hotelImage");

	if(targ){
		s = targ.src
		for(i=0;i<imgs.length;i++){
			if(s.indexOf(imgs[i])!=-1){match=i;}
		}
		nextImg = match+1;
		next = nextImg+1;
		if(nextImg<imgs.length){
			targ.src = imgs[nextImg];imgPaging(next);}else{targ.src = imgs[0];imgPaging(1);}
	}
	return false;
}

function imgPrev(){
	var match;
	targ = document.getElementById("hotelImage");

	if(targ){
		s = targ.src
		for(i=0;i<imgs.length;i++){
			if(s.indexOf(imgs[i])!=-1){match=i;}
		}
		prevImg = match-1;
		if (prevImg < 0){
			prevImg = imgs.length-1;
}
		prev = prevImg+1;


		if(prevImg>=0){targ.src = imgs[prevImg];imgPaging(prev);}


	}
	return false;
}

function swapMap1() { document.italyMap.src="themes/cit/images/maps/adriaticRiverieraMap.jpg" }
function swapMap2() { document.italyMap.src="themes/cit/images/maps/basilicataMap.jpg" }
function swapMap3() { document.italyMap.src="themes/cit/images/maps/italianCitiesMap.jpg" }
function swapMap4() { document.italyMap.src="themes/cit/images/maps/italianLakesMap.jpg" }
function swapMap5() { document.italyMap.src="themes/cit/images/maps/lazioMap.jpg" }
function swapMap6() { document.italyMap.src="themes/cit/images/maps/liguriaMap.jpg" }
function swapMap7() { document.italyMap.src="themes/cit/images/maps/neapolitanRivieraMap.jpg" }
function swapMap8() { document.italyMap.src="themes/cit/images/maps/pugliaMap.jpg" }
function swapMap9() { document.italyMap.src="themes/cit/images/maps/sardiniaMap.jpg" }
function swapMap10() { document.italyMap.src="themes/cit/images/maps/sicilyMap.jpg" }
function swapMap11() { document.italyMap.src="themes/cit/images/maps/tuscanyMap.jpg" }
function swapMap12() { document.italyMap.src="themes/cit/images/maps/umbriaMap.jpg" }
function restoreMap() { document.italyMap.src="themes/cit/images/maps/italyMap.jpg" }
function restoreMap() { document.italyMap.src="themes/cit/images/maps/italyMap.jpg" }

function hotelToOptions(){
	window.scrollTo(0,0);
	MM_showHideLayers('waiting','','show');
	MM_showHideLayers('container-content','','hide');
}
