
function isValidEmail(sFieldValue)
{
	var REmail=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

	var str=sFieldValue;
	if(!str.match(REmail)){
		return false;
	}
	else
	{
		return true;
	}
}


function checkField(fldObj, strtext, iMess)
{
	if(iMess != 0 )
	{
		iMess = 1;
	}
	if (trim(fldObj.value) == "") 
	{
		if(iMess == 1)
		{
			fldObj.focus();
			alert (strtext);
		}
		return false;
	}
	
	return true;
}


function checkfornum(str1) 
{
	//This function checks for numeric values
	var numstr="1234567890 ,";
	var intctr,intLen;
	intLen=str1.length;
	for(intCtr=0;intCtr <= intLen && numstr.indexOf(str1.charAt(intCtr))>=0 ;intCtr++);
	if(intCtr > intLen)
	{
		return 1;
	}
	else
	{
		return 0;
	}

}



//////////////
function checkforchar(strdate)
{
	//This function checks for string values
	var validdate = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var strlength = strdate.length;
	for(var i=0; i<=strlength; i++)
	{
		var unitstr = strdate.substr(i,1);
		if (validdate.indexOf(unitstr)==-1)
		{
			return false;
		}
	}
	return true;
}




///////////////////
function trim(str1)
{
	// This function trims any given field value for blank spaces.
	var intCtr=0
	for(intCtr=0;str1.charAt(intCtr)==" ";intCtr++);
	str1=str1.substring(intCtr,str1.length);
	return str1; 
}



function refreshParent()
{
	window.opener.location.href = window.opener.location.href;
	window.opener.location.reload(true);
	if (window.opener.progressWindow)
	{
		window.opener.progressWindow.close();
	}
}


function notyping(obj)  // function to restrict typing in image browing field
{
	
	if(event.keyCode != 32)
	{
		alert("You can not write in file name directly.\n Please click on Browse");
		obj.blur();
		return false;
	}
	else
	{
		return true;
	}
}


var message="Sorry, that function is disabled.\n\nContents & Graphics Copyright ©Compare Infobase Ltd.\nOur work is not Public Domain, and should NOT be taken from this site."; // Message for the alert box

// Don't edit below!
function click(e) 
{
	if (document.all) 
	{
		if (event.button == 2) 
		{
			alert(message);
			return false;
		}
	}
	if (document.layers) 
	{
		if (e.which == 3) 
		{
			alert(message);
			return false;
		}
	}
}

if (document.layers) 
{
	document.captureEvents(Event.MOUSEDOWN);
}

//document.onmousedown=click;

//////////function for maxlength in textarea
function ismaxlength(obj)
{
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : "";

	if (obj.getAttribute && obj.value.length > mlength)
	{
		obj.value = obj.value.substring(0, (mlength-1));
		alert("The maximum character limit (3000 characters) has been crossed .");
		return false;
	}
	else
	{
		return true;
	}
}


/**************************** CHANGES DONE ON 9 OCT 2007 BY ALKA *******************/

/** This function is used in sorting the form according to a field name with particuler order 
 *	sBy is sort by, i.e. whether in ascending or descending
 *	sOrder is sort order, means on which table fields sorting is done
 */
function sort_result(frmName, sBy, sOrder)
{
	var form			= frmName;
	form.sortBy.value	= sBy;	
	form.sortOrder.value= sOrder;
	form.submit();
	return true;

}/// end of function


/** This function goPage() starts
 * It is responsible for specifying limitstart in paging of records while navigating through records 
 */

function goPage(frmName, iPage)
{
	//alert(document.forms[frmName].task_action.value);

	document.forms[frmName].limitstart.value = iPage;
	document.forms[frmName].submit();
	return true;

}//end of function goPage()
//function to trim the given string
function trimAll(str){
	var l=0;
	var r=str.length;
	while((ch=str.charAt(l++)) == ' ');
	while((ch=str.charAt(--r)) == ' ');
	return(0>r)?"":str.substring(l-1,r+1);
}

