<!--

//Checking for Valid Email Address
function validEmail(email)
{
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	var checkend=/\.[a-zA-Z]{2,3}$/;
	if((email.search(exclude) != -1) || (email.search(checkend) == -1)) { return false; }
	var atPos = email.indexOf("@",0);
	var pPos1 = email.indexOf(".",0);
	var periodPos = email.indexOf(".",atPos);
	var pos1 = pPos1;
	var pos2 = 0;

	while (pos2 > -1)
	{
		pos2 = email.indexOf(".",pos1+1);
		if (pos2 == pos1+1) { return false; }
		else { pos1 = pos2; }
	}

	if (atPos == -1) { return false; }
	if (atPos == 0) { return false; }
	if (pPos1 == 0) { return false; }
	if(email.indexOf("@",atPos+1) > -1) { return false; }
	if(periodPos == -1) { return false; }
	if(atPos+1 == periodPos) { return false; }
	if(periodPos+3 > email.length) { return false; }
return true;
}

//Checking for Blank Input fields
function isBlank(fieldName)
{
	var len,k,flg;
	flg=true;
	if(fieldName!=null)
	{
		len=fieldName.length;
		for(k=0;k<len;k++)
		{
			if(fieldName.substring(k,k+1)!=" ")
			flg=false;
		}
	}
return flg;
}

//Checking for Characters only (with spaces)
function charsOnlyWithSpaces(fieldName)
{
	var validChars = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var temp;

	for(var i=0; i < fieldName.length; i++)
	{
		temp = fieldName.substring(i,i+1);
		if(validChars.indexOf(temp) == "-1")
		{
			return false;
		}
	}	
}

//Checking for Numbers only
function numbersOnly(fieldName)
{
	var validChars = "0123456789";
	var temp;

	for(var i=0; i < fieldName.length; i++)
	{
		temp = fieldName.substring(i,i+1);
		if(validChars.indexOf(temp) == "-1") { return false; }
	}
}

// #### allowing frames for roltanet ####
if (self != top) {
	if (document.images)
		top.location.replace(window.location.href);
	else
		top.location.href = window.location.href;
}

function combo_option(obj,sub_heading){

	var total = 0;
	var total_checked = new Array();
	var flag = 0;
	for(var i=0;i<document.frm_main.elements[obj.name].length;i++){
		if(document.frm_main.elements[obj.name].options[i].selected){
			if(document.frm_main.elements[obj.name].options[i].text!=""){
				total_checked.push(i);
				total++;
			}
			if(total>3){
				document.frm_main.elements[obj.name].options[i].selected=false;
				total++;
				flag = 1;
			}

		}
	}
		if (flag == 1) {
			alert("You can choose only three "+sub_heading);
		}
		flag = 0;
}



function show_hide_options(refdiv, sign, selected_value){

	var domItem=document.getElementById(refdiv);

	if(selected_value == "selected"
	|| domItem.style.display=='none')
	{
		for(var i=1; i<=refdiv.substr(1); i++){
			tmp_id=refdiv.substr(0,1)+i;
			document.getElementById(tmp_id).style.display='';
		}
		if(sign){
			sign.innerHTML=sign.innerHTML.replace('More','Fewer');
			sign.innerHTML=sign.innerHTML.replace('plus','minus');
			sign.style.background='#FFFFFF';
			sign.innerHTML=sign.innerHTML.replace('span','span style=\"display: none;\"');
			sign.innerHTML=sign.innerHTML.replace('SPAN','SPAN style=\"display: none;\"');
//			alert(sign.innerHTML+"+");

		}
	}else{
		for(var i=1; i<=refdiv.substr(1); i++){
			tmp_id=refdiv.substr(0,1)+i;
			document.getElementById(tmp_id).style.display='none';
		}
		if(sign){
			sign.innerHTML=sign.innerHTML.replace('Fewer','More');
			sign.innerHTML=sign.innerHTML.replace('minus','plus');
			sign.style.background='#F3F3F3';
			sign.innerHTML=sign.innerHTML.replace('span','span style=\"display: ;\"');
			sign.innerHTML=sign.innerHTML.replace('SPAN','SPAN style=\"display: ;\"');
//			alert(sign.innerHTML+"+");

		}
	}
}

function chk_profileID()
{
//Profile ID	
	if(isBlank(document.profileform.ProfileID.value) || (document.profileform.ProfileID.value=="Enter Profile ID"))
	{
		alert("Please Enter Profile ID");
		document.profileform.ProfileID.focus();
		document.profileform.ProfileID.select();
		return false;
	}
}


