/* create image shadow *

function imageBorder(){

	jQuery(".cbolds-imageborder").each(function(i){	
		if(jQuery(this).hasClass("cbolds-fr")){
			jQuery(this).removeClass("cbolds-fr");
			jQuery(this).wrap("<span class='cbolds-fl cbolds-imageshadow'></span>");			
		}else if(jQuery(this).hasClass("cbolds-fl")){
			jQuery(this).removeClass("cbolds-fl");
			jQuery(this).wrap("<span class='cbolds-fl cbolds-imageshadow'></span>");
		}else{	
			jQuery(this).wrap("<span class='cbolds-imageshadow'></span>");
		}	
	});
}

/* create hotel slider */
function hotelSlider(){
		
	strHTML = "<ul id='cbolds-slideshowControl'>";
	strHTML += "	<li><a class='cbolds-slideshow-next cbolds-fr' href='#'><img src='../../PAGES/V1/ALL/i/right-arrow.png' alt='Next'></a></li>";
	strHTML += "	<li><a class='cbolds-slideshow-prev cbolds-fl cbolds-hide' href='#'><img src='../../PAGES/V1/ALL/i/left-arrow.png' alt='Previous'></a></li>";
	strHTML += "</ul>";
	
	//jQuery(".cbolds-box-in-pr-specoffer-hotel, .cbolds-box-in-pr-specoffer-resto, .cbolds-box-pr-hotel-desc .cbolds-img").prepend(strHTML);
	
	jQuery(".cbolds-box-in-pr-specoffer-hotel, .cbolds-box-in-pr-specoffer-resto, .cbolds-box-pr-hotel-desc .cbolds-img").each(function(i){	
		if(jQuery("li",this).length > 1){
			jQuery(this).prepend(strHTML);
		}
	});
	jQuery(".cbolds-slideshow-middle, .cbolds-slideshow-last").hide();
	jQuery(".cbolds-slideshow-prev, .cbolds-slideshow-next").click(function () {
		if(jQuery(this).hasClass("cbolds-slideshow-next")){
			jQuery(this).parents("li").next().find("a").removeClass("cbolds-hide");
			activeElement = jQuery(this).parents("ul:first").next().find(".cbolds-slideshow-active");
			jQuery(activeElement).removeClass("cbolds-slideshow-active");
			jQuery(activeElement).next().addClass("cbolds-slideshow-active");
			jQuery(".cbolds-slideshow-first,.cbolds-slideshow-middle, .cbolds-slideshow-last").hide();
			jQuery(".cbolds-slideshow-active").show();
			if(jQuery(activeElement).next().hasClass("cbolds-slideshow-last")){
				jQuery(this).addClass("cbolds-hide");
			}
			
		}else{
			jQuery(this).parents("li").prev().find("a").removeClass("cbolds-hide");
			activeElement = jQuery(this).parents("ul:first").next().find(".cbolds-slideshow-active");
			jQuery(activeElement).removeClass("cbolds-slideshow-active");
			jQuery(activeElement).prev().addClass("cbolds-slideshow-active");
			jQuery(".cbolds-slideshow-first,.cbolds-slideshow-middle, .cbolds-slideshow-last").hide();
			jQuery(".cbolds-slideshow-active").show();
			if(jQuery(activeElement).prev().hasClass("cbolds-slideshow-first")){
				jQuery(this).addClass("cbolds-hide");
			}	
		}
		return false;
	
	});
	
}
/* expand extras details */
function moreExtrasDetails(){


		jQuery("table tr.cbolds-moreDetails>td>div").hide();
	
		jQuery("table.cbolds-restaurants td.cbolds-bl strong").append(" - <a class='cbolds-details' href='#'>show details</a>");
		
		jQuery("table.cbolds-restaurants td.cbolds-bl .cbolds-details").click(function () {
			if(jQuery(this).parents("tr:first").next().find("td>div").hasClass("cbolds-toggled")){
				jQuery(this).parents("tr:first").next().find("td>div").removeClass("cbolds-toggled")
				jQuery(this).text("show details")
			}else{
				jQuery(this).parents("tr:first").next().find("td>div").addClass("cbolds-toggled")
				jQuery(this).text("hide details")
			}	
			jQuery(this).parents("tr:first").next().find("td>div").slideToggle("normal", function () {});

			return false;
		});
	
		jQuery("table.cbolds-other-extras td.cbolds-br>label").text("More information");
		
		jQuery("table.cbolds-other-extras .cbolds-br label").click(function () {
			
			if(jQuery(this).parents("tr:first").next().find("td>div").hasClass("cbolds-toggled")){
				jQuery(this).parents("tr:first").next().find("td>div").removeClass("cbolds-toggled")
				jQuery(this, "a").text("More information")
			}else{
				jQuery(this).parents("tr:first").next().find("td>div").addClass("cbolds-toggled")
				jQuery(this, "a").text("Less information")
			}	
			jQuery(this).parents("tr:first").next().find("td>div").slideToggle("normal", function () {});
			
			return false;
		});
		
		
		jQuery(".cbolds-box-add-attr .cbolds-submitBtn").click(function () {
			 jQuery(this).oneTime(2000, "hide", function() {
				jQuery(this).parents("tr:first").find("td>div").fadeOut(1000, function () {	
				});
				jQuery(this).parents("tr:first").prev().find(".cbolds-br label").text("More information");
			 });	
		});
		
}
/* expand upgrade details */
function moreUpgrades(){
	jQuery(".cbolds-upgrade a span").text(", show options");
	jQuery(".cbolds-upgrade ul").addClass("cbolds-hide");
	
	jQuery(".cbolds-upgrade a").click(function () {
	
		if(jQuery(this).parents(".cbolds-upgrade").find("ul").hasClass("cbolds-hide")){
			jQuery("span",this).text(", hide options");
		}else{
			jQuery("span",this).text(", show options");
		}
	
		jQuery(this).parents(".cbolds-upgrade").find("ul").toggleClass("cbolds-hide");
		return false;
	});
	
	
	
}