function chkTypeSearchEngine(objForm)
{
	var theMessage = "You entered incorrectly or forgot to fill in ::\n";
	var noErrors = theMessage;
	var focusval = objForm.destination_type;
	
	
	
	if(objForm.destination_type)
	{
		if(objForm.destination_type.value=='')
		{
			theMessage+= "\nPlease select destination type";
			focusval = objForm.destination_type;
		}
	
	}
		
	if(objForm.destination_drop)
	{
		if(objForm.destination_drop.value=='')
		{
			theMessage+= "\nPlease select destination";
			focusval = objForm.destination_drop;
		}
	
	}
	
	if (theMessage == noErrors)
	{
		objForm.action = objForm.destination_drop.value;
		objForm.hidd_destination_drop.value = objForm.destination_drop.value;
		//alert(objForm.hidd_destination_drop.value);
		return true;

	} 
	else
	{
		alert(theMessage);
		focusval.focus();

		return false;
	}

}




function chkStateSearchEngine(objForm)
{
	var theMessage = "You entered incorrectly or forgot to fill in ::\n";
	var noErrors = theMessage;
	var focusval = objForm.state_name;
	
	
	
	if(objForm.state_name)
	{
		if(objForm.state_name.value=='')
		{
			theMessage+= "\nPlease select state";
			focusval = objForm.state_name;
		}
	
	}
		
	if(objForm.destination_state)
	{
		if(objForm.destination_state.value=='')
		{
			theMessage+= "\nPlease select destination";
			focusval = objForm.destination_state;
		}
	
	}
	

	if (theMessage == noErrors)
	{
		objForm.action = objForm.destination_state.value;
		return true;
	} 
	else
	{
		alert(theMessage);
		focusval.focus();

		return false;
	}

}


function chkDestSearchEngine(objForm)
{
	var theMessage = "You entered incorrectly or forgot to fill in ::\n";
	var noErrors = theMessage;
	var focusval = objForm.destination_combo;
	
	
	
	if(objForm.destination_combo)
	{
		if(objForm.destination_combo.value=='')
		{
			theMessage+= "\nPlease select destination";
			focusval = objForm.destination_combo;
		}
	
	}
	
	
	if (theMessage == noErrors)
	{
		objForm.action = objForm.destination_combo.value;
		return true;
	} 
	else
	{
		alert(theMessage);
		focusval.focus();

		return false;
	}
}

