/*************************************************************************************************
** Project Name		: Eeenadupellipandiri
** File Name		: indexpage.js
** Objective		: Javascript for indexpage validations
** Created By		: Sunil Kumar VC - Greynium Information Technologies Pvt. Ltd.
** Created Date		: 06-March-2009
** Modified By		: 
** Modified Date	: 
*********************************************************************************************/


function isformValid()
{
	var reg = document.quicksearchform.religion.value;	
	var minage = document.quicksearchform.minage.value;
	var maxage = document.quicksearchform.maxage.value;
	
	if(minage < 18)
	{
	   alert("From age should not below 18 years");
	   document.quicksearchform.minage.focus();
	   return false;
	}
	
	if (maxage > 60 )
	{
	   alert("To age should be below 60 years");
	   document.quicksearchform.maxage.focus();
	   return false;
	}
	
	if(minage >60 )
	{
	   alert("From Age should be below 60 years");
	   document.quicksearchform.minage.focus();
	   return false;
	}
	
	if (maxage <  18  )
	{
	   alert("To Age should not below 18 years");
	   document.quicksearchform.maxage.focus();
	   return false;
	}
	
	if (minage > maxage)
	{
	   alert("Invalid age range");
	   document.quicksearchform.minage.focus();
	   return false;
	}
	
	 
	else if (reg == "")
	{
	   alert("Select the Religion");
	   document.quicksearchform.religion.focus();
	   return false;
	}
	document.quicksearchform.submit();
}


function isLoginFormValid()
{
	var name = document.loginform.username.value;
	var pass = document.loginform.password.value;
	var frm = document.loginform;
	
	if (name == "")
	{
	   alert("Enter Profile Id");
	   document.loginform.username.focus();
	   return false;
	} 
	else if (pass == "")
	{
	   alert("Enter Password");
	   document.loginform.password.focus();
	   return false;
	} 

	frm.submit();
}
function searchProfileId()
{	
	var uname = document.profidsearchform.username.value;
	if (uname == "")
	{
		alert("Enter Profile Id");
		document.profidsearchform.username.focus();
		return false;
	}
	document.profidsearchform.submit();
}
//Load caste based on religion
function getReligionValue()
{
	var religionId = document.quicksearchform.religion.value;
	
	if (religionId != "") 
		agent.call("","loadCaste","putCasteValue",religionId);
	else
		document.quicksearchform.caste_select.options.length=1;
}                       


function putCasteValue(obj) 
{
	var len=obj.length;
	document.quicksearchform.caste_select.options.length=len+1;
	document.quicksearchform.caste_select.options[0].value='';
	document.quicksearchform.caste_select.options[0].text='Any';

	for(j=0;j<len;j++) {
		document.quicksearchform.caste_select.options[j+1].value= obj[j]['caste_id'];
		document.quicksearchform.caste_select.options[j+1].text = obj[j]['caste_name'];
	}
	
}

function changeGroomAgeRange()
{
	document.quicksearchform.minage.value = 18;
	document.quicksearchform.maxage.value = 25;
}

function changeBrideAgeRange()
{
	document.quicksearchform.minage.value = 21;
	document.quicksearchform.maxage.value = 32;
}

function changeAgeRange(val) {
	if(val == 'F') {
		document.getElementById('agefrom').value = "18";
		document.getElementById('ageto').value = "25";
	}
	else {
		document.getElementById('agefrom').value = "21";
		document.getElementById('ageto').value = "32";
	}
}

var message="Right click disabled";
///////////////////////////////////
function clickIE()

{if (document.all)
{alert(message);return false;}}

function clickNS(e) {
if
(document.layers||(document.getElementById&&!document.all))
{
	
if (e.which==2||e.which==3) {	
	alert(message);
	return false;
}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else
{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