jQuery.noConflict();

jQuery(document).ready(function(){
	if (jQuery.browser.msie){
		if(parseInt(jQuery.browser.version) < 6){
		}
		else{
			loadFunctions()
		}
		
	}else{
		loadFunctions()
	}
});


function loadFunctions(){
	moreUpgrades();
	moreExtrasDetails();
	//imageBorder();
	hotelSlider();
	if(jQuery(".cbolds-box-caroussel").length > 0){
		jQuery("#cbolds-slidecontent").easySlider();
	}
}


function bookNow(){
	jQuery(".cbolds-rhc-book").wrapInner("<div class='cbolds-box-t'><div class='cbolds-box-r'><div class='cbolds-box-b'><div class='cbolds-box-l'><div class='cbolds-box-tl'><div class='cbolds-box-tr'><div class='cbolds-box-bl'><div class='cbolds-box-br'><div class='cbolts-100-protected'></div></div></div></div></div></div></div></div></div>")
	jQuery(".cbolds-rhc-book h2").wrapInner("<span><span><span><span><span><span><span><span></span></span></span></span></span></span></span></span>");
}

	
function popMap(id){
	url="/map.php?supplier=" + id;
	status='scrollbars=yes,menubar=no,toolbar=no,location=no,directories=no,status=no,';
	status=status+'resizable,dependent,width=680,height=580,left=10,top=10';
	popupWin = window.open(url, 'cboldsmap',  status);
	return false;
}
function popInfo(id){
	url="/info.php?type=H&supplier=" + id;
	status='scrollbars=yes,menubar=no,toolbar=no,location=no,directories=no,status=no,';
	status=status+'resizable,dependent,width=680,height=580,left=10,top=10';
	popupWin = window.open(url, 'cboldsinfo',  status);
	return false;
}
function popRest(id){
	url="/info.php?type=R&supplier=" + id;
	status='scrollbars=yes,menubar=no,toolbar=no,location=no,directories=no,status=no,';
	status=status+'resizable,dependent,width=680,height=580,left=10,top=10';
	popupWin = window.open(url, 'cboldsinfo',  status);
	return false;
}
function popConfirmation(id){
	url="/booking.php?bookingid=" + id;
	status='scrollbars=yes,menubar=no,toolbar=no,location=no,directories=no,status=no,';
	status=status+'resizable,dependent,width=680,height=580,left=10,top=10';
	popupWin = window.open(url, 'cboldsconfirmation',  status);
	return false;
}
function popHTML(url){
	status='scrollbars=yes,menubar=no,toolbar=no,location=no,directories=no,status=no,';
	status=status+'resizable,dependent,width=680,height=580,left=10,top=10';
	popupWin = window.open(url, 'cboldsinfo',  status);
	return false;
}
function popRAIL(url){
	url="/PAGES/V1/ALL/terms_and_conditions.html#Rail";
	status='scrollbars=yes,menubar=no,toolbar=no,location=no,directories=no,status=no,';
	status=status+'resizable,dependent,width=300,height=580,left=10,top=10';
	popupWin = window.open(url, 'cboldsinfo',  status);
	return false;
}
function cbolds_checkout(f){
	f.cbsub.disabled=true;
	if(f.card_endm.selectedIndex==0 || f.card_endy.selectedIndex==0){
		alert("Please set the card expiry date");
		f.cbsub.disabled=false;
		document.coform.cbsub.disabled=false;
		return false;
	}else{
		if(checkform(f, '#ffcccc', '#ffffff', true, false, '')){
			addOverlay('Payment','Please be patient while we check payment ...');
			return true;
		}else{
			f.cbsub.disabled=false;
			document.coform.cbsub.disabled=false;
			return false;
		}
	}
}
