function ShowSingleCheckout() {

	document.getElementById("SingleCheckout").style.display = "block";

	}

function showWarningHDB()
{
	return confirm('You can just book this room if you have the required residence permit as highlighted in the red box! If you do not have it but still make a booking, your downpayment will not be refunded!\n\n If you have the required residence permit, click on OK. Otherwise click on Cancel.');	
}

function checkOwner()
{
	document.getElementById("apartment_details").style.display = "block";
	document.getElementById("hostel_details").style.display = "none";
	document.getElementById("apartment_details_2").style.display = "block";
	document.getElementById("hostel_details_2").style.display = "none";
	
}

function checkHostel()
{
	document.getElementById("apartment_details").style.display = "none";
	document.getElementById("hostel_details").style.display = "block";
	document.getElementById("apartment_details_2").style.display = "none";
	document.getElementById("hostel_details_2").style.display = "block";
}

function betaNotification()
{
	alert("Sorry, the roomsDB.net Short Term section is at this time just in its sign up phase!\nVery soon, you will be able to make confirmed bookings here, so please stay tuned!");
	return false;
}

function phoneAlert(){
	alert("Make sure your handphone number is correct! An activation sms will be sent to this number within this registration process! \n\nDo not add the +65 in front of your number, just put your plain phone number.");
}

function fillCustomMobile(theForm){

	var custom = theForm.custom.value;
	var temp = new Array();
	temp = custom.split(',');
	
	custom = temp[0] + ',' + temp[1] + ',' + theForm.os0.value;
	theForm.custom.value = custom;
	

}

function fillCustomArrival(theForm){

	var custom = theForm.custom.value;
	var temp = new Array();
	temp = custom.split(',');
	
	custom = temp[0] + ',' + theForm.os1.value + ',' + temp[2];
	theForm.custom.value = custom;
	

}

function checkTenant(theForm){
	
	if(document.tenant_check.tenant.checked == true)
	{
		var custom = theForm.custom.value;	
		custom = custom + ',1';
		theForm.custom.value = custom;
		
	}
}

function long_short_choice() {
	
	
	if((document.form_place_offer.rentaltype.options[document.form_place_offer.rentaltype.selectedIndex].value == "t") || (document.form_place_offer.rentaltype.options[document.form_place_offer.rentaltype.selectedIndex].value == "e_t"))
	{
		document.getElementById("available_until").style.display = "block";
		
	}	
	else
	{
		document.getElementById("available_until").style.display = "none";
	}
	
}

function showRefundNotice() {
	
	if(document.tenant_check.tenant.checked == true)
	{
		document.getElementById("refund_notice").style.display = "block";
		
	}	
	else
	{
		document.getElementById("refund_notice").style.display = "none";
	}
	
}

function activate_choice_one() {

	document.getElementById("item1").setAttribute("class", "item1 item_select");
	document.getElementById("item2").setAttribute("class", "item2 item_deselect");
	document.getElementById("item3").setAttribute("class", "item3 item_deselect");
	
	document.getElementById("choice_one").style.display = "block";
	document.getElementById("choice_two").style.display = "none";
	document.getElementById("choice_three").style.display = "none";
	
}

function activate_choice_two() {

	document.getElementById("item1").setAttribute("class", "item1 item_deselect");
	document.getElementById("item2").setAttribute("class", "item2 item_select");
	document.getElementById("item3").setAttribute("class", "item3 item_deselect");
	
	document.getElementById("choice_one").style.display = "none";
	document.getElementById("choice_two").style.display = "block";
	document.getElementById("choice_three").style.display = "none";
	
}

function activate_choice_three() {

	document.getElementById("item1").setAttribute("class", "item1 item_deselect");
	document.getElementById("item2").setAttribute("class", "item2 item_deselect");
	document.getElementById("item3").setAttribute("class", "item3 item_select");
	
	document.getElementById("choice_one").style.display = "none";
	document.getElementById("choice_two").style.display = "none";
	document.getElementById("choice_three").style.display = "block";	
	
}

function activateFree_checkout() {


	
document.getElementById("gallery_preview").style.display = "none";
document.getElementById("standard_preview").style.display = "none";
document.getElementById("premium_preview").style.display = "none";



document.getElementById("standard_choice").setAttribute("class", "not_selected");
document.getElementById("gallery_choice").setAttribute("class", "not_selected");
document.getElementById("premium_choice").setAttribute("class", "not_selected");
document.getElementById("free_choice").setAttribute("class", "selected");




document.getElementById("standard_choice").setAttribute("className", "not_selected");
document.getElementById("gallery_choice").setAttribute("className", "not_selected");
document.getElementById("premium_choice").setAttribute("className", "not_selected");
document.getElementById("free_choice").setAttribute("className", "selected");


}

function activateStandard_checkout() {


	
document.getElementById("gallery_preview").style.display = "none";
document.getElementById("standard_preview").style.display = "block";
document.getElementById("premium_preview").style.display = "none";


document.getElementById("standard_choice").setAttribute("class", "selected");
document.getElementById("gallery_choice").setAttribute("class", "not_selected");
document.getElementById("premium_choice").setAttribute("class", "not_selected");
document.getElementById("free_choice").setAttribute("class", "not_selected");


document.getElementById("standard_choice").setAttribute("className", "selected");
document.getElementById("gallery_choice").setAttribute("className", "not_selected");
document.getElementById("premium_choice").setAttribute("className", "not_selected");
document.getElementById("free_choice").setAttribute("className", "not_selected");

}

function activatePremium_checkout() {
	
	
	
	document.getElementById("gallery_preview").style.display = "none";
	document.getElementById("standard_preview").style.display = "none";
	document.getElementById("premium_preview").style.display = "block";

	
	document.getElementById("standard_choice").setAttribute("class", "not_selected");
	document.getElementById("gallery_choice").setAttribute("class", "not_selected");
	document.getElementById("premium_choice").setAttribute("class", "selected");	
	document.getElementById("free_choice").setAttribute("class", "not_selected");

	
	document.getElementById("standard_choice").setAttribute("className", "not_selected");
	document.getElementById("gallery_choice").setAttribute("className", "not_selected");
	document.getElementById("premium_choice").setAttribute("className", "selected");
	document.getElementById("free_choice").setAttribute("className", "not_selected");		
	
	}

function activateGallery_checkout() {
	
	
	
	document.getElementById("gallery_preview").style.display = "block";
	document.getElementById("standard_preview").style.display = "none";
	document.getElementById("premium_preview").style.display = "none";
	
	
	document.getElementById("standard_choice").setAttribute("class", "not_selected");
	document.getElementById("gallery_choice").setAttribute("class", "selected");
	document.getElementById("premium_choice").setAttribute("class", "not_selected");	
	document.getElementById("free_choice").setAttribute("class", "not_selected");

	
	document.getElementById("standard_choice").setAttribute("className", "not_selected");
	document.getElementById("gallery_choice").setAttribute("className", "selected");
	document.getElementById("premium_choice").setAttribute("className", "not_selected");
	document.getElementById("free_choice").setAttribute("className", "selected");	
	
	}

function activateStandard() {


	
document.getElementById("gallery_preview").style.display = "none";
document.getElementById("standard_preview").style.display = "block";
document.getElementById("premium_preview").style.display = "none";



document.getElementById("standard_choice").setAttribute("class", "selected");
document.getElementById("gallery_choice").setAttribute("class", "not_selected");
document.getElementById("premium_choice").setAttribute("class", "not_selected");



document.getElementById("standard_choice").setAttribute("className", "selected");
document.getElementById("gallery_choice").setAttribute("className", "not_selected");
document.getElementById("premium_choice").setAttribute("className", "not_selected");


}

function activatePremium() {
	
	
	
	document.getElementById("gallery_preview").style.display = "none";
	document.getElementById("standard_preview").style.display = "none";
	document.getElementById("premium_preview").style.display = "block";

	
	document.getElementById("standard_choice").setAttribute("class", "not_selected");
	document.getElementById("gallery_choice").setAttribute("class", "not_selected");
	document.getElementById("premium_choice").setAttribute("class", "selected");	
	

	
	document.getElementById("standard_choice").setAttribute("className", "not_selected");
	document.getElementById("gallery_choice").setAttribute("className", "not_selected");
	document.getElementById("premium_choice").setAttribute("className", "selected");
		
	
	}

function activateGallery() {
	
	
	
	document.getElementById("gallery_preview").style.display = "block";
	document.getElementById("standard_preview").style.display = "none";
	document.getElementById("premium_preview").style.display = "none";
	
	
	
	document.getElementById("standard_choice").setAttribute("class", "not_selected");
	document.getElementById("gallery_choice").setAttribute("class", "selected");
	document.getElementById("premium_choice").setAttribute("class", "not_selected");	
	

	
	document.getElementById("standard_choice").setAttribute("className", "not_selected");
	document.getElementById("gallery_choice").setAttribute("className", "selected");
	document.getElementById("premium_choice").setAttribute("className", "not_selected");
	
	
	}

function HideAlternate() {

document.getElementById("term_desc_alternate").style.display = "none";
document.getElementById("term_desc_text").style.display = "block";
}
function ShowAlternate() {

document.getElementById("term_desc_alternate").style.display = "block";
document.getElementById("term_desc_text").style.display = "none";
}

function CloseSupport() {

	document.getElementById("support").style.display = "none";

	}

function CloseChoice() {

	document.getElementById("blockUI").style.display = "none";
	document.getElementById("dialog").style.display = "none";

	}

function checkShortTerm(theForm) {
    var why = "";

    why += checkFirstName(theForm.first_name.value);
    why += checkLastName(theForm.last_name.value);
    why += checkPhone(theForm.os0.value);
    why += checkEmail(theForm.email.value);
    why += checkReEnter(theForm);
    why += checkAccept(theForm);

    
   
    if (why != "") {
       alert(why);
       return false;
    }

return true;
}

function checkWholeFormMRT(theForm) {
    var why = "";
    why += checkType(theForm.rentaltype.selectedIndex);
    why += checkRoomtype(theForm.cat.selectedIndex);
    why += checkDistrict(theForm.dist.selectedIndex);
    why += checkPostalcode(theForm.postalcode.value);
    why += checkAddress(theForm.address.value);
    why += checkMRT(theForm.mrt.selectedIndex);
    why += checkPrice(theForm.rent.value);
    why += checkUtilities(theForm.utilities.value);
    why += checkDeposit(theForm.deposit.value);
    why += checkAgentfee(theForm.agent_fee.value);
    why += checkTitle(theForm.title.value);
    why += checkText(theForm.text.value);
    why += checkName(theForm.name.value);
    why += checkEmail(theForm.email.value);
    why += checkReEnter(theForm);
    why += checkAccept(theForm);

    
   
    if (why != "") {
       alert(why);
       return false;
    }

return true;
}

function checkWholeFormSeminar(theForm) {
    var why = "";

    why += checkName(theForm.name.value);
    why += checkHandphone(theForm.handphone.value);
    why += checkEmail(theForm.email.value);
    why += checkReEnter(theForm);
    
    if (why != "") {
       alert(why);
       return false;
    }

return true;
}

function checkWholeFormEnq(theForm) {
    var why = "";
    why += checkType(theForm.rentaltype.selectedIndex);
    why += checkRoomtype(theForm.cat.selectedIndex);
    why += checkPrice(theForm.rent.value);
    why += checkTitle(theForm.title.value);
    why += checkText(theForm.text.value);
    why += checkName(theForm.name.value);
    why += checkEmail(theForm.email.value);
    why += checkReEnter(theForm);
    why += checkAccept(theForm);

    
   
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkWholeFormEnqEdit(theForm) {
    var why = "";
    why += checkType(theForm.rentaltype.selectedIndex);
    why += checkRoomtype(theForm.cat.selectedIndex);
    why += checkPrice(theForm.rent.value);
    why += checkTitle(theForm.title.value);
    why += checkText(theForm.text.value);
    why += checkName(theForm.name.value);
    why += checkAccept(theForm);

    
   
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkWholeFormEmail(theForm) {
    
    var why = "";
    why += checkName(theForm.sender.value);
   	why += checkText(theForm.text.value);
    why += checkEmail(theForm.sender_email.value);
    why += checkReEnterContact(theForm);
    why += checkAccept(theForm);

       if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkPw(theForm) {
    var why = "";
    why += checkReEnterPw(theForm);
    why += checkPwEmpty(theForm.new_pw.value);

    
   
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkEdit(theForm) {
    var why = "";
    why += checkType(theForm.rentaltype.selectedIndex);
    why += checkRoomtype(theForm.cat.selectedIndex);
    why += checkDistrict(theForm.dist.selectedIndex);
    why += checkPostalcode(theForm.postalcode.value);
    why += checkAddress(theForm.address.value);
    why += checkPrice(theForm.rent.value);
    why += checkUtilities(theForm.utilities.value);
    why += checkDeposit(theForm.deposit.value);
    why += checkAgentfee(theForm.agent_fee.value);
    why += checkTitle(theForm.title.value);
    why += checkText(theForm.text.value);
    why += checkName(theForm.name.value);
    why += checkAccept(theForm);

    
   
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkRetrieve(theForm) {
    var why = "";
    why += checkReEnterRetrieveEmail(theForm);
    why += checkRetrieveEmpty(theForm.email.value);
    why += checkEmailReco(theForm.email.value);
    
   
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function DoNav(theUrl)
{
document.location.href = theUrl;
return false;
}

function checkProfile(theForm) {
    var why = "";
    
    why += checkName(theForm.name.value);
    why += checkText(theForm.text.value);

   
    if (why != "") {
       alert(why);
       return false;
    }

return true;
}



function askAgain()
{
	return confirm('Your offer will NOT be shown on top! You will rent out later and lose money!\n\n Do you really want to proceed without featuring your offer?');
}

function submit_no_feature()
{
	if (confirm('Your offer will just be online for three days after a delay of 24 to 36 hours!\n\n Do you really want to proceed with just the trial offer?'))
	{
		document.nofeature.submit();
	}
	else
	{
		return;
	}
}

function expandCollapse() {
	for (var i=0; i<expandCollapse.arguments.length; i++) {
		var element = document.getElementById(expandCollapse.arguments[i]);
		element.style.display = (element.style.display == "none") ? "block" : "none";
	}
}

function signupAlert() {
	
	alert("You do not need to sign up on roomsDB.net!\n\n Just go ahead an post your offer or enquiry, a password to log into your control center will be sent to your email address!\n\n Thanks for using roomsDB.net!");
	return false;
}

function duplicateAddress(thisForm)
{

if(thisForm.same.checked)
   {
   thisForm.rm_street.value = thisForm.street.value;
   thisForm.rm_street.readOnly = true;
   thisForm.rm_block.value = thisForm.block.value;
   thisForm.rm_block.readOnly = true;
   thisForm.rm_floor.value = thisForm.floor.value;
   thisForm.rm_floor.readOnly = true;
   thisForm.rm_unit.value = thisForm.unit.value;
   thisForm.rm_unit.readOnly = true;
   thisForm.rm_postalcode.value = thisForm.postalcode.value;
   thisForm.rm_postalcode.readOnly = true;   
  
   showAddress(thisForm.block.value + ' ' + thisForm.street.value + ',Singapore');
   
   }
   else
   {
   thisForm.rm_street.value = "";
   thisForm.rm_street.readOnly = false;
   thisForm.rm_block.value = "";
   thisForm.rm_block.readOnly = false;
   thisForm.rm_floor.value = "";
   thisForm.rm_floor.readOnly = false;
   thisForm.rm_unit.value = "";
   thisForm.rm_unit.readOnly = false;
   thisForm.rm_postalcode.value = "";
   thisForm.rm_postalcode.readOnly = false; 
   }
}