function chkQueryForm(objForm)
{
	
	var theMessage	= "You entered incorrectly or forgot to fill in ::\n";
	var noErrors	= theMessage;
	var focusval	= '';
	var dt			= new Date();
	
	if(objForm.user_name)
	{
		if(trimAll(objForm.user_name.value) == '')
		{
			theMessage+= "\nPlease enter Name";
			focusval = objForm.user_name;
		}
		else
		{			
			if(!isNaN(objForm.user_name.value))
			{
				theMessage +="\n Please enter name in characters." ;
				if(focusval == '')
				{
					focusval	= objForm.user_mobile;
				}
			}
		}
	}

	if(objForm.user_email)
	{
		if (trimAll(objForm.user_email.value).length<=0) 
		{
			theMessage+="\nPlesae enter your email" ;
			if(focusval == '')
			{
				focusval = objForm.user_email;
			}
		} else if (!isValidEmail(trimAll(objForm.user_email.value)))
		{	
			theMessage+= "\nplesae enter valid email id" ;
			if(focusval == '')
			{
				focusval = objForm.user_email;
			}
		}
	}
	
	if(objForm.user_mobile)
	{
		if (trimAll(objForm.user_mobile.value) != "")
		{
			if(isNaN(objForm.user_mobile.value))
			{
				theMessage +="\n Please enter mobile number in digits." ;
				if(focusval == '')
				{
					focusval	= objForm.user_mobile;
				}
			}
		}
	}
	
	
	
	if(objForm.cidate)
	{
		var val = objForm.cidate.value;
		
		fld = val;
		fmt = 'w';
		rng	='f';
		if(!validateDate(fld,fmt,rng))
		{
			theMessage += "\nPlaese enter a valid date.";
		}
	}
	
	

	if(objForm.nights)
	{
		if(objForm.nights.value=='')
		{
			theMessage+= "\nPlease enter nights";
			if(focusval == '')
			{
				focusval = objForm.nights;
			}
		}
	
	}

	if(objForm.days)
	{
		if(objForm.days.value=='')
		{
			theMessage+= "\nPlease enter days";
			if(focusval == '')
			{
				focusval = objForm.days;
			}
		}
	
	}


	
	
	if(objForm.pacakge_id)
	{
		if(objForm.pacakge_id.value=='')
		{
			theMessage+= "\nPlease select package";
			if(focusval == '')
			{
				focusval = objForm.pacakge_id;
			}
		}
	
	}

	/*if(objForm.double_room)
	{
		if(trim(objForm.double_room.value) == '' && (objForm.single_room.value) == '')
		{
			theMessage+= "\nPlease select double rooms";
			if(focusval == '')
			{
				focusval = objForm.double_room;
			}
		}
		else
		{
			if(objForm.double_room.value=='')
			{
				theMessage+= "\nPlease select double rooms";
				if(focusval == '')
				{
					focusval = objForm.double_room;
				}
			}
			else if(objForm.single_room.value=='')
			{
				theMessage+= "\nPlease select single rooms";
				if(focusval == '')
				{
					focusval = objForm.single_room;
				}
			}
		}
	
	}*/
	
	if(objForm.double_room.value == '0' && objForm.single_room.value == '0' )
	{
		theMessage+= "\nPlease select at least one room set";
		if(focusval == '')
		{
			focusval = objForm.double_room;
		}
	}
	

	if(objForm.check_complete)
	{
		if(objForm.check_complete.checked==false)
		{
			theMessage+= "\nPlease accept the terms and condition";
			if(focusval == '')
			{
				focusval = objForm.single_room;
			}
		}
	
	}

	if(objForm.verif_box)    //check if image verification left empty
	{
		if (trim(objForm.verif_box.value).length<=0)
		{
			theMessage+="\nImage verification code is missing!";
			if(focusval == '')
			{
				focusval = objForm.verif_box;
			}
		}
		else if (isNaN(objForm.verif_box.value))
		{
			theMessage+="\nEnter a numeric value in verification box!";
			if(focusval == '')
			{
				focusval = objForm.verif_box;
			}
		}
		else if ((trim(objForm.verif_box.value).length>4 ) || (trim(objForm.verif_box.value).length<4 ))
		{
			theMessage+="\nEnter only four digits as seen in image!";
			if(focusval == '')
			{
				focusval = objForm.verif_box;
			}
		}
	}


	if (theMessage == noErrors)
	{
		return true;
	} 
	else
	{
		alert(theMessage);
		focusval.focus();

		return false;
	}


}

/*	This function to check for input type image extensions.
	If extension is  not defined type then it show the alert message.
*/
function validateFileExtensionPhoto(fld) 
{
	if(!/(\.bmp|\.gif|\.jpg|\.jpeg)$/i.test(fld.value)) // only these extension allowed
	{
		alert("Invalid image file type.");
		fld.value='';
		fld.focus();
		return false;
	}
	else
	{		
		return true;
	}

}// end of function


function selectPackage(pkg_id)
{
	var obj = document.forms["queryForm"].packge_id;
	for(var ct=0;ct<obj.length;ct++)
	{
		if(obj[ct].value == pkg_id)
		{
			obj[ct].selected = true;
			document.forms["queryForm"].user_name.focus();
			return true;
		}
	}

	return false;
}