function check_option_dosent_matter(obj)
{

	var check_flag = 0;
	var i = 0;
	for(i=0;i<document.frm_main.elements[obj.name].length;i++){
		if(check_flag == 1){
			document.frm_main.elements[obj.name][i].checked =false;
		}
		if (document.frm_main.elements[obj.name][i].value=="null" || document.frm_main.elements[obj.name][i].value=="")
		{
			if (document.frm_main.elements[obj.name][i].checked==true)
				check_flag = 1;
		}
	}
}


function check_option(obj){

	for(i=0;i<document.frm_main.elements[obj.name].length;i++){

		if (document.frm_main.elements[obj.name][i].value=="null" || document.frm_main.elements[obj.name][i].value==""){
			if (document.frm_main.elements[obj.name][i].checked==true)
				document.frm_main.elements[obj.name][i].checked =false;
			}
	}
}


/**
 * counter for textarea
 *
 * @author Ritchie
 * @param  string  sForm      form name
 * @param  string  sTextArea  textarea name
 * @param  string  sTextInput counter name
 * @param  integer iMaxLimit  max number for counter
 *
 * @usage  <textarea onKeyUp="calcCharLen('form_name', 'field_name', 'counter_name', 100)" onBlur="calcCharLen('form_name', 'field_name', 'counter_name', 100)" wrap="virtual" maxLength="100" class="forminput">

*/
function calcCharLen(sForm, sTextArea, sTextInput, iMaxLimit)
{
	var _oDF        = document.forms[sForm];
	var _oTxtA      = _oDF.elements[sTextArea];
	var _iMaxLength = (!iMaxLimit) ? 100 : iMaxLimit;
	var _iCharLeft  = _oTxtA.value.length;

	_oDF.elements[sTextInput].value = _iCharLeft;

	if(_iCharLeft > _iMaxLength)
	{
		_oTxtA.value = _oTxtA.value.substring(0, _iMaxLength);
		_oDF.elements[sTextInput].value = _iMaxLength;
		alert('You can enter only '+_iMaxLength+' characters.');
	}
}

function validateLogin()
{
	var frmObjlg = document.LoginForm;

	//Login ID

	if(isBlank(frmObjlg.txtLoginName.value) || (frmObjlg.txtLoginName.value=="Name"))
	{
		alert("Please enter your Login ID");
		frmObjlg.txtLoginName.focus();
		frmObjlg.txtLoginName.select();
		return false;
	}

	if(isBlank(frmObjlg.txtPassword.value) || (frmObjlg.txtPassword.value=="Name"))
	{
		alert("Please enter valid Password");
		frmObjlg.txtPassword.focus();
		frmObjlg.txtPassword.select();
		return false;
	}

	return true;
}




// #### clear form ### 
function cls(str){
	str.value = "";
	return;
}

var opened=false;
var win;
function openWin(str,nm,width,height){
	if(opened == false){
		win = open(str,nm,"status=0,scrollbars=1,menubar=0,toolbar=0,location=0,resizeable=0,width="+width+",height="+height);
	}
	else if(opened == true){
		if(win.closed == false)
		win.close(); 
		win = window.open(str,nm,"status=0,scrollbars=1,menubar=0,toolbar=0,location=0,resizeable=0,width="+width+",height="+height);    
	}
	opened = true; 
}

function setStat(str){
	window.status=str;
	window.defaultStatus="";
}

function veriPopUp(url) { sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=720,height=450'); self.name = "mainWin"; }



function age_diff_max(){

	var diff = parseInt(document.quicksearch.ageto.options[document.quicksearch.ageto.selectedIndex].text) - parseInt(document.quicksearch.agefrom.options[document.quicksearch.agefrom.selectedIndex].text);
	if(diff > 10) {
		alert("Age range exceeds 10 years.\nChange age range");
		return false;
	}
	else if(parseInt(document.quicksearch.ageto.options[document.quicksearch.ageto.selectedIndex].text) < parseInt(document.quicksearch.agefrom.options[document.quicksearch.agefrom.selectedIndex].text)){
		alert("Invalid From & To Age");
		return false;
	}
	else {
	return true;
	}
}
function chk_community(){
	if (document.quicksearch.community.options[document.quicksearch.community.selectedIndex].value == ""){
		alert("Please select Caste");
		return false;
	}else{
		return true;
	}
}

function chk_quicksearch(){
	//alert("hello");
	if (age_diff_max() == true){
		return	chk_community();
	}
	else{
		return false;
	}	
}


function go()
{
	href = document.explore.destination.value;
	if(href) window.open(href);
}
//-->