
function fbOpenWindow(cname, waction, title, width, height) {
	var w = 800, h = 600; 

	if (document.all || document.layers) { 
		w = screen.availWidth; 
		h = screen.availHeight; 
	} 

	var leftPos = (w-width)/2;
	var topPos = (h-height)/2; 

	window.open(waction, title, "toolbar=no,width=" + width + ",height=" + height +",menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes,top=" + topPos + "left=" + leftPos);
}

function hhotelResaDirect(url, cname, lg, codeprice, firstroom, codetrack, firstdate , currency) {
	hhotelResa(url, cname, lg, codeprice, firstroom, firstdate, codetrack, "", "", "style=DIRECT" + "&CurrencyLabel="+ currency );
}

// Main standard reservation function
function hhotelResa(url , cname, lg, codeprice, firstroom, firstdate, codetrack, cluster, theme, args) {
	var waction = url + "?Hotelnames=" +cname;
	if (lg != "") waction += "&langue="+lg;
	if (firstroom != "") {
		waction += "&FirstRoomName="+firstroom;
		if (codeprice == "")
			codeprice = "DIRECT";
		}
	if (firstdate != "") {
		waction += "&FirstDate="+firstdate;
		if (codeprice == "")
			codeprice = "DIRECT";
		}
		
	cluster = "NO";
	
	if (codeprice != "") waction += "&FSTBKNGCode="+codeprice;
	if (codetrack != "") waction += "&FSTBKNGTrackLink="+codetrack;
	if (cluster != "") waction += "&clustername="+cluster;
	if (theme != "") waction += "&theme="+theme;
	if (args != "" && (args.indexOf("=")!= -1) ) waction += "&"+args;
	waction += "&HTTP_REFERER="+escape(document.location.href);
	fbOpenWindow(cname, waction, "reservation", 800, 600);
}