var siteUrl='http://sitegita.com/';
function topHeader()
{
	document.write('<table width="1003" border="0" cellpadding="0" cellspacing="0" align="center" valign="top" bgcolor="#ffffff"> <tr> 	<td valign="top" height="68"><table width="100%" height="68" border="0" cellspacing="0" cellpadding="0">   <tr>    <td width="5" bgcolor="#F68220"></td>	          <td background="'+siteUrl+'images/cat-1/th-c-8.jpg" style="background-repeat:repeat-x;">            <table width="100%" border="0" cellspacing="0" cellpadding="0">              <tr>                <td width="330" height="50" align="right"><a href="'+siteUrl+'"><img src="'+siteUrl+'images/pi-logo.jpg" border="0"></a></td>                <td width="309" height="33" align="center" valign="bottom"><!--<img src="'+siteUrl+'images/cat-1/c-01.jpg">--></td>                <td width="400" valign="bottom">								<table width="100%" cellspacing="0" cellpadding="0">	<form name="searchFrm" method="post" action="'+siteUrl+'search.php" onSubmit="return checkSearchForm()">			<tr>                      <td valign="bottom" width="45" height="36"><img src="'+siteUrl+'images/cat-1/c-02.jpg"></td>                      <td class="redhead" width="40">Search</td>					  <td ><input type="text" size="20" maxlength="255" name="skeyword"></td><td>&nbsp;</td><td><select name="match">			<option value="exact">Exact Match</option>			<option value="all">All Words</option>			<option value="any">Any Word</option>		</select></td><td>&nbsp;</td>					  <td width="90" align="left">                        <input type="image" src="'+siteUrl+'images/06.jpg" width="23" height="22">                      </td>				</tr>				</form></table>								</td>				                </tr>            </table>          </td>    <td width="9" align="right"><img src="'+siteUrl+'images/09.jpg"></td>  </tr></table></td> </tr>  <tr> 	<td style="padding-right:45;" height="25" align="right" valign="top" class="top-link" bgcolor="#F0F0F0">	<span class="top-link"><a href="'+siteUrl+'aboutus.html" class="top-link">About Us</a></span>	&nbsp; | &nbsp; <span class="top-link"><a href="'+siteUrl+'contact.html" class="top-link">Contact Us</a></span>	&nbsp; | &nbsp; <span class="top-link"><a href="'+siteUrl+'feedback.php" class="top-link">Feedback Form</a></span>	<!-- &nbsp; | &nbsp; <span class="top-link"><a href="#" class="top-link">Query Form</a></span>	&nbsp; | &nbsp; <span class="top-link"><a href="#" class="top-link">FAQ/Help</a></span>	&nbsp; | &nbsp; <span class="top-link"><a href="#" class="top-link">Accolades</a></span> -->	&nbsp; | &nbsp; <span class="top-link"><a href="'+siteUrl+'download-instructions.html" class="top-link">Download Instructions</a></span>&nbsp; | &nbsp; <span class="top-link"><a href="'+siteUrl+'the-free-album/" class="toplink1">The Free Album</a></span>	</td> </tr></table>');
}

function headerpanel(path)
{
	if(path==null)path="./";
    document.write('  <table cellspacing="0" width="1004" cellpadding="0" border="0">  <tr>	  <td align="right">	  <a href="http://sitagita.com"><img src="http://www.sitagita.com/new-images/logo.jpg" border=0/></a></td><td valign="bottom" align="left" style="padding-bottom:4px" ><table border="0" cellpadding="0" cellspacing="0" bgcolor="#DC1059" width="95%" height="24">   <tr><td class="topstrip" height="25" align="left"><a href="http://www.sitagita.com/beauty/" class="topstrip">Beauty Care</a>  </td>  <td class="topstrip">|</td>  <td class="topstrip">  <a href="http://www.sitagita.com/fashion/" class="topstrip">Fashion Tips</a> </td> <td class="topstrip">|</td>  <td class="topstrip"><a href="http://www.sitagita.com/diet-and-fitness/" class="topstrip">Diet for Women</a> </td> <td class="topstrip">|</td> <td class="topstrip"><a href="http://sitagita.com/indian-weddings/" class="topstrip">Indian Weddings</a></td><td class="topstrip">|</td><td class="topstrip"><a href="http://sitagita.com/working-women/" class="topstrip">Women at Work</a></td><td class="topstrip">|</td><td class="topstrip"><a href="http://sitagita.com/home-and-lifestyle/" class="topstrip">Home & Lifestyle</a></td><td class="topstrip">|</td><td class="topstrip"><a href="http://www.sitagita.com/health-and-wellness/" class="topstrip">Health Care</a></td></tr></table>  </td></tr></table>')
}


function footerpanel(path)
{
	if(path==null)path="./";
	document.write('<table cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top" align="center" style="padding-top:10px;" width="100%"><table cellspacing="0" cellpadding="0" border="0" width="95%"><tr><td valign="middle" height="30" class="copyright">All Rights Reserved.Copyright@2008</td><td valign="middle" height="30" class="copyright" align="right">Powered by <a href="http://www.headlinesindia.com" class="copyright">www.headlinesindia.com</a></td></tr></table></td></tr></table>')
}