function underConstruction(){
   alert("Under Construction. Please come back later.");
}

function gotoURL(url){
   document.location=url;
}

function selectHotel(hotelId){
	document.getElementById("selectedHotelId").value=hotelId;
	var roomSelectedCount = 0;
	var selectedRooms="";
	var selectElements=document.getElementsByTagName("select");
	for(i=0;i<selectElements.length;i++){
		var selectElement = selectElements[i];
		if ((selectElement.name.indexOf("roomCount|"+hotelId) != -1))
		{
			var sValue = selectElement.options[selectElement.selectedIndex].text;
			roomSelectedCount+=eval(sValue);
			if (sValue != 0)
			{
				selectedRooms+=selectElement.name;
				selectedRooms+="|"+sValue;
				selectedRooms+=",";
			}
		}
	}
	if (document.getElementById("searchCriterion_numberOfRooms").value != roomSelectedCount)
	{
		if (document.getElementById("searchCriterion_numberOfRooms").value == '1')
		{
			alert("Please select at least 1 room");
		}
		else{
			alert("Please select "+document.getElementById("searchCriterion_numberOfRooms").value+" rooms");
		}
	}
	else{
		document.getElementById("id_selectedRooms").value=selectedRooms;
	    document.getElementById("id_selectHotel_"+hotelId).disabled=true;
		document.getElementById("id-selecthotel").submit();
		return false;
	}
}


function validateCustomer(){
	var submit = true;

	//Check booking party lead  name
	if (document.getElementById("id-bookingPartyLeadName").value == ""){
		alert("Please specify booking party lead name");
		document.getElementById("id-bookingPartyLeadName").focus();
		submit = false;
		return;
	}

	if (document.getElementById("id-customerEmail").value == ""){
		alert("Please specify an email address");
		document.getElementById("id-customerEmail").focus();
		submit = false;
		return;
	}
	//Now check for invalid email address
	if (!checkEmail(document.getElementById("id-customerEmail").value)){
		alert("Invalid email address");
		document.getElementById("id-customerEmail").focus();
		submit = false;
		return;
	}
			
	if (document.getElementById("id-customerPassword").value == ""){
		alert("Please specify the password.");
		document.getElementById("id-customerPassword").focus();
		submit = false;
		return;
	}

	if (document.getElementById("id-customerPhone").value == ""){
		alert("Please specify the phone number");
		document.getElementById("id-customerPhone").focus();
		submit = false;
		return;
	}

	var objects = document.getElementsByName('customerType');
	for (i=0;i<objects.length;i++)
	{
		if (objects[i].value == "new" && objects[i].checked) {
			if (document.getElementById("id-customerConfirmPassword").value == ""){
			alert("Please specify a value for confirm password.");
			document.getElementById("id-customerConfirmPassword").focus();
			submit = false;
			return;
			}
		}
	}
	
	if (document.getElementById("id_termsAgreed").checked == false){
		alert("Please select the terms and conditions check box.");
		submit = false;
		return;
	}

	if (submit) {
		document.getElementById("id-customerForm").submit();	
	}
}

function hideDiv(div_id) {
   document.getElementById(div_id).style.visibility="hidden";
   document.getElementById("id-newsletterPreference").style.visibility="hidden";
   
}
function showDiv(div_id) {
   document.getElementById(div_id).style.visibility="visible";
   document.getElementById("id-newsletterPreference").style.visibility="visible";
}

function openNewWindow(url){
		window.open(url,'mywindow','width=550,height=480')
}

function openHotelDetailsWindow(url){
		window.open(url,'hotelDetailsWindow','width=800,height=600,scrollbars=yes')
}

function openPopupWindow(url,window_width, window_height){
		window.open(url,'hotelDetailsWindow','width='+window_width+',height=600,scrollbars=yes');
}

function link_post(target)	{
var url = encodeURIComponent(location.href);
var title = encodeURIComponent(document.title);
var posturl = '';
if(target == 'delicious') {
    posturl = 'http://del.icio.us/post?url='+url+'&title='+title;
} else if (target == 'digg') {
    posturl = 'http://digg.com/submit?phase=2&url='+url;
} else if (target == 'technorati') {
    posturl = 'http://technorati.com/cosmos/search.html?url='+url;
} else if (target == 'blink') {
    posturl = 'http://blinklist.com/index.php?Action=Blink/addblink.php&Description='+title+'&URL='+url;
} else if (target == 'furl') {
    posturl = 'http://furl.net/storeIt.jsp?u='+url+'&t='+title;
} else if (target == 'reddit') {
    posturl = 'http://reddit.com/submit?url='+url+'&title='+title;
} else if (target == 'newsvine') {
    posturl = 'http://www.newsvine.com/_wine/save?u='+url+'&h='+title;
} else if (target == 'stumbleupon') {
    posturl = 'http://www.stumbleupon.com/refer.php?url='+url+'&title='+title;
}

window.open(posturl,'PostPage','width=800,height=600,scrollbars=yes')

}

