function checkBlankField(txt)
{
			var mint_txt = txt.length;
			var mstr_txt = txt;
			var mint_count = 0;
		    for (var iloop = 0; iloop<mint_txt; iloop++)
		    {
				        if (mstr_txt.charAt(iloop) == " ")
				        {
				           mint_count = mint_count+1;
				        }
			}    
// if nothing entered in the field
   	 				if (txt == "")
   	 				{
					return false;
				    }
				    	 else if (mint_count == mint_txt)
				    	{
						return false;
						}
				return true;
}
				
function valid_email(eml)
{
	//declare the required variables
	var mint_len;
	var mstr_eml=eml;
	var mint_at=0;
	var mint_atnum=0;
	var mint_dot=0;
	var mint_dotnum=0;

	mint_len = eml.length; //takes the length of the email address entered
	//checking for the symbol single quote. If found replace it with its html code
	if (mstr_eml.indexOf("'")!=-1)
	{	
		mstr_eml=mstr_eml.replace("'","'");
	}
	//checking for the (@) & (.) symbol
	for(var iloop=0;iloop<mint_len;iloop++)
	{
		if(mstr_eml.charAt(iloop)=="@")
		{
			mint_at=iloop+1;
			mint_atnum=mint_atnum+1;
		}
		if(mstr_eml.charAt(iloop)==".")
		{
			mint_dot=iloop+1;
			mint_dotnum=mint_dotnum+1;
		}
	}
	//if nothing entered in the field
	if (mstr_eml=="")
	{
		return true;
	}
	//if @ entered more than once & dot (.) entered more than 4 times
	else if((mint_atnum!=1)||(mint_dotnum>4)||((mint_dot-mint_at)<2)||((mint_len-mint_dot)<2)||(mint_at<3))
	{
		return true;
	}
	//if any blank space is entered in the email address
	else if (mstr_eml.indexOf(" ")!=-1)
	{
		return true;
	}
	return false;
}
function valid_email(eml)
{
	//declare the required variables
	var mint_len;
	var mstr_eml=eml;
	var mint_at=0;
	var mint_atnum=0;
	var mint_dot=0;
	var mint_dotnum=0;
	mint_len = eml.length; //takes the length of the email address entered
	//checking for the symbol single quote. If found replace it with its html code
	if (mstr_eml.indexOf("'")!=-1)
	{	
		mstr_eml=mstr_eml.replace("'","'");
	}
	//checking for the (@) & (.) symbol
	for(var iloop=0;iloop<mint_len;iloop++)
	{
		if(mstr_eml.charAt(iloop)=="@")
		{
			mint_at=iloop+1;
			mint_atnum=mint_atnum+1;
		}
		if(mstr_eml.charAt(iloop)==".")
		{
			mint_dot=iloop+1;
			mint_dotnum=mint_dotnum+1;
		}
	}
	//if nothing entered in the field
	if (mstr_eml=="")
	{
		return true;
	}
	//if @ entered more than once & dot (.) entered more than 4 times
	else if((mint_atnum!=1)||(mint_dotnum>4)||((mint_dot-mint_at)<2)||((mint_len-mint_dot)<2)||(mint_at<3))
	{
		return true;
	}
	//if any blank space is entered in the email address
	else if (mstr_eml.indexOf(" ")!=-1)
	{
		return true;

	}
	return false;
}


function refresh_img()
{
document.images.rand_img.src = "randomImage.php";
}
function IsNumeric(strString)
{
	var strValidChars = "0123456789.";
	var strChar;
	var blnResult = true;
	if (strString.length == 0) return false;
		for (i = 0; i < strString.length && blnResult == true; i++)
		{
			strChar = strString.charAt(i);
			if (strValidChars.indexOf(strChar) == -1)
			{
			blnResult = false;
			}
		}
   		return blnResult;
 }





//#### FOR LEFT SEARCH ROOM OPTIONS START #####//

// For creating adults & children options as per number of rooms selected
function createRooms_hp(select_val)
{
	for (var i=1; i<=5; i++)
	{
		if (i <= select_val) {
			document.getElementById("row_" + i).style.display = "block";
		} else {
			document.getElementById("row_" + i).style.display = "none";
		}
	}
}

// For creating child options as per adults selected
function createGuests_hp(adult_val, counter)
{
	var str = '';
	str += '<select name="children_' + counter + '" class="childSelect"><option selected="selected" value="0">0</option>';
	for (var i=1; i<=(6-adult_val); i++) {
		str += '<option value="' + i + '">' + i + '</option>';
	}
	str += '</select>';
	
	document.getElementById("child_" + counter).innerHTML = str;
}

// For clearing hidden drop down values
function updateGuestList()
{
	var num_rooms = parseInt(document.SearchForm.numberOfRooms.value);
	var str = '';
	for (var i=(num_rooms+1); i<=5; i++)
	{
		//document.getElementById("adults_" + i).selectedIndex = 0;
		//document.getElementById("children_" + i).selectedIndex = 0;
		str = '<select name="adults_' + i + '" class="childSelect"><option selected="selected" value="0">0</option></select>';
		document.getElementById("adultOption_" + i).innerHTML = str;
	}
}



//#### FOR LEFT SEARCH ROOM OPTIONS END #####//
