

/*
// for login moduel

function Check()
{
var myForm = document.loginpage;
 return(checkNull(myForm.uid,"Username") &&checkNull(myForm.password,"Password") );
}

function Checkphoto()
{
var myForm = document.calform;
return (checkOpt(myForm.type,"Type") && checkimage(myForm.file,"Image"));
}
function Checkeditphoto()
{
var myForm = document.calform;
return (checkOpt(myForm.type,"Type") && checkpicture());
}


function Checkadd()
{
var myForm = document.calform;
 return(checkOpt(myForm.rtype,"Report Type") &&checkOpt(myForm.type,"Type") && checkCmb(myForm.fmonth,"From Month") && checkCmb(myForm.fyear,"From Year") && checkNull(myForm.tmonth,"To Month") && checkCmb(myForm.tyear,"To Year") && checkpdf(document.getElementById('file').value));
}

function Checkjournal()
{
var myForm = document.calform;
 return(checkOpt(myForm.rtype,"Report Type") &&checkOpt(myForm.type,"Type") && checkCmb(myForm.fmonth,"From Month") && checkCmb(myForm.fyear,"From Year") && checkNull(myForm.tmonth,"To Month") && checkCmb(myForm.tyear,"To Year") && checkeditpdf());
}



function Checkform()
{
var myForm = document.calform;
return (checkNull(myForm.name,"Name") && checkOpt(myForm.rtype,"Relation") && checkNull(myForm.rname,"Relation Name") && checkNull(myForm.address1,"Address1") && checkCmb(myForm.state,"State") && checkCmb(myForm.city,"City") && checkNull(myForm.pincode,"Pin Code") && checkZipcode(myForm.pincode,"Pin Code") && checkNull(myForm.datebox,"Date") && checkNull(myForm.member,"Member No.") && checkNull(myForm.branch,"Branch") && checkNull(myForm.ward,"Ward") && checkCmb(myForm.district,"District") && checkCmb(myForm.statename,"State Name") && checkNull(myForm.designation,"Designation") && checkpicture() && checkphone() && checkmobile());
}


//insert file tag 
function attachtype(a)
{
if(a==1)
document.getElementById('innertype').innerHTML="<input type='radio' name='type' id='type1' value='Pudiya Pavai'>Pudiya Pavai<input type='radio' name='type' id='type2' value='Pudiya Velicham'>Pudiya Velicham";
else
document.getElementById('innertype').innerHTML="<input type='radio' name='type' id='type1' value='Annual Review'>Annual Review<input type='radio' name='type' id='type2' value='Annual Expanding'>Annual Expanding";
document.getElementById('innerlabel').innerHTML="Type<font color='red'>*</font>";
}

function attachrelation(a)
{
if(a==1)
document.getElementById('innerlabel').innerHTML="Husband Name<font color='red'>*</font>";
else
document.getElementById('innerlabel').innerHTML="Father Name<font color='red'>*</font>";
document.getElementById('innertype').innerHTML="<input type='text' name='rname'>";
}

//for change password
function checknullchange()
{
if(document.getElementById('oldpass').value!="" && document.getElementById('newpass').value!="" && document.getElementById('confirmpass').value!="" )
{
return true;
}
else
{
alert("Enter the information correctly");
return false;
}
}

function checktodate()
{
var fm=document.getElementById('fmonth').selectedIndex;
var tm=document.getElementById('tmonth').selectedIndex;
var fy=document.getElementById('fyear').value;
var ty=document.getElementById('tyear').value;

if(ty>=fy && tm>=fm)
{
return true;
}
else
{
alert("To month and year lessthan from month and year");
document.getElementById('tmonth').value=-1;
document.getElementById('tyear').value=-1;
return false;
}
}

function Checknews()
{
var myForm = document.calform;
if(checkOpt(myForm.type,"Type"))
{
//alert(myForm.type[0].checked);
if(myForm.type[0].checked)
{
return(checkNull(myForm.Title,"Title") && checkNull(myForm.des,"Description") && checkNull(myForm.datebox,"Date"));
 }
 else
{
//alert("muthu");
 return(checkNull(myForm.Title,"Title") && checkNull(myForm.des,"Description") && checkNull(myForm.fromdatebox,"From Date") && checkNull(myForm.todatebox,"To Date") && checkNull(myForm.venue,"Venue"));
}
 }
else
return false;
 }
 
 
//attach new or attach events
function attachnew(a)
{
if(a==1)
{
document.getElementById('controlfrom').innerHTML= "<input type='text' name='datebox'  id='datebox' size=15 onkeyup='selectdate1(this.id)'> <a href=\"javascript:show_calendar('calform.datebox');\" onMouseOver=\"window.status='Date Picker';return true;\" onMouseOut=\"window.status='';return true;\"><img src=\"date image/show-calendar.gif\" alt=\"date\" width=24 height=22 border=0></a>";
document.getElementById('labelfrom').innerHTML="Select Date<font color='red'>*</font>";
document.getElementById('controlto').innerHTML="";
document.getElementById('labelto').innerHTML="";
document.getElementById('controlvenue').innerHTML="";
document.getElementById('labelvenue').innerHTML="";
}
else
{
document.getElementById('controlfrom').innerHTML= "<input type='text' name='fromdatebox'  id='fromdatebox' size=15 onkeyup='selectdate(this.id)'> <a href=\"javascript:show_calendar('calform.fromdatebox');\" onMouseOver=\"window.status='Date Picker';return true;\" onMouseOut=\"window.status='';return true;\"><img src=\"date image/show-calendar.gif\" alt=\"date\" width=24 height=22 border=0></a>";
document.getElementById('labelfrom').innerHTML="From Date<font color='red'>*</font>";
document.getElementById('controlto').innerHTML="<input type='text' name='todatebox'  id='todatebox' size=15 onkeyup='selectdate(this.id)'> <a href=\"javascript:show_calendar('calform.todatebox');\" onMouseOver=\"window.status='Date Picker';return true;\" onMouseOut=\"window.status='';return true;\"><img src=\"date image/show-calendar.gif\" alt=\"date\" width=24 height=22 border=0></a>";
document.getElementById('labelto').innerHTML="To Date<font color='red'>*</font>";
document.getElementById('controlvenue').innerHTML="<textarea type=\"text\" name=\"venue\" id=\"venue\" rows=\"5\" cols='50'></textarea>";
document.getElementById('labelvenue').innerHTML="Venue<font color='red'>*</font>";
}
}

//check is not empty and process
function checkpicture()
{
var myForm = document.calform;
if(document.getElementById('file').value!="")
return checkimage(myForm.file,"Image");
else
return true;
}

function checkphone()
{
var myForm = document.calform;
if(document.getElementById('phone').value!="")
{
if(myForm.phone.value.length>=7)
return  checkNumber(myForm.phone,"Phone","r");
else
{
alert("Is not a Valid Phone Number");
return false;
}
}
else
return true;
}

function checkmobile()
{
var myForm = document.calform;
if(document.getElementById('mobile').value!="")
{
if(myForm.mobile.value.length>=10)
return  checkNumber(myForm.mobile,"Mobile","r");
else
{
alert("Is not a Valid Mobile Number");
return false;
}
}
else
return true;
}
//ajax
function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	function getcity(id) {		
		//com=termId;
		var strURL="getcity.php?id="+id;
		var req = getXMLHTTP();
				if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
				document.getElementById('city').innerHTML=req.responseText;
								} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
	}
function getdistrict(id) {		
		//com=termId;
		var strURL="getdistrict.php?id="+id;
		var req = getXMLHTTP();
				if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
				document.getElementById('district').innerHTML=req.responseText;
								} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
	}
	*/
