
/*************  2/2/2009 FUNCTION TO PRINT HALL TICKET AND PRINTABLE FORM EXCLUDING HEADER,LEFT AND FOOTER  
				DONT ALTER THIS FUNCTION *****/
function printpage() 
	{
		window.print();
	}

	function Printit()
    {
		printpage();
        
      }

	function Printiturv()
    {
		document.getElementById("trHead").style.display = "none";
        document.getElementById("WHeader").style.display = "none";
        document.getElementById("Footer").style.display = "none";

        document.getElementById("tblPrint").style.display = "none";
		//document.getElementById("tblproc").style.display = "none";
	
		document.getElementById("logo-graphic").style.display = "none";
		document.getElementById("header").style.display = "none";
		document.getElementById("footer").style.display = "none";

		document.getElementById("mbar").style.display = "none";
		document.getElementById("Note").style.display = "none";
		///document.getElementById("nava").style.display = "none";
		//document.getElementById("welcome").style.display = "none";
			 

		printpage();
         
        document.getElementById("trHead").style.display = "block";
        document.getElementById("WHeader").style.display = "block";
        document.getElementById("Footer").style.display = "block";
        document.getElementById("tblPrint").style.display = "block";
		//document.getElementById("tblproc").style.display = "block";

		document.getElementById("logo-graphic").style.display = "block";
		document.getElementById("header").style.display = "block";
		document.getElementById("footer").style.display = "block";

		document.getElementById("mbar").style.display = "block";
		document.getElementById("Note").style.display = "block";
		//document.getElementById("nava").style.display = "block";
		//document.getElementById("welcome").style.display = "block";
		document.getElementById("lft").style.display = "block";
	}


function Printit1()
    {
		
		window.print();
       
	}

function Printitouter()
    {
		 
		document.getElementById("trHead").style.display = "none";
		document.getElementById("Footer").style.display = "none";
		document.getElementById("logo-graphic").style.display = "block";
		document.getElementById("header").style.display = "block";
		document.getElementById("footer").style.display = "block";
		document.getElementById("mbar").style.display = "none";
        document.getElementById("lft").style.display = "none";
		document.getElementById("nav").style.display = "none";
        window.print();
		
		document.getElementById("trHead").style.display = "block";
		document.getElementById("Footer").style.display = "block";
		document.getElementById("logo-graphic").style.display = "none";
		document.getElementById("header").style.display = "none";
		document.getElementById("footer").style.display = "none";
		document.getElementById("mbar").style.display = "block";
		 
		document.getElementById("nav").style.display = "block";
        document.getElementById("lft").style.display = "block";
        
		
	}


/*************** Application ID Validate     **********/
function validateappid()
	{
		if(document.ht.txt_regNo.value == "MC10" || document.ht.txt_regNo.value == "" || document.ht.txt_regNo.value.length<'10')
		{
			alert("Please enter Application ID");
			document.ht.txt_regNo.focus();
			return false;
		}
		return true;
	}

function cancelconfappid()
	{
      if(document.ht.txt_rollno.value =='')
	  {
		if(document.ht.txt_appid.value=='MC10' || document.ht.txt_appid.value.length<'10' || document.ht.txt_appid.value=="")
		{
			alert("Please Enter Valid Application ID");
			document.ht.txt_appid.focus();
			return false;
		}
	  }
	  else
	  {
		if(document.ht.txt_rollno.value.length<'8')
		{
			alert("Please Enter Valid Roll ID");
			document.ht.txt_rollno.focus();
			return false;
		}
	  } 
		return true;
	}

function validappid()
	{
		if(document.ila.appid.value == "MC10" || document.ila.appid.value == "")
		{
			alert("Please enter Application ID");
			return false;
		}
		return true;
	}

function valid_cet_appid() // public cet result display
	{
		if(document.cet.candid.value == "")
		{
			alert("Please enter Valid Application ID or Roll No");
			return false;
		}
		if(document.cet.candid.value.substring(-6,6) <= 0)
		{
			alert("Please enter Valid Application ID or Roll No");
			return false;
		}

		if(document.cet.candid.value.substring(0,4) == "MC10" && document.cet.candid.value.length<'10')
		{
			alert("Please enter 10 Digit Application ID");
			//document.ht.txt_regNo.focus();
			return false;
		}
		else if(document.cet.candid.value.substring(0,4) != "MC10" && document.cet.candid.value.length<'8')
		{
			alert("Please enter Valid 8 Digit Roll No");
			return false;
		}
		
		if(document.cet.dob.value == '')
		{
			alert("Please select birth date from calender.");
			return false;
		}
	/*	if(document.cet.month.value <= 0)
		{
			alert("Please select birth Month.");
			return false;
		}
		if(document.cet.year.value <= 0)
		{
			alert("Please select birth Year.");
			return false;
		}*/
		return true;
	}

function valid_cet_id() // for admin cet resut display
	{
		if(document.cet.candid.value == "")
		{
			alert("Please enter Valid Application ID or Roll No");
			return false;
		}
		
		return true;
	}

function validcandid()
	{
		if(document.candmaster.candid.value == "MC10" || document.candmaster.candid.value == "")
		{
			alert("Please enter Application ID");
			return false;
		}
		return true;
	}

function appidval()
	{
		//alert("aa");
		if(document.login.username.value == "MC10" || document.login.username.value == "")
		{
			alert("Please enter Application ID");
			document.login.username.focus();
			return false;
		}
		
		if(document.login.password.value == '' || document.login.password.value == null)
		{
			alert("Please enter Password");
			document.login.password.focus();
			return false;
		}
		return true;
	}

/**********   CET CENTER CONTROL IN ADMIN ***************/
function valid()
{
	if(document.viewtype.cetcenters.value =='')
	{
		alert("Please Select Cet Center City.");
		return false;
	}
	
	if(document.viewtype.cetvenue.value =='')
	{
		alert("Please Select Cet Center Venue.");
		return false;
	}

	return true
}


function CheckCapacity()
{
	//alert(document.cet.current.value);
	//alert(document.cet.maxcap.value);
	if(document.cet.maxcap.value < document.cet.current.value)
	{
		alert("Maximum Capacity should not be less than Current Capacity.");
		return false;
	}
	
	return true
}

function moveUpList()
{
	//alert(document.getElementById("cmbOptionsSelected"));return false;
	
	var listField = document.getElementById("cmbOptionsSelected");
	//alert(document.cet.cmbOptionsSelected.value);return false;
	//alert(listField.length);
	//return false;
	if ( listField.length == -1) 
	{
		alert("There are no values which can be moved!");
	}
	else
	{
		var selected = listField.selectedIndex;
		if (selected == -1)
		{
			alert("You must select an entry to be moved!");
		} 
		else 
		{  
			if ( listField.length == 0 )
			{ 
				alert("There is only one entry!\nThe one entry will remain in place.");
			}
		    else
		    {  
				if ( selected == 0 ) 
		        {
					alert("The first entry in the list cannot be moved up.");
				}
		        else 
		        {
					// Get the text/value of the one directly above the hightlighted entry as
		            // well as the highlighted entry; then flip them
		            var moveText1 = listField[selected-1].text;
		            var moveText2 = listField[selected].text;
		            var moveValue1 = listField[selected-1].value;
		            var moveValue2 = listField[selected].value;
		            listField[selected].text = moveText1;
		            listField[selected].value = moveValue1;
		            listField[selected-1].text = moveText2;
		            listField[selected-1].value = moveValue2;
		            listField.selectedIndex = selected-1; // Select the one that was selected before
				}  // Ends the check for selecting one which can be moved
			}  // Ends the check for there only being one in the list to begin with
		}  // Ends the check for there being something selected
	}  // Ends the check for there being none in the list
}

function validateaa()
{
	if(document.cet.cmbOptionsSelected.length<1)
	{
		alert("Please Select at least one Cetcenter");
		document.cet.cmbOptionsSelected.focus();
		return false;
	}
	var list;
	list="";
	for(i=0;i< document.cet.cmbOptionsSelected.length; i++)
	{
		list=list+","+document.cet.cmbOptionsSelected.options[i].value;
	}
	document.cet.colleges.value=list;
return true;
} 

function moveDownList() 
{
	var listField = document.getElementById("cmbOptionsSelected");
	if ( listField.length == -1) 
	{  
		alert("There are no values which can be moved!");
	} 
	else
	{
		var selected = listField.selectedIndex;
		if (selected == -1)
		{
			alert("You must select an entry to be moved!");
		} 
		else 
		{  
			if ( listField.length == 0 ) 
		    {  
				alert("There is only one entry!\nThe one entry will remain in place.");
			} 
		    else 
		    { 
				if ( selected == listField.length-1 ) 
		        {
					alert("The last entry in the list cannot be moved down.");
				} 
		        else 
		        {
					// Get the text/value of the one directly below the hightlighted entry as
		            // well as the highlighted entry; then flip them
		            var moveText1 = listField[selected+1].text;
		            var moveText2 = listField[selected].text;
		            var moveValue1 = listField[selected+1].value;
		            var moveValue2 = listField[selected].value;
		            listField[selected].text = moveText1;
		            listField[selected].value = moveValue1;
		            listField[selected+1].text = moveText2;
		            listField[selected+1].value = moveValue2;
		            listField.selectedIndex = selected+1; // Select the one that was selected before
				}  // Ends the check for selecting one which can be moved
			}  // Ends the check for there only being one in the list to begin with
		}  // Ends the check for there being something selected
	}  // Ends the check for there being none in the list
}

/**********   CET CENTER CONTROL IN ADMIN ENDS ***************/


function toggleDiv(id,flagit){
	if (flagit=="1"){
		if (document.layers) document.layers[''+id+''].visibility = "show"
		else if (document.all) document.all[''+id+''].style.visibility = "visible"
		else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
	}
	else{
		if (flagit=="0"){
			if (document.layers) document.layers[''+id+''].visibility = "hide"
			else if (document.all) document.all[''+id+''].style.visibility = "hidden"
			else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
		}
	}
}


function get_homeuniv() 
{
	var str = document.cate.seldist.value.substr(3,2);
	
	if(str ==1)
	{
		var univ_name = "Dr. Babasaheb Ambedkar Marathwada University";
	}
	else if(str ==2)
	{
		var univ_name = "Swami Ramanand Teerth Marathwada University";
	}
	else if(str ==3)
	{
		var univ_name = "Rashtrasant Tukdoji Maharaj Nagpur University";
	}
	else if(str ==4)
	{
		var univ_name = "Pune University";
	}
	else if(str ==5)
	{
		var univ_name = "North Maharashtra University";
	}
	else if(str ==6)
	{
		var univ_name = "Mumbai University";
	}
	else if(str ==7)
	{
		var univ_name = "Sant Gadgebaba Amravati University";
	}
	else if(str ==8)
	{
		var univ_name = "Shivaji University+Solapur University";
	}
	alert (univ_name);

	return univ_name;
 }

function validateAddFileForm(editFlag){
	if(document.form1.cmbFileType.value==''){
		alert("Please select valid document type.");
		return false;
	}
	if(document.form1.txtName.value==''){
		alert("Please enter the display name for the document.");
		return false;
	}
	if(document.form1.txtDesc.value==''){
		alert("Please enter a breif description for the document.");
		return false;
	}
	if(document.form1.userfile.value=='' && !editFlag){
		alert("Select a document to upload.");
		return false;
	}
	if(document.form1.dispfrom.value==''){
		alert("Please select the date from which the document will be listed");
		return false;
	}
	if(document.form1.dispto.value==''){
		alert("Please select the date upto which the document should be listed.");
		return false;
	}

	return true;
}
function validateNewsForm()
	{
	if (document.addnews.news.value == "" || document.addnews.news.value == null)
		{
		alert ("Please Enter the News.");
		document.addnews.news.focus();
		return false;
		}

		if (document.addnews.dispfrom.value == "")
		{
		alert ("Please Select Display From Date.");
		document.addnews.dispfrom.focus();
		return false;
		}

		if (document.addnews.dispto.value == "")
		{
		alert ("Please Select Display To Date.");
		document.addnews.dispto.focus();
		return false;
		}

	return true;
	}

function validateFileUploadForm()
	{
	    if (document.form1.cmbFileType.value == "" || document.form1.cmbFileType.value == null)
		{
		alert ("Please Select Document/ File type");
		return false;
		}

	    if (document.form1.txtName.value == "" || document.form1.txtName.value == null)
		{
		alert ("Please Enter the Display Name");
		document.form1.txtName.focus();
		return false;
		}

	    if (document.form1.txtDesc.value == "" || document.form1.txtDesc.value == null)
		{
		alert ("Please Enter the Brief Description");
		document.form1.txtDesc.focus(); 
		return false;
		}

	    if (document.form1.userfile.value == "" || document.form1.userfile.value == null)
		{
		alert ("Please Select the file to upload ");
		document.form1.userfile.focus(); 
		return false;
		}

		if (document.form1.dispfrom.value == "")
		{
		alert ("Please Select Display From Date.");
		document.form1.dispfrom.focus();
		return false;
		}

		if (document.form1.dispto.value == "")
		{
		alert ("Please Select Display To Date.");
		document.form1.dispto.focus();
		return false;
		}

	return true;
	}


function validateFaqsForm()
	{
	
	if (document.faqForm.Candidate.value == "")
		{
		alert ("Please Select  the Candidat type.");
		document.faqForm.Candidate.focus();
		return false;
		}

	if (document.faqForm.question.value == "" || document.faqForm.question.value == null)
		{
		alert ("Please Enter the Question.");
		document.faqForm.question.focus();
		return false;
		}

	if (document.faqForm.answer.value == "" || document.faqForm.answer.value == null)
		{
		alert ("Please Enter the Answer.");
		document.faqForm.answer.focus();
		return false;
		}

		if (document.faqForm.dispfrom.value == "")
		{
		alert ("Please Select Display From Date.");
		document.faqForm.dispfrom.focus();
		return false;
		}

		if (document.faqForm.dispto.value == "")
		{
		alert ("Please Select Display To Date.");
		document.faqForm.dispto.focus();
		return false;
		}

	return true;
	}

function conpsw()
{
	if(document.loginForm.txt_pswcon.value.length < 5 || document.loginForm.txt_pswcon.value.length >15)  {
		alert ("Please Enter the password of length 5-15 characters.");
		document.loginForm.txt_pwd.value="";
		document.loginForm.txt_pswcon.value="";
		document.loginForm.txt_pwd.focus();
		return false;
	}
	
	if(document.loginForm.txt_pswcon.value==document.loginForm.txt_pwd.value)
	{
		//alert("Password Matched");
	}
	else
	{
		alert("Please Re-enter Password ");
		document.loginForm.txt_pswcon.value="";
		document.loginForm.txt_pwd.focus();
		return false;
	}
}

function processForm() 
{
	if (document.loginForm.opass.value == "")
	{
		alert ("Please Enter the old Password");
		document.loginForm.opass.focus();
		return false;
	}
	if (document.loginForm.txt_pwd.value == "")
	{
		alert ("Please Enter the New password.");
		document.loginForm.txt_pwd.focus();
		return false;
	}
	if (document.loginForm.txt_pwd.value.length < 5 )
	{
		alert ("Please Enter Password Atleast 6 Digits");
		document.loginForm.txt_pwd.focus();
		return false;
	}
	if (document.loginForm.txt_pswcon.value == "")
	{
		alert ("Please confirm Password.");
		document.loginForm.txt_pswcon.focus();
		return false;
	}
	if (document.loginForm.txt_pswcon.value.length < 5 )
	{
		alert ("Please Enter Password Atleast 6 Digits");
		document.loginForm.txt_pwd.focus();
		return false;
	}
	return true;
}

function secque() 
{
	if(isEmptySelect(document.secureques.cmbsec))
	{
		alert("Select valid security question");
			return false;
	}
	if(isEmpty(document.secureques.answer))
	{
		alert("Enter valid Answer for your security question");
		    return false;
	}
	//alert(document.secureques.answer.value.length);
	return true;

	if(document.secureques.answer.value.length < 6)
	{
		alert(document.secureques.answer.value.length);
		return false;
		alert("Please Enter valid Answer Minimum 6 Characters Long. You Entered  "+ document.getElementById('answer').value +"");
		return false;
	}

	return true;
}

function validimage() 
{
	//alert(document.swap.is_photo.value);
	return true;
		
	 
	
}

function validcngcandpwd()
{
  if(document.cngcandpwd_init.rollno.value =='')
  {
    if(document.cngcandpwd_init.appid.value =='' || document.cngcandpwd_init.appid.value =='MC10' || document.cngcandpwd_init.appid.value.length<'10' )
	{
		alert("Please enter valid Application ID");
        document.cngcandpwd_init.appid.focus();
		return false;
	}	 
  }
  else
  {
    if(document.cngcandpwd_init.rollno.value =='' || document.cngcandpwd_init.rollno.value.length<'8' )
	{
		alert("Please enter valid Roll No");
        document.cngcandpwd_init.rollno.focus();
		return false;
	}	 
  }
  return true;
}
function valcngcandpwd()
{

	if(document.cngcandpwd.appid.value == "MC10" && document.cngcandpwd.rollno.value == "")
	{	
		alert("Please enter the valid Application ID");
			return false;
	}

	else if(document.cngcandpwd.user.value == "arc" && document.cngcandpwd.appid.value == "ARC")
	{
		alert("Please enter the valid Arc Code");
			return false;
	}
	if(document.cngcandpwd.txt_pwd.value == "")
	{
		alert("Please enter the New Password");
			return false;
	}
	if(document.cngcandpwd.txt_pswcon.value == "")
	{
		alert("Please enter the Confirm Password");
			return false;
	}
	if(document.cngcandpwd.txt_pswcon.value != document.cngcandpwd.txt_pwd.value)
	{
		alert("New Password and Confirm Password must be same");
			return false;
	}
	return true;
}

//FOR CANDIDATE MSG SYSTEM

function selsubjectClick()
	{
	removeClass(document.getElementById('DP'),"displaynone");
	removeClass(document.getElementById('BP'),"displaynone");
	addClass(document.getElementById('UP'),"displaynone");
	if(document.getElementById("candtype").checked)
		{
		document.composemsg.subject.value = "Change in Candidate Type";	
		}
    else if(document.getElementById("nationalityType").checked)
		{
		document.composemsg.subject.value = "Change in Nationality Details";
		}
	else if(document.getElementById("category").checked)
		{
		document.composemsg.subject.value = "Change in Category Details";
		}
	else if(document.getElementById("Receipt_Details").checked)
		{
		document.composemsg.subject.value = "Change in Receipt Details";
		}
	else if(document.getElementById("Personal_Details").checked)
		{
		document.composemsg.subject.value = "Change in Personal Details";
		}
	else if(document.getElementById("Qualification_Details").checked)
		{
		document.composemsg.subject.value = "Change in Qualification Details";
		}
	else if(document.getElementById("Photo").checked)
		{
		document.composemsg.subject.value = "Change Uploaded Photo with Signature";
		
		addClass(document.getElementById('DP'),"displaynone");
		addClass(document.getElementById('BP'),"displaynone");
		removeClass(document.getElementById('UP'),"displaynone");
		
//		document.getElementById('UP').style.display = 'inline';
//		document.getElementById('DP').style.display = 'none';
//		document.getElementById('BP').style.display = 'none';
		}
	else if(document.getElementById("Hall_Ticket").checked)
		{
		document.composemsg.subject.value = "Problem in Print Hall Ticket";
		}
	else if(document.getElementById("Miscellaneous").checked)
		{
		document.composemsg.subject.value = "Miscellaneous";
		}
	else
		{
		document.composemsg.subject.value = "";
		}
	}
//08/03/2009 URVESH FOR ARC MESSEGES FOR CANDIDATE

function selsubject()
	{
		document.getElementById('msgtype').style.display = 'none';
		document.myform.subject.readOnly = false;
		document.myform.appid.readOnly = true;
		document.myform.appid.value = '';

		if(document.myform.txt1.value=='CADMIN')
		{
			document.getElementById('msgtype').style.display = 'inline';
			document.myform.subject.readOnly = true;
			document.myform.appid.readOnly = false;
			document.myform.appid.value = 'MC10';
		}
	}
//08/03/2009 URVESH FOR ARC MESSEGES FOR CANDIDATE

function updatesubject()
{
	if(document.getElementById("nationalityType").checked)
		{
		document.myform.subject.value = "Change Nationality";	
		}
	else if(document.getElementById("candtype").checked)
		{
		document.myform.subject.value = "Change Candidate Type";	
		}
	
	else if(document.getElementById("category").checked)
		{
		document.myform.subject.value = "Change Category";
		}
	else if(document.getElementById("Receipt_Details").checked)
		{
		document.myform.subject.value = "Change Postal Receipt";
		}
	else if(document.getElementById("Personal_Details").checked)
		{
		document.myform.subject.value = "Change Personal";
		}
	else if(document.getElementById("Qualification_Details").checked)
		{
		document.myform.subject.value = "Change Qualification";
		}
	else if(document.getElementById("Miscellaneous").checked)
		{
		document.myform.subject.value = "Miscellaneous";
		}

	else if(document.getElementById("Photo").checked)
		{
		document.myform.subject.value = "Change Uploaded Photo";
		//document.getElementById('UP').style.display = 'inline';
		}
	

}
//this is for after check box selection name are pasted in the given text area.
//updated on 02/03/2009 urvesh added inst case
function showlist(yes)
{
	if(yes.value == 'Y')//for arc shows and others are hidden 02/03/2009
	{
		document.getElementById('list').style.display = 'inline';
		document.getElementById('listr').style.display = 'none';
		document.getElementById('listi').style.display = 'none';
	}
	else if(yes.value == 'R')//for ro shows and others are hidden 02/03/2009
	{
		document.getElementById('list').style.display = 'none';
		document.getElementById('listr').style.display = 'inline';
		document.getElementById('listi').style.display = 'none';
	}
	else if(yes.value == 'I')//for institutes shows and others are hidden 02/03/2009
	{
		document.getElementById('list').style.display = 'none';
		document.getElementById('listr').style.display = 'none';
		document.getElementById('listi').style.display = 'inline';
	}
	else //put all are hidden. 02/03/2009
	{
		document.getElementById('list').style.display = 'none';
		document.getElementById('listr').style.display = 'none';
		document.getElementById('listi').style.display = 'none';
	}
}
function Doit(myform) 
{ 
	myval="" 
	re=/,$/ // Use regular expression to remove comma from last value added to text box 
	for(i=0;i<myform.ckb.length;i++) 
	{ 
		if(myform.ckb[i].checked) 
		{
			myval+=myform.ckb[i].value+","
		} 
	} 
	myform.txt1.value=myval.replace(re,"") 
} 


function setParentValue() 
{
	//if (this.document.myform.txt1.value != null &&
	//this.document.myform.txt1.value != "") {
	window.opener.document.forms[0].myTextBox.value +=
	this.document.myform.txt1.value;
	this.close();
	//}
}


function checkAll(field)
{
	var obj=document.all.ckb
	for (i = 0; i < obj.length; i++)
		obj.ckb[i].checked = true ;
}

function uncheckAll(field)
{
	var obj=document.all.ckb
	for (i = 0; i < obj.length; i++)
	obj.ckb[i].checked = false ;
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function validateaddUserForm()
	{
	if(isEmpty(document.useraddForm.fullname))
   	   return false;
	if(isEmpty(document.useraddForm.address))
	   return false;
    if(ValidPincode(document.useraddForm.pincode))   
	   return false; 
    if(isEmpty(document.useraddForm.city))
	   return false;
    
	if(isEmpty(document.useraddForm.role))
	  return false; 
   
     if(isEmpty(document.useraddForm.username))
	  return false; 

	
	if(isEmpty(document.useraddForm.password))
      return false;

	if((document.useraddForm.password.value.length < 1)) //MAKE < 5 AFTER PASSWORD INSERT
		{
		alert("Password Must Be Minimum Six Character Long1");
		return false;
		} 
	if(!validatePwd(document.useraddForm.password))
		return false;
		
	if(isEmpty(document.useraddForm.cpassword))
      return false;  
	if((document.useraddForm.password.value != document.useraddForm.cpassword.value))
		{alert (document.useraddForm.password.value + document.useraddForm.cpassword.value);
		alert("Confirm Password Must Be Same As Password");
		return false;
		}
var agree=confirm("Click Ok, if you are sure that information filled by you is correct. \n\tPlease remember your Password\n\t Note down Please Check that Email Id Provided by you is Correct and Valid.");
  if (!agree)
	{
	document.useraddForm.txtPwd.value = "";
	document.useraddForm.txtPwdcon.value="";
	document.useraddForm.txtAnsw.value = "";
	document.useraddForm.txtPwd.focus();
	return false;
	}  
	return true;
	}

	function validateMenuForm()		//USED FOR ADD/EDIT MENU INFORMATION
	{
		if(isEmpty(document.menuForm.menuid))
			return false;
		if(isEmpty(document.menuForm.menuname))
			return false;
		if(isEmpty(document.menuForm.desc))
			return false;
		if(isEmpty(document.menuForm.path))
			return false; 
		if(isEmpty(document.menuForm.role))
			return false; 
	}


function put_ch_code()
{

var instcode = document.useraddForm.instcode.value;
document.useraddForm.chcode.value=instcode.substring(2,5);
//document.useraddForm.username.value=instcode;
}

function valinstedit() //USED FOR EDIT INSTITUTE INFORMATION
{
	if(document.useraddForm.role.value!='INSTITUTE')
	{
		
	if(document.useraddForm.chcode.value=="")
	{
		alert("Enter valid Choice Code for the Institute");
		return false;
	}

		if(document.useraddForm.capintake.value=="")
		{
			alert("Please Enter Valid CAP Intake");
			document.useraddForm.officername.focus();
			return false;
		}

		if(document.useraddForm.instintake.value=="" )
		{
			alert("Please Enter Valid Institute Intake");
			document.useraddForm.officername.focus();
			return false;
		}

		if(document.useraddForm.manintake.value=="" )
		{
			alert("Please Enter Valid Minority Intake");
			document.useraddForm.officername.focus();
			return false;
		}
	if(document.useraddForm.shortname.value=="")
	{
	alert("Enter valid Institute Short Name");
	return false;
	}

	if(document.useraddForm.name.value=="")
	{
	alert("Enter valid Institute Name");
	return false;
	}
	if(document.useraddForm.instfor.value=="")
	{
	alert("Select Institute For the Male/Female or for Both");
	return false;
	}
	if(document.useraddForm.s1_code.value=="")
	{
	alert("Select Institute Status i.e Govt./Govt. Aided/Univ Managed etc");
	return false;
	}
	if(document.useraddForm.s2_code.value=="")
	{
	alert("Select Institute Status i.e Autonomous / Non-Autonomous");
	return false;
	}
	if(document.useraddForm.s3_code.value=="")
	{
	alert("Select Minority Institute Status i.e Type of Minority");
	return false;
	}
	if(document.useraddForm.intake.value=="" || document.useraddForm.intake.value<=0)
	{
	alert("Enter the Intake of the institute");
	return false;
	}

	if(document.useraddForm.univ.value=="")
	{
	alert("Select the University of the institute");
	return false;
	}

	//if(document.useraddForm.dist.value=="0")
	//{
	//alert("Select the District of the institute");
	//return false;
	//}

	if(document.useraddForm.fee.value=="")
	{
	alert("Enter Standard Fee Structure of your Institute");
	return false;
	}

	if(document.useraddForm.email1.value !="")
	{
		if(validEmail(document.useraddForm.email1))
		{
			alert("Enter Valid E-Mail ID");
			return false;
		}
	}

    if(document.useraddForm.email2.value !="")
	{
		if(validEmail(document.useraddForm.email2))
		{
			alert("Enter Valid E-Mail ID");
			return false;
		}
	}
	}

	if(document.useraddForm.role.value=='INSTITUTE')
	{
		
		if(document.useraddForm.instintake.value=="" || document.useraddForm.instintake.value<=0)
		{
		alert("Enter the Intake of the institute");
		document.useraddForm.instintake.focus();
		return false;
		}

		if(document.useraddForm.fee.value=="" || document.useraddForm.fee.value<=0)
		{
		alert("Enter Standard Fee Structure of your Institute");
		document.useraddForm.fee.focus();
		return false;
		}

		if(document.useraddForm.email1.value !="")
		{
			if(validEmail(document.useraddForm.email1))
			{
				alert("Enter Valid E-Mail ID");
				return false;
			}
		}

		if(document.useraddForm.email2.value !="")
		{
			if(validEmail(document.useraddForm.email2))
			{
				alert("Enter Valid E-Mail ID");
				return false;
			}
		}

		if(document.useraddForm.princiname.value == "" )
		{
			alert("Please Enter Principal Name");
			document.useraddForm.princiname.focus();
			return false;
		}

		if(document.useraddForm.princiname.value.length < 3)
		{
			alert("Please Enter Valid Principal Name by entering more than 3 characters ");
			document.useraddForm.princiname.focus();
			return false;
		}


		if(IsNumber(document.useraddForm.princiname.value))
		{
			alert("Please Enter Valid Principal Name");
			document.useraddForm.princiname.focus();
			return false;
		}

		if(document.useraddForm.officername.value == "")
		{
			alert("Please Enter Officer Name");
			document.useraddForm.officername.focus();
			return false;
		}
		if(document.useraddForm.officername.value.length < 3)
		{
			alert("Please Enter Valid Officer Name by entering more than 3 characters ");
			document.useraddForm.princiname.focus();
			return false;
		}
		
		if(IsNumber(document.useraddForm.officername.value))
		{
			alert("Please Enter Valid Officer Name");
			document.useraddForm.officername.focus();
			return false;
		}

	

	}
}



function valinst() //USED FOR ADD INSTITUTE INFORMATION
{
	if(document.useraddForm.instcode.value=="")
	{
	alert("Enter valid Institute Code");
	return false;
	}
	if(document.useraddForm.chcode.value=="")
	{
	alert("Enter valid Choice Code for the Institute");
	return false;
	}


	/*
	if(document.useraddForm.chcode != '')
	{
	var chcode = document.useraddForm.chcode.value;
	var instcode = document.useraddForm.instcode.value;

	if(chcode.substring(0,3) != instcode.substring(2,5))
	{
	alert("Enter valid Choice Code for the Institute as Choice code start with the Institute Code");
	return false;
	}
	else if(chcode.length != 5)
	{
	alert("Choice code should be numeric 5 digit.");
	return false;
	}
	}
	*/
	if(document.useraddForm.shortname.value=="")
	{
	alert("Enter valid Institute Short Name");
	return false;
	}
	if(document.useraddForm.name.value=="")
	{
	alert("Enter valid Institute Name");
	return false;
	}
	if(document.useraddForm.instfor.value=="")
	{
	alert("Select is institute for the Male/Female or for Both");
	return false;
	}
	if(document.useraddForm.s1_code.value=="")
	{
	alert("Select is institute status i.e Govt./Govt. Aided/Univ Managed etc");
	return false;
	}
	if(document.useraddForm.s2_code.value=="")
	{
	alert("Select is institute status i.e Autonomous/Non-Autonomous etc");
	return false;
	}
	if(document.useraddForm.s3_code.value=="")
	{
	alert("Select is Minority institute status i.e Type of Minority");
	return false;
	}
	if(document.useraddForm.intake.value=="")
	{
	alert("Enter the Intake of the institute");
	return false;
	}
	if(document.useraddForm.univ.value=="")
	{
	alert("Select the University of the institute");
	return false;
	}

	if(document.useraddForm.dist.value=="0")
	{
		alert("Select the District of the institute");
		return false;
	}

	if(document.useraddForm.fee.value=="")
	{
		alert("Enter Standard Fee Structure of your Institute");
		return false;
	}

	if(document.useraddForm.email1.value!="")
	{
		if(validEmail(document.useraddForm.email1))
		{
			alert("Enter Valid E-Mail ID");
			return false;
		}
	}

    if(document.useraddForm.email2.value!="")
	{
		if(validEmail(document.useraddForm.email2))
		{
			alert("Enter Valid E-Mail ID");
			return false;
		}
	}

	
	if(document.useraddForm.username.value=="")
	{
	alert("Username of the Institute Should not be blank");
	return false;
	}
	if(document.useraddForm.password.value=="")
	{
	alert("Password of the Institute Should not be blank");
	return false;
	}
	if(document.useraddForm.cpassword.value=="")
	{
	alert("Confirm Password of the Institute Should not be blank");
	return false;
	}

	if(document.useraddForm.password.value != document.useraddForm.cpassword.value)
	{
	alert("Confirm Password Must Be Same As Password");
	return false;
	}

}

//FOR CITY MASTER ENTRY VALIDATION 04/03/2009 URVESH
function insertcity()
{
	if(isEmpty(document.form1.city))
		return false;
	if(document.form1.reg.value == '')
	{
		alert("Select the proper Region of the City.");
		return false;
	}
	return true;
}
//FOR FACULTY MASTER ENTRY VALIDATION 04/03/2009 URVESH
function insertfac()
{
	if(isEmpty(document.form1.fac))
		return false;

	return true;
}
//FOR PROCESS MASTER ENTRY VALIDATION 04/03/2009 URVESH
function insertpro()
{
	if(isEmpty(document.form1.pro))
		return false;
	if(document.form1.mainpro.value == '')
	{
		alert("Select the proper Main Process.");
		return false;
	}

	return true;
}
//FOR QUESTION MASTER ENTRY VALIDATION 04/03/2009 URVESH
/*
function insertques()
{
	if(isEmpty(document.form1.ques))
		return false;
 
	return true;
}
*/
   function insertques()
   {
     ValidChar=/^[a-z A-Z  - ? '' ]+$/i;
     if(!ValidChar.test(document.form1.ques.value))
     {
      alert ("Please Enter valid Question." );
      document.form1.ques.value;
      return false;	
     }  
    }
//FOR ROLE MASTER ENTRY VALIDATION 04/03/2009 URVESH
function insertrole()
{
	if(isEmpty(document.form1.role))
		return false;

	return true;
}
//FOR SEND SMS MODULE VALIDATION 04/03/2009 URVESH
function sendsms()
{
	if(isEmpty(document.form1.sms))
		return false;
	if(isEmpty(document.form1.msg))
		return false;


	return true;
}

//18/03/2009 URVESH FOR EDIT ADMIN USER

function editadminuser()
{
	if(isEmpty(document.userForm.fullname))
		return false;
	if(isEmpty(document.userForm.address))
		return false;
	if(isEmpty(document.userForm.city))
		return false;
	
	return true;
}

//19/03/2009 URVESH FOR IP ADDRESS VALIDATION

function chkipvalid()
{
	
	if(document.form1.ipaddr.value ==' ' || document.form1.ipaddr.value == '')
	{
		alert("Please enter valid ip address.");
		return false;
	}
	return true;
}

//FUNCTION FOR CLIENT SIDE VALIDATION OF THE UPLOAD CSV FILE THROUGH THE ADMIN INTERFACE 23/03/2009
function uplaodfiletype()
{
    if(document.form1.seltype.value =='')
    {
        alert("Plese select the upload file Type");
        return false;
    }
     if(document.form1.candImg.value =='')
    {
        alert("Plese select the file for uploading");
        return false;
    }
    return true;
    
}

/* added by urvesh for message in the non replied messages fo candidate for pop up window*/

//findPos function is from http://www.quirksmode.org/js/findpos.html;
//where its workings are explained in more detail.
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

//Display a named menu, at the position of another object
//function display_menu(parent,named)
//{
//	//get the named menu
//	var menu_element = document.getElementById(named);
//	//override the 'display:none;' style attribute
//	menu_element.style.display = "";
//	//get the placement of the element that invoked the menu...
//	var placement = findPos(parent);
//	//...and put the menu there
//	menu_element.style.left = placement[0] + "px";
//	menu_element.style.top = placement[1] + "px";
//}
$(document).ready(function() {
	



    function show() {
	    var menu = $(this);
		$(this).addClass("position_relative");
	    menu.children(".actions").slideDown();
//		$(".hover-menu").css("postion","relative");
//		$(".hover-menu").css("z-index","0");
     }
     
     function hide() { 
		var menu = $(this);
		
		menu.children(".actions").css("display","none");

		$(this).removeClass("position_relative");
		
     }
     
     function show_menu() {
 	    var menu = $(this);
 	   
 	    menu.addClass("parent_menu_li");
 	    //menu.children("ul").css("left",menu.offset().left);
 	    menu.children("ul").slideDown();
      }
      
      function hide_menu() { 
 		var menu = $(this);
 		menu.removeClass("parent_menu_li");
 		
 		menu.children("ul").slideUp();
      }
      
      function show_menu_right() { 
    	  var menu = $(this);
    	   
   	    menu.addClass("parent_menu_li");
   	    //menu.children("ul").css("left",-125);
   	    menu.children("ul").slideDown();
      }
     
      
     
      function showLeft(){
    	  //$(this).children("ul").css("display","block");
		  $(this).addClass("position_relative");
		  $menu=$(this);
		  
    	  $(this).children("ul").slideDown();
    	  
      }
      
      function hideLeft(){
    	  $(this).children("ul").css("display","none");
		  $(this).removeClass("position_relative");
    	  
      }
      
      $(".left_menu_li ").hoverIntent({
  		sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
  		interval: 50,   // number = milliseconds for onMouseOver polling interval
  		over: showLeft,     // function = onMouseOver callback (required)
  		timeout: 300,   // number = milliseconds delay before onMouseOut
  		out: hideLeft       // function = onMouseOut callback (required)
     }); 
     
     $(".hover-menu").hoverIntent({
		sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
		interval: 50,   // number = milliseconds for onMouseOver polling interval
		over: show,     // function = onMouseOver callback (required)
		timeout: 300,   // number = milliseconds delay before onMouseOut
		out: hide       // function = onMouseOut callback (required)
     });
     
     $("#admis_menu").hoverIntent({
 		sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
 		interval: 50,   // number = milliseconds for onMouseOver polling interval
 		over: show_menu,     // function = onMouseOver callback (required)
 		timeout: 300,   // number = milliseconds delay before onMouseOut
 		out: hide_menu       // function = onMouseOut callback (required)
      });
     
     $("#log_menu").hoverIntent({
  		sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
  		interval: 50,   // number = milliseconds for onMouseOver polling interval
  		over: show_menu_right,     // function = onMouseOver callback (required)
  		timeout: 300,   // number = milliseconds delay before onMouseOut
  		out: hide_menu      // function = onMouseOut callback (required)
       });
     
     $("#upload_bttn").click(function(){
    	 $(this).css("display","none");
    	 $("#loading_img").css("display","block");
    	 
     });
	 $("#showOverviewImage").click(function(){
		var _height=$(document).height();
		var _width=$(window).width();

		$("#modal_hide").css({'width':_width,'height':_height});




         $('#modal_hide').fadeIn(1000);
         $('#modal_hide').fadeTo("slow",0.8);

         var winH = $(window).height();
         var winW = $(window).width();
		 
		 var id="#overview_image";
		 $("#cross").css('left',winW-20);
		 $(id).css('top',  winH/2-$(id).height()/2);
         $(id).css('left', winW/2-$(id).width()/2);
		
         $(id).fadeIn(2000);
		 $("#cross").css("display","block");


//		$(".maincontent").attr("innerHTML","<div id='overview_image'><img src='images/mca_flow.jpg'></div>");
	});
     $("#cross").click(function(){
			$('#overview_image').fadeOut(800);
			$('#modal_hide').fadeOut(1000);
			$("#cross").css("display","none");
	 });


     $("#reply_message").keyup(function(){
    	 if(this.value.length==1000){
    		 $(this).attr("disabled","disabled");
    		 
    	 }
    	 $("#reply_length").attr("innerHTML","<b>Charactors Left</b>:"+(1000-this.value.length));
    	 
     });
     

	 $(".no_radio_maha").click(function(val){
			var tr_index=$(this).parent("div").parent("td").parent("tr").index();
			//$("#maha_calendar tr:nth-child("+(tr_index+2)+")").css("display","block");
			$("#maha_calendar tr:nth-child("+(tr_index+2)+")").removeClass("displaynone");
	 });
     
     
    
});
//Hide a named menu
function hide_menu(named)
{
	//get the named menu
	var menu_element = document.getElementById(named);
	//hide it with a style attribute
	menu_element.style.display = "none";
}

//end

//added by urvesh 30/03/09 for institute leve;l admission 

function showappbox(val)
{
    document.ila.appid.value = '';
    document.ila.appid.readOnly = false;      //show box for appid     //if not cap candidate then hide appid box
    
    if(val.value == 'C')     //if cap candidate then ask for the application id
    {
        //document.getElementById('capcandlbl').style.display = 'inline';      //show box for appid
        document.ila.appid.value = 'MC10'; 
        document.ila.appid.readOnly = false;      //show box for appid
    }
    else                     //if not
    {
        //document.getElementById('capcandlbl').style.display = 'none';//if not cap candidate then hide appid box
        document.ila.appid.value = '';
        document.ila.appid.readOnly = true;      //show box for appid     //if not cap candidate then hide appid box
        
    }
       //document.myform.subject.readOnly = true;   
}

//FUNCTION FOR THE CAP CANDIDATE INSTITUTE LEVEL ADMISSION FROM VALIDATION 01/04/09

function inst_level_adm()
{
    if(document.capcandform.tfee.value =='')
    {
        alert("Plese enter the Tution fee.For No Fee Enter 0");
        return false;
    }
    if(document.capcandform.dfee.value =='')
    {
        alert("Plese enter the Development fee.For No Fee Enter 0");
        return false;
    }
    if(document.capcandform.ofee.value =='')
    {
        alert("Plese enter the Other fee.For No Fee Enter 0");
        return false;
    }
	 if(document.capcandform.pwd.value =='')
    {
        alert("Plese enter the password");
        return false;
    }
		
    if(document.capcandform.doa.value =='')
    {
        alert("Please Select the Admission Date of the candidate.");
        return false;
    }
    if(document.capcandform.admtype.value == 0)
    {
        alert("Plese select the admission type of the candidate");
        return false;
    }
	 if(document.capcandform.mothertng.value == 0)
    {
        alert("Plese select the Mother Tounge of the candidate");
        return false;
    }
    return true;
}

//FUNCTION FOR THE VALIDATION OF THE ADMISSION CANCELLATION 02/04/09
function inst_level_adm_cancel()
{
    if(document.candcancelform.dedfee.value =='')
    {
        alert("Plese enter the deducted Amount.For No Amount Enter 0");
        return false;
    }
    else if(document.candcancelform.doc.value =='')
    {
        alert("Please Select the Admission Cancellation Date of the candidate.");
        return false;
    }
    
         
/*         var val = document.candcancelform;
         var allval = '';
         for(i = 1; i < val.elements.length-2 ; i++)
         {
             var x=document.getElementsByName();
             alert(x);
             return false;
         allval = allval+\'n' + val.elements[i].name + val.elements[i].value ;
        
        
         }
          alert(allval);  
          return false;     */

    
}


//added by urvesh date 06/04/09 for institute level admission mami candidate validation

function Qualila(pa,pp,pn,up,pm,um)
	{
	
	/////SSC
	if(isEmpty(document.cate.txtE3Obtained))
	   return false;  
	if(isEmpty(document.cate.txtE3OutOf))
	   return false;  
	if(validMarks1(document.cate.txtE3Obtained,document.cate.txtE3OutOf,document.cate.txtE3))   
	   return false; 
		//SSC ENDS

		//SSC MATHS
	if(isEmpty(document.cate.txtE4Obtained))
		return false;  
	if(isEmpty(document.cate.txtE4OutOf))
		return false;  
	if(validMarks1(document.cate.txtE4Obtained,document.cate.txtE4OutOf,document.cate.txtE4))   
		return false;
		//SSC MATHS ENDS
		
		//HSC
	if(isEmpty(document.cate.txtE2Obtained))
		  return false;
	if(isEmpty(document.cate.txtE2OutOf))
		  return false;  
	if(validMarks1(document.cate.txtE2Obtained,document.cate.txtE2OutOf,document.cate.txtE2))   
		  return false; 
		//HSC ENDS

	if(up == true)
		{
		if(isEmptySelect(document.cate.ugfac))
			return false;
		if(isEmpty(document.cate.txtE1Obtained))
		    return false;
		if(isEmpty(document.cate.txtE1OutOf))
		    return false;
		if(validMarks1(document.cate.txtE1Obtained,document.cate.txtE1OutOf,document.cate.txtE1))   
		    return false;
		}

	if(pa == true)
		{
		if(isEmptySelect(document.cate.pgfac))
			return false;
		
		if(up == false)
			{
			alert("You must have to select passed Under Graduation Examination as you selected Post Graduation Examination Appeared");
			return false;
			}
		}

	else if(pp == true)
		{
		if(isEmptySelect(document.cate.pgfac))
			return false;
		if(isEmpty(document.cate.pgObt))
		    return false;
		if(isEmpty(document.cate.pgOutOf))
		    return false;
		if(validMarks1(document.cate.pgObt,document.cate.pgOutOf,document.cate.txtpg))   
		    return false;

		if(up == false)
			{
			alert("You must have to select passed Under Graduation Examination as you selected Post Graduation Examination Passed");
			return false;
			}
		}

	

	if(pp == true && up == true)
		{
		if(document.cate.category.value <= 0)
			{
			if(pm < 45 && um < 45)
				{
				alert("You are not eligible for filling the application form.Aleast one (Under Graduation or Post Graduation ) examination should have more than 45%");
				return false;
				}
			}
		else
			{
			if(pm < 40 && um < 40)
				{
				alert("You are not eligible for filling the application form.Aleast one (Under Graduation or Post Graduation ) examination should have more than 40%");
				return false;
				}
			}
		}
	
	if(pn == true && up == true)
		{
		if(document.cate.category.value <= 0)
			{
			if(um < 45)
				{
				alert("You are not eligible for filling the application form.Under Graduation examination should have more than 45%");
					return false;
				}
			}
		else
			{
			if(um < 40)
				{
				alert("You are not eligible for filling the application form.Under Graduation examination should have more than 40%");
				return false;
				}
			}
		}
	if(document.form1.ugfac.value == 0)
		{
		alert("Please select your Under Graduation Faculty");
			return false;
		}

	//-----------------------------------------//
	

	//alert(document.form1.ugfac.value);
	//return false;

	if(document.cate.ugfac.value != 6 && document.cate.ugfac.value != 19)
		{
		//alert("ok");
		if(isSelectRadio_for3(document.cate.elgMath[0],document.cate.elgMath[1],document.cate.elgMath[2]))
	      return false;
		if(document.cate.mathssub.value == "")
			{
			alert("Please Enter the Mathematics Subject Name");
			return false;
			}
		}
	
	if((document.cate.ugfac.value != 6 ||  document.cate.ugfac.value != 19 ) && document.cate.elgMath[2].checked == true)
		{
		alert("You are not eligible as you have not selected 10+2 or Higher level Mathematics or statistic condition");
		return false;
		}
	return true;
	}



function mathselgila(sel)
	{
	if(document.cate.fac.value != 6 && sel.value == 0)
		{
		alert("Candidate must have Pass the Mathematics or statistic as one of the subject at 10+2 or at higher level.Except BCA Faculty student.");
		return false;
		}
	else 
		
		return true;
	}

function ismhcand(val)
{
	document.getElementById('onlyformh').style.display = 'none';
	if(val.value < 6)
		document.getElementById('onlyformh').style.display = 'inline';
	else
		document.getElementById('onlyformh').style.display = 'none';

	return true;
}

function copy_textTotext_new()
{
	var btn = valButton(document.cate.same);

	document.cate.Addressp.value = "";
	document.cate.Pincodep.value = "";
	document.cate.cmbstate.value = "";

	if (btn == 'Y') 
	{
		document.cate.Addressp.value = document.cate.Addressm.value
		document.cate.Pincodep.value = document.cate.Pincodem.value
		document.cate.cmbstate.value = document.cate.cmbstatec.value
	}
	else if (btn == 'N') 
	{
		document.cate.Addressp.value = "";
		document.cate.Pincodep.value = "";
		document.cate.cmbstate.value = "";
	}
}	

function copy_textTotext()
{
	var btn = valButton(document.form1.same);

	document.form1.Addressp.value = "";
	document.form1.Pincodep.value = "";
	document.form1.cmbstate.value = "";

	if (btn == 'Y') 
	{
		document.form1.Addressp.value = document.form1.Addressm.value
		document.form1.Pincodep.value = document.form1.Pincodem.value
		document.form1.cmbstate.value = document.form1.cmbstatec.value
	}
	else if (btn == 'N') 
	{
		document.form1.Addressp.value = "";
		document.form1.Pincodep.value = "";
		document.form1.cmbstate.value = "";
	}
}	

//URVESH 07/04/2009 For Institute Level Admission 

function ilafacselect(fac)	// FUNCTION FOR MATHS SUBJECT AND LEVEL OF MATHS
{
	if(fac.value != 4 && fac.value != 6 && fac.value != 19)
	{	
		document.cate.elgMath[0].disabled=false;
		document.cate.elgMath[1].disabled=false;
		document.cate.elgMath[2].disabled=false;
		document.cate.mathssub.readOnly = false;
	}
	else
	{
		document.cate.elgMath[0].disabled=true;
		document.cate.elgMath[1].disabled=true;
		document.cate.elgMath[2].disabled=true;
		document.cate.mathssub.readOnly = true;
	}
}

function ilaval(pa,pp,pn,up,pm,um)
{
	if(document.cate.seatno.value == '')
	{
		alert("Please Enter the Mami Candidate Seat No.");
		return false;
	}
	if(document.cate.ctype.value == "0")
	{
		alert("Please Select The Candidature Type");
		return false;
	}
	if(document.cate.ctype.value < 6)
	{
		if(document.cate.maincate.value == 0)
		{
			alert("Select your specific category");   
			document.cate.maincate.focus();
			return false;
		}
	
		if(document.cate.maincate.value != "09")//Reserved category cases start from here
		{
			if(document.cate.subcate.value == '')
			{
				alert("Select your Caste");   
				document.cate.subcate.focus();
				return false;
			}
			if(document.cate.subcate.value < 742 && document.cate.subcate.value > 733 && document.cate.othersrno.value == "")
			{
				alert("Fill your Caste Sr. No.");   
				return false;
			}
			if(document.cate.subcate.value < 742 && document.cate.subcate.value > 733 && document.cate.othercaste.value == "")
			{
				alert("Fill your Caste Name.");   
				return false;
			}
		}
		
		if(document.cate.seldist.value == 0)
		{
			alert("Select your District.");
			document.cate.seldist.focus();
			return false;
		}
		if(document.cate.radioPH[0].checked==false && document.cate.radioPH[1].checked==false)
		{
			alert("Please Select Physical Handicap Yes or No ?");
			document.cate.radioPH[0].focus();
			return false;
		}
		if(document.cate.radioPH[0].checked==true)
		{	
			if(document.cate.chkPH[0].checked==false && document.cate.chkPH[1].checked==false && document.cate.chkPH[2].checked==false)
			{
				alert("Please Select Physical Handicap type");
				//document.cate.radioPH[0].focus();
				return false;
			}
		}
		//if(isSelectRadio_for2(document.cate.radioPH[0],document.cate.radioPH[1]))
		//	 return false;
		//if(isSelectRadio_for3(document.cate.chkPH[0],document.cate.chkPH[1],
		//	document.cate.chkPH[2]))
			//return false;

	}


	if(document.cate.Name.value =='' || document.cate.Name.value ==null)
	{
		alert("Please Enter Name");
		document.cate.Name.focus();
		return false;
	}
	//if(FullName(document.cate.Name))
     //  return false;
	if(document.cate.Name.value.length < 3)
   	{
		alert("Enter your Valid Full Name");
		return false;
	}
	if(document.cate.Addressm.value=="")
	{	
		alert("Please enter Correspondence Address");
		return false;
	}
	if(document.cate.Addressm.value.length < 4)
   		{
		alert("Address should Be Minimum Four(4) Character Long");
		return false;
		} 
	if(document.cate.Pincodem.value=="")
	{
		alert("Please enter pin code");
	   return false;
	}
	if(ValidPincode(document.cate.Pincodem))   
	   return false;

	if(document.cate.cmbstatec.value=="")
	{
		alert("Please select State");
	   return false;
	}
	if(document.cate.Addressp.value=="")
	{
		alert("Please enter Address");
	   return false;
	}
	if(document.cate.Addressp.value.length < 4)
   		{
		alert("Address should Be Minimum Four(4) Character Long");
		return false;
		} 
	if(document.cate.Pincodep.value=="")
	{
	   alert("Please enter pin code");
	   return false;
	}
    if(ValidPincode(document.cate.Pincodep))   
	   return false;
	
	if(document.cate.cmbstate.value=="")
	{
		alert("Please select the Perment state");
	   return false;
	}

	if(document.cate.gender.value=="")
	{
	   alert("please Select Gender");
	   return false;
	}
	if(document.cate.email.value =="")
	{
		alert("Please Enter email-Address");
		return false;
	}
	if(document.cate.email.value !="")
	{
		if(validEmail(document.cate.email))
		{
			alert("Please enter valid email");
			return false;
		}
	}
	if(document.cate.dob.value == "")
		{
		alert("Please select the Date of birth");
			return false;
		}
	if(document.cate.cmbrel.value=="")
	{	
		alert("Please Select Religion");
	   return false;
	}
	if(isEmpty(document.cate.Income))
	{
		alert("Please Family Income");
	  	return false;
	}
	if(document.cate.txtE3Obtained.value=="")
	{
		alert("Please Enter SSC Marks Obtained");
	   return false; 
	}
	if(document.cate.txtE3OutOf.value=="")
	{
		alert("Please Enter SSC Marks Out of");
	   return false;  
	}
	if(validMarks1(document.cate.txtE3Obtained,document.cate.txtE3OutOf,document.cate.txtE3))   
	   return false; 
		//SSC ENDS

		//SSC MATHS
	if(document.cate.txtE4Obtained.value=="")
	{
		alert("Please Enter SSC Math Marks Obtained");
		return false;  
	}
	if(document.cate.txtE4OutOf.value=="")
	{
		alert("Please Enter SSC Math Marks out of");
		return false;  
	}
	if(validMarks1(document.cate.txtE4Obtained,document.cate.txtE4OutOf,document.cate.txtE4))   
		return false;
		//SSC MATHS ENDS
		
		//HSC
	if(document.cate.txtE2Obtained.value=="")
	{
		  alert("Please Enter HSC Marks Obtained");
		  return false;
	}
	if(document.cate.txtE2OutOf.value=="")
		{
		  alert("Please Enter HSC Marks Obtained");
		  return false;
		}
	if(validMarks1(document.cate.txtE2Obtained,document.cate.txtE2OutOf,document.cate.txtE2))   
		  return false; 
		//HSC ENDS

	if(up == true)
		{
		if(document.cate.ugfac.value=="")
			{
			alert("Please select U.G. Faculty");
			return false;
			}
		if(isEmpty(document.cate.txtE1Obtained))
			{
			alert(" Please Enter Under Graduation Examination marks");
		    return false;
			}
		if(isEmpty(document.cate.txtE1OutOf))
		    return false;
		if(validMarks1(document.cate.txtE1Obtained,document.cate.txtE1OutOf,document.cate.txtE1))   
		    return false;
		}

	if(pa == true)
		{
		if(isEmptySelect(document.cate.pgfac))
			return false;
		
		if(up == false)
			{
			alert("You must have to select passed Under Graduation Examination as you selected Post Graduation Examination Appeared");
			return false;
			}
		}

	else if(pp == true)
		{
		if(isEmptySelect(document.cate.pgfac))
			return false;
		if(isEmpty(document.cate.pgObt))
		    return false;
		if(isEmpty(document.cate.pgOutOf))
		    return false;
		if(validMarks1(document.cate.pgObt,document.cate.pgOutOf,document.cate.txtpg))   
		    return false;

		if(up == false)
			{
			alert("You must have to select passed Under Graduation Examination as you selected Post Graduation Examination Passed");
			return false;
			}
		}

	

	if(pp == true && up == true)
	{
		if(document.cate.maincate.value = 0 || document.cate.maincate.value == '' || document.cate.maincate.value == null)
			{
			if(pm < 45 && um < 45)
				{
				alert("You are not eligible for filling the application form.Aleast one (Under Graduation or Post Graduation ) examination should have more than 45%");
				return false;
				}
			}
		else
			{
			if(pm < 40 && um < 40)
				{
				alert("You are not eligible for filling the application form.Aleast one (Under Graduation or Post Graduation ) examination should have more than 40%");
				return false;
				}
			}
		}
	
	if(pn == true && up == true)
		{
		if(document.cate.maincate.value = 0 || document.cate.maincate.value == '' || document.cate.maincate.value == null)
			{
			if(um < 45)
				{
				alert("You are not eligible for filling the application form.Under Graduation examination should have more than 45%");
					return false;
				}
			}
		else
			{
			if(um < 40)
				{
				alert("You are not eligible for filling the application form.Under Graduation examination should have more than 40%");
				return false;
				}
			}
		}
	if(document.cate.ugfac.value == 0)
		{
		alert("Please select your Under Graduation Faculty");
			return false;
		}

	//-----------------------------------------//
	

	//alert(document.form1.ugfac.value);
	//return false;

	if(document.cate.ugfac.value != 6 && document.cate.ugfac.value != 19)
		{
		//alert("ok");
		if(isSelectRadio_for3(document.cate.elgMath[0],document.cate.elgMath[1],document.cate.elgMath[2]))
	      return false;
		if(document.cate.mathssub.value == "")
			{
			alert("Please Enter the Mathematics Subject Name");
			return false;
			}
		}
	
	if((document.cate.ugfac.value != 6 ||  document.cate.ugfac.value != 19 ) && document.cate.elgMath[2].checked == true)
		{
		alert("You are not eligible as you have not selected 10+2 or Higher level Mathematics or statistic condition");
		return false;
		}

	if(document.cate.tfee.value =='')
    {
        alert("Plese enter the Tution fee.For No Fee Enter 0");
        return false;
    }
    if(document.cate.dfee.value =='')
    {
        alert("Plese enter the Development fee.For No Fee Enter 0");
        return false;
    }
    if(document.cate.ofee.value =='')
    {
        alert("Plese enter the Other fee.For No Fee Enter 0");
        return false;
    }
    if(document.cate.doa.value =='')
    {
        alert("Please Select the Admission Date of the candidate.");
        return false;
    }
    if(document.cate.admtype.value == 0)
    {
        alert("Please select the admission type of the candidate");
        return false;
    }

	 if(document.cate.mothertng.value == 0)
    {
        alert("Plese select the Mother Tounge of the candidate");
        return false;
    }
	/*if(document.cate.pwd.value == '')
    {
        alert("Please Enter The Password.");
        return false;
    }
	if(document.cate.cpwd.value == '')
    {
        alert("Confirm Password ShouldNot Be Blank.");
        return false;
    }
	if(document.cate.pwd.value != document.cate.cpwd.value)
	{
		alert("Confirm Password must be same as the Passowrd.");
        return false;
	}
	if(document.cate.sques.value == "0")
	{
		alert("Please Select The Sequrity Question.");
        return false;
	}
	if(document.cate.ans.value == "0")
	{
		alert("Please Enter the Answer for your Sequrity Question.");
        return false;
	}
*/
return true;
    
}
function isSelectRadio_for3(radio1,radio2,radio3,radio4)
{   
    if(!(radio1.disabled))
	{
         if(radio1.checked == false && radio2.checked == false && radio3.checked == false && radio4.checked == false)
	    {
	         alert(" Please select the "+radio1.id);
		     radio1.focus();
		     return true;
    	}
	}
 return false;
}
//added on 15/04/09

function chkcandtype()
{
	var form = document.getElementsByTagName("form"); 
	var formname = form[0].name;

	if(formname == 'candtype')
	{
		var precate = document.candtype.precate.value;
		var currtype = document.candtype.type[5].checked;
		var prerecept = document.candtype.recepttype.value;

		if(precate > 0 && currtype == true && prerecept == 'MCR')
		{
			alert("You are Converting Maharashtra Type Category Candidate to OMS.\n Hence need to collect the 200 Rs. in Cash and then confirm candidate");
			var agree=confirm("Click Ok, if you are sure that you want to do this conversion. \n\t Collect the 200 Rs. \n\t And provide the receipt to the candidate.");
			if (!agree)
				return false;
			else  
				return true;
		}
	}
	else if(formname == 'cate')
	{
		var prerecept = document.cate.recepttype.value;
		var precate = document.cate.precate.value;
		var currcate = document.cate.maincate.value;
		
		if(precate > 0 && currcate == 9 && prerecept == 'MCR')
		{
			alert("You are Converting Maharashtra Type Category Candidate to Maharashtra type OPEN.\n Hence need to collect the 200 Rs. in Cash and then confirm candidate");
			var agree=confirm("Click Ok, if you are sure that you want to do this conversion. \n\t Collect the 200 Rs. \n\t And provide the receipt to the candidate.");
			if (!agree)
				return false;
			else  
				return true;
		}
	}
  return true;
}

//END here

function docsrequired(finaltype,maincate,phtype,faculty,ugstatus,pgstatus)
{
	
	if(document.docsverify.doc1[0].checked == false)
	{
		alert("Candidate is not eligible as he does not have Certification of Indian Nationality in the name of Candidate.");
		return false;
	}
	if(document.docsverify.doc2[0].checked == false)
	{
		alert("Candidate is not eligible as he does not have Statement of marks of S.S.C. or Equivalent Examination.");
		return false;
	}
	if(document.docsverify.doc3[0].checked == false)
	{
		alert("Candidate is not eligible as he does not have Postal Receipt of payment made at Post Office.");
		return false;
	}
	if(document.docsverify.doc4[0].checked == false)
	{
		alert("Candidate is not eligible as he does not have Statement of marks of HSC or Equivalent Examination.");
		return false;
	}
	if(ugstatus == 'P')
	{
		if(document.docsverify.doc5[0].checked == false)
		{
		alert("Candidate is not eligible as he does not have Under Graduation Examination Marksheet.");
		return false;
		}
	}
	if(pgstatus == 'P')
	{
		if(document.docsverify.doc6[0].checked == false)
		{
		alert("Candidate is not eligible as he does not have Post Graduation Examination Marksheet.");
		return false;
		}
	}
	if(faculty != 6 && faculty != 19)
	{
		if(document.docsverify.doc7[0].checked == false)
		{
		alert("Candidate is not eligible as he does not have Candidate Must have studied Mathematics or Statistics as one of subject at 10+2 or higher level of Examination (BCA,BSC(Computer/IT),BCS exempted).");
		return false;
		}
	}
	if(finaltype == 2)
	{
		if(document.docsverify.doc8[0].checked == false)
		{
		//alert("Candidate is not eligible as he does not have Domicile Certiificate clearly indicating the place of permanent residence of Candidate /Father / Mother or Husband.");
		alert("You Have to Convert Candidate in OMS type as Candidate does not have required Domicile Certificate.");
		return false;
		}
	}
	if(finaltype == 3)
	{
		if(document.docsverify.doc9[0].checked == false)
		{
		//alert("Candidate is not eligible as he does not have Certificate in the proforma D regarding the employment status of themselves / Father/ Mother accompanied by attested copy of transfer order and joining report.");
		alert("You Have to Convert Candidate in OMS type as Candidate does not have required Certificate in the proforma D.");
		return false;
		}
	}
	if(finaltype == 4 || finaltype == 5)
	{
		if(document.docsverify.doc10[0].checked == false)
		{
		//alert("Candidate is not eligible as he does not have Certificate in the proforma E regarding the employment status of themselves / Father/ Mother accompanied by attested copy of transfer order and joining report");
		alert("You Have to Convert Candidate in OMS type as Candidate does not have required Certificate in the proforma E.");
		return false;
		}
	}

	if(maincate != 9)
	{
		//COMMENTED AS FROFORMA H INSTEAD OF CASTE VALIDITY CERTIFICATE 26 MAY 2009 8:31 AM
		/*if( maincate != 2)
		{
			if(document.docsverify.doc14[0].checked == false)
			{
				//alert("Candidate is not eligible as he does not have Caste Validity Certificate issued by Scrutiny Committee of Social Welfare Department / OR Undertaking in Proforma-H .");
				alert("You have to convert candidate in the OPEN category as he does not have Caste Validity Certificate.");
				return false;
			}
		}
		if(maincate == 2)
		{
			if(document.docsverify.doc15[0].checked == false )
			{
				//alert("Candidate is not eligible as he does not have Tribe Validity Certificate issued by Scrutiny Committee of Tribal Department / OR Undertaking in Proforma-H .");
				alert("You have to convert candidate in the OPEN category as he does not have Tribe Validity Certificate.");
				return false;
			}
		}*/

		if( maincate != 2)
        {
			if(document.docsverify.doc14[0].checked == false && document.docsverify.doc13[0].checked == false)
            {
				alert("You have to convert candidate in the OPEN category as he does not have Caste Validity Certificate and Caste Certificate.");
                return false;
            }
         }
         if(maincate == 2)
         {
			if(document.docsverify.doc15[0].checked == false && document.docsverify.doc13[0].checked == false)
            {
				alert("You have to convert candidate in the OPEN category as he does not have Tribe Validity Certificate and Caste Certificate.");
                return false;
            }
		 }

		//TILL HERE
		if(maincate != 1 && maincate != 2)
		{
			if(document.docsverify.doc16[0].checked == false)
			{
				//alert("Candidate is not eligible as he does not have Non Creamy layer Certificate issued by Sub Divisional Officer / Deputy Collector of the district Valid upto 31st March 2010.");
				alert("You have to convert candidate in the OPEN category as he does not have Non Creamy layer Certificate.");
				return false;
			}
		}
	}
	if(phtype == 1 || phtype == 2 || phtype == 3)
	{
		if(document.docsverify.doc17[0].checked == false)
		{
			//alert("Candidate is not eligible as he does not have Certificate in the prescribed proforma F from the Director, All India Institute of Physically Handicapped, Mumbai or Civil Surgeon, of the Government / CIVIL HOSPITALS normally located at the District Headquarters regarding his or her physical disability, and ability to undergo all parts of syllabus for the normal course.");
			alert("Candidate will be consider as the NON-PH as he does not have Certificate in the prescribed proforma F.Change the candidate From PH to NON-PH");
			return false;
		}
	}
	if(phtype == 3)
	{
		if(document.docsverify.doc18[0].checked == false)
		{
			//alert("Candidate is not eligible as he does not have Proforma F-1.");
			alert("Candidate will be consider as the NON-PH as he does not have Proforma F-1.Change the candidate From PH to NON-PH");
			return false;
		}
	}
	
	var agree=confirm("Are You Sure that you want to proceed?.");
	if (!agree)
		return false;
	
	return true;
}



function pdetails_cand()
{
	if(isEmpty(document.form1.Addressm))
	   return false;

	if(document.form1.Addressm.value.length < 4)
   	{
		alert("Address should Be Minimum Four(4) Character Long");
		return false;
	} 
	if(isEmpty(document.form1.Pincodem))
	   return false;
    if(ValidPincode(document.form1.Pincodem))   
	   return false;
	if(document.form1.email.value !="")
	{
		if(validEmail(document.form1.email))
		return false;
	}
	if(isEmptySelect(document.form1.cmbrel))
	   return false;
	
	if(isEmpty(document.form1.Income))
	  	return false;

	return true;
}


//FOR OPTION FORM JS 22/04/09

function is_optlimit_max(max)
{
	myval="" 
	re=/,$/ // Use regular expression to remove comma from last value added to text box 
	var cnt = 0;
	for(i=0;i<myform.ckb.length;i++) 
	{ 
		if(myform.ckb[i].checked) 
		{
			myval+=myform.ckb[i].value+","
			cnt ++;
		} 
	} 
	if(cnt > document.myform.optlimit.value)
	{
		alert("Maximum options limit reached.You can fill maximum " + document.myform.optlimit.value + " options only");
		return false;
	}
return true;
}


//ADDEDD ON 24/03/09 FOR OPTION FORM MOVE OPTIONS UP AND DOWN LEFT TO RIGHT SELECT ALL REMOVE ALL FUNCTIONS

// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. 
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================

// HISTORY
// ------------------------------------------------------------------
// April 20, 2005: Fixed the removeSelectedOptions() function to 
//                 correctly handle single selects
// June 12, 2003: Modified up and down functions to support more than
//                one selected option
/*
DESCRIPTION: These are general functions to deal with and manipulate
select boxes. Also see the OptionTransfer library to more easily 
handle transferring options between two lists

COMPATABILITY: These are fairly basic functions - they should work on
all browsers that support Javascript.
*/


// -------------------------------------------------------------------
// hasOptions(obj)
//  Utility function to determine if a select object has an options array
// -------------------------------------------------------------------
function hasOptions(obj) {
	if (obj!=null && obj.options!=null) { return true; }
	return false;
	}

// -------------------------------------------------------------------
// selectUnselectMatchingOptions(select_object,regex,select/unselect,true/false)
//  This is a general function used by the select functions below, to
//  avoid code duplication
// -------------------------------------------------------------------
function selectUnselectMatchingOptions(obj,regex,which,only) {
	if (window.RegExp) {
		if (which == "select") {
			var selected1=true;
			var selected2=false;
			}
		else if (which == "unselect") {
			var selected1=false;
			var selected2=true;
			}
		else {
			return;
			}
		var re = new RegExp(regex);
		if (!hasOptions(obj)) { return; }
		for (var i=0; i<obj.options.length; i++) {
			if (re.test(obj.options[i].text)) {
				obj.options[i].selected = selected1;
				}
			else {
				if (only == true) {
					obj.options[i].selected = selected2;
					}
				}
			}
		}
	}
		
// -------------------------------------------------------------------
// selectMatchingOptions(select_object,regex)
//  This function selects all options that match the regular expression
//  passed in. Currently-selected options will not be changed.
// -------------------------------------------------------------------
function selectMatchingOptions(obj,regex) {
	selectUnselectMatchingOptions(obj,regex,"select",false);
	}
// -------------------------------------------------------------------
// selectOnlyMatchingOptions(select_object,regex)
//  This function selects all options that match the regular expression
//  passed in. Selected options that don't match will be un-selected.
// -------------------------------------------------------------------
function selectOnlyMatchingOptions(obj,regex) {
	selectUnselectMatchingOptions(obj,regex,"select",true);
	}
// -------------------------------------------------------------------
// unSelectMatchingOptions(select_object,regex)
//  This function Unselects all options that match the regular expression
//  passed in. 
// -------------------------------------------------------------------
function unSelectMatchingOptions(obj,regex) {
	selectUnselectMatchingOptions(obj,regex,"unselect",false);
	}
	
// -------------------------------------------------------------------
// sortSelect(select_object)
//   Pass this function a SELECT object and the options will be sorted
//   by their text (display) values
// -------------------------------------------------------------------
function sortSelect(obj) {
	var o = new Array();
	if (!hasOptions(obj)) { return; }
	for (var i=0; i<obj.options.length; i++) {
		o[o.length] = new Option( obj.options[i].text, obj.options[i].value, obj.options[i].defaultSelected, obj.options[i].selected) ;
		}
	if (o.length==0) { return; }
	o = o.sort( 
		function(a,b) { 
			if ((a.text+"") < (b.text+"")) { return -1; }
			if ((a.text+"") > (b.text+"")) { return 1; }
			return 0;
			} 
		);

	for (var i=0; i<o.length; i++) {
		obj.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
		}
	}

// -------------------------------------------------------------------
// selectAllOptions(select_object)
//  This function takes a select box and selects all options (in a 
//  multiple select object). This is used when passing values between
//  two select boxes. Select all options in the right box before 
//  submitting the form so the values will be sent to the server.
// -------------------------------------------------------------------
function selectAllOptions(obj) {
	if (!hasOptions(obj)) { return; }
	for (var i=0; i<obj.options.length; i++) {
		obj.options[i].selected = true;
		}
	}
	
// -------------------------------------------------------------------
// moveSelectedOptions(select_object,select_object[,autosort(true/false)[,regex]])
//  This function moves options between select boxes. Works best with
//  multi-select boxes to create the common Windows control effect.
//  Passes all selected values from the first object to the second
//  object and re-sorts each box.
//  If a third argument of 'false' is passed, then the lists are not
//  sorted after the move.
//  If a fourth string argument is passed, this will function as a
//  Regular Expression to match against the TEXT or the options. If 
//  the text of an option matches the pattern, it will NOT be moved.
//  It will be treated as an unmoveable option.
//  You can also put this into the <SELECT> object as follows:
//    onDblClick="moveSelectedOptions(this,this.form.target)
//  This way, when the user double-clicks on a value in one box, it
//  will be transferred to the other (in browsers that support the 
//  onDblClick() event handler).
// -------------------------------------------------------------------
function moveSelectedOptions(from,to) {
	// Unselect matching options, if required
	if (arguments.length>3) {
		var regex = arguments[3];
		if (regex != "") {
			unSelectMatchingOptions(from,regex);
			}
		}
	// Move them over
	if (!hasOptions(from)) { return; }
	for (var i=0; i<from.options.length; i++) {
		var o = from.options[i];
		if (o.selected) {
			if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
			to.options[index] = new Option( o.text, o.value, false, false);
			}
		}
	// Delete them from original
	for (var i=(from.options.length-1); i>=0; i--) {
		var o = from.options[i];
		if (o.selected) {
			from.options[i] = null;
			}
		}
	if ((arguments.length<3) || (arguments[2]==true)) {
		sortSelect(from);
		sortSelect(to);
		}
	from.selectedIndex = -1;
	to.selectedIndex = -1;
	}

// -------------------------------------------------------------------
// copySelectedOptions(select_object,select_object[,autosort(true/false)])
//  This function copies options between select boxes instead of 
//  moving items. Duplicates in the target list are not allowed.
// -------------------------------------------------------------------
function copySelectedOptions(from,to) {
	var options = new Object();
	if (hasOptions(to)) {
		for (var i=0; i<to.options.length; i++) {
			options[to.options[i].value] = to.options[i].text;
			}
		}
	if (!hasOptions(from)) { return; }
	for (var i=0; i<from.options.length; i++) {
		var o = from.options[i];
		if (o.selected) {
			if (options[o.value] == null || options[o.value] == "undefined" || options[o.value]!=o.text) {
				if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }
				to.options[index] = new Option( o.text, o.value, false, false);
				}
			}
		}
	if ((arguments.length<3) || (arguments[2]==true)) {
		sortSelect(to);
		}
	from.selectedIndex = -1;
	to.selectedIndex = -1;
	}

// -------------------------------------------------------------------
// moveAllOptions(select_object,select_object[,autosort(true/false)[,regex]])
//  Move all options from one select box to another.
// -------------------------------------------------------------------
function moveAllOptions(from,to) {
	selectAllOptions(from);
	if (arguments.length==2) {
		moveSelectedOptions(from,to);
		}
	else if (arguments.length==3) {
		moveSelectedOptions(from,to,arguments[2]);
		}
	else if (arguments.length==4) {
		moveSelectedOptions(from,to,arguments[2],arguments[3]);
		}
	}

// -------------------------------------------------------------------
// copyAllOptions(select_object,select_object[,autosort(true/false)])
//  Copy all options from one select box to another, instead of
//  removing items. Duplicates in the target list are not allowed.
// -------------------------------------------------------------------
function copyAllOptions(from,to) {
	selectAllOptions(from);
	if (arguments.length==2) {
		copySelectedOptions(from,to);
		}
	else if (arguments.length==3) {
		copySelectedOptions(from,to,arguments[2]);
		}
	}

// -------------------------------------------------------------------
// swapOptions(select_object,option1,option2)
//  Swap positions of two options in a select list
// -------------------------------------------------------------------
function swapOptions(obj,i,j) {
	var o = obj.options;
	var i_selected = o[i].selected;
	var j_selected = o[j].selected;
	var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
	var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);
	o[i] = temp2;
	o[j] = temp;
	o[i].selected = j_selected;
	o[j].selected = i_selected;
	}
	
// -------------------------------------------------------------------
// moveOptionUp(select_object)
//  Move selected option in a select list up one
// -------------------------------------------------------------------
function moveOptionUp(obj) {
	if (!hasOptions(obj)) { return; }
	for (i=0; i<obj.options.length; i++) {
		if (obj.options[i].selected) {
			if (i != 0 && !obj.options[i-1].selected) {
				swapOptions(obj,i,i-1);
				obj.options[i-1].selected = true;
				}
			}
		}
	}

// -------------------------------------------------------------------
// moveOptionDown(select_object)
//  Move selected option in a select list down one
// -------------------------------------------------------------------
function moveOptionDown(obj) {
	if (!hasOptions(obj)) { return; }
	for (i=obj.options.length-1; i>=0; i--) {
		if (obj.options[i].selected) {
			if (i != (obj.options.length-1) && ! obj.options[i+1].selected) {
				swapOptions(obj,i,i+1);
				obj.options[i+1].selected = true;
				}
			}
		}
	}

// -------------------------------------------------------------------
// removeSelectedOptions(select_object)
//  Remove all selected options from a list
//  (Thanks to Gene Ninestein)
// -------------------------------------------------------------------
function removeSelectedOptions(from) { 
	if (!hasOptions(from)) { return; }
	if (from.type=="select-one") {
		from.options[from.selectedIndex] = null;
		}
	else {
		for (var i=(from.options.length-1); i>=0; i--) { 
			var o=from.options[i]; 
			if (o.selected) { 
				from.options[i] = null; 
				} 
			}
		}
	from.selectedIndex = -1; 
	} 

// -------------------------------------------------------------------
// removeAllOptions(select_object)
//  Remove all options from a list
// -------------------------------------------------------------------
function removeAllOptions(from) { 
	if (!hasOptions(from)) { return; }
	for (var i=(from.options.length-1); i>=0; i--) { 
		from.options[i] = null; 
		} 
	from.selectedIndex = -1; 
	} 

// -------------------------------------------------------------------
// addOption(select_object,display_text,value,selected)
//  Add an option to a list
// -------------------------------------------------------------------
function addOption(obj,text,value,selected) {
	if (obj!=null && obj.options!=null) {
		obj.options[obj.options.length] = new Option(text, value, false, selected);
		}
	}

//END HERE



function ug(us,ugmobt,ugmout,ugper)
{	
	if(us == true)
	{
		if(isEmpty(document.fill_opt.txtE1Obtained))
		{
			alert("Please Enter Proper Marks");
			document.fill_opt.txtE1Obtained.focus();
			 return false;
		}
		   
		if(isEmpty(document.fill_opt.txtE1OutOf))
		{
			alert("Please Enter Proper Marks");
			document.fill_opt.txtE1OutOf.focus();
			return false;
		}
		if(document.fill_opt.category.value <= 0)
		{
			if(ugper < 45)
			{
				alert("You are not eligible for filling the application form.Under Graduation examination should have more than 45%");
				return false;
			}
		}
		else if(document.fill_opt.category.value > 0)
		{
			if(ugper < 40)
			{
				alert("You are not eligible for filling the application form.Under Graduation examination should have more than 45%");
				return false;
			}
		}
	}
	return true;
}


function pg(psp,psn,pgmobt,pgmout,pgper)
{
	if(psn == true)
	{
		if(document.fill_opt.category.value <= 0)
		{
			if(document.fill_opt.ugper.value < 45)
			{
				alert("You are not eligible for filling the application form.Aleast one (Under Graduation or Post Graduation ) examination should have more than 45%");
				return false;
			}
		}
		else if(document.fill_opt.category.value > 0)
		{
			if(document.fill_opt.ugper.value < 40)
			{
				alert("You are not eligible for filling the application form.Aleast one (Under Graduation or Post Graduation ) examination should have more than 45%");
				return false;
			}
		}
	}
	else if(psp == true)
	{
		if(isEmpty(document.fill_opt.pgObt))
		    return false;
		if(isEmpty(document.fill_opt.pgOutOf))
		    return false;
		if(validMarks1(document.fill_opt.pgObt,document.fill_opt.pgOutOf,document.fill_opt.txtpg))   
		    return false;

		if(document.fill_opt.category.value <= 0)
		{
			if(document.fill_opt.ugper.value < 45 && pgper < 45)
			{
				alert("You are not eligible for filling the application form.Aleast one (Under Graduation or Post Graduation ) examination should have more than 45%");
				return false;
			}
		}
		else if(document.fill_opt.category.value > 0)
		{
			if(document.fill_opt.ugper.value < 40 && pgper < 40)
			{
				alert("You are not eligible for filling the application form.Aleast one (Under Graduation or Post Graduation ) examination should have more than 40%");
				return false;
			}
		}
	}
	return true;
}

function validpwd() 
{
	if(document.opt_second.pwd.value == '')
	{
		alert("Please Enter the Valid Password.");
		return false;
	}

	var agree=confirm("Are You Sure that you want to proceed?.");
	if (!agree)
		return false;
	
	return true;
 }

 function pgEnableDisbleTextBox_opt(arg,ObtText,OutOfText,PerText)
{
	if(arg.value == 'N')
	{
		ObtText.disabled = true;
		OutOfText.disabled = true;
		ObtText.value ="";
		OutOfText.value ="";
		PerText.value = "";
	}
	else if(arg.value == 'A')
	{
		ObtText.disabled = true;
		OutOfText.disabled = true;
		ObtText.value ="";
		OutOfText.value ="";
		PerText.value = "";
	}
	else
	{
		ObtText.disabled = false;
		OutOfText.disabled = false;
	}
}

function disableFormbyid(id)
{
	document.getElementById(id).style.display = "none";
	return true;
}

function validEmail(c)
{  
 Email= /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
 if(!Email.test(c.value))
 {
 //	alert("Invalid Email ID");
	c.focus();
	return true;
 }
 else
 return false; 
}

function isEmpty(c)								//ISEMPTY
{

  if(c.disabled == false)
  {
	if(c.value == "" || c.value == " " || c.value == 0 || c.value == null)
  	{ 
    	   return true;
    }
  }
  else
     return false;
}

function IsNumber(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


