imgchecked = new Image();
imgchecked.src="/images/checkbox_act.gif";
imgunchecked = new Image();
imgunchecked.src="/images/checkbox.gif";


	function Check(oThat,field) {
		setCheck = eval(field);
		setCheck.checked = !(setCheck.checked);
                if (setCheck.checked==true)
                { oThat.src=imgchecked.src };
                else
                { oThat.src=imgunchecked.src };
	}

	function ImgId(oImg) {
        oName = oImg.name;
 var i2_img=-1;
 var ReturnImgId=-1;

        for (i_img=0;i_img<document.images.length;i_img++)
        {
         if (document.images[i_img].name==oName)
         {
          i2_img++;
       //   alert(document.images[i_img].name);
          if (document.images[i_img]==oImg)
          {
           document.images[i_img].src=imgchecked.src;
           ReturnImgId=i2_img
          }
          else
          {
           document.images[i_img].src=imgunchecked.src;
          }
         }
       //  alert(i_img);
        }
         return ReturnImgId;
        }

function SEL(flag) { 
var frm = document.frm;
for (i=0; i<frm.length; i++) {
if(frm.elements[i].type=="checkbox") {
frm.elements[i].checked = flag;
}
}
}

function checksForm(){
	
var count=0;
var frm = document.forms[0];
for (i=0; i<frm.length; i++) {
if(frm.elements[i].type=="text") {
if(frm.elements[i].value ==""){
	
}else{
	count++;
}
}
}
	if(count==0){
		alert('No Search Critaria');
		return false;
	}else{
		return true;
	}
}
function chkeckCart(frm){
	if(frm.CNUM.value==""){
alert('Empty Value for Number');
frm.CNUM.focus();
return false;
	}else{
		
		if(isNaN(frm.CNUM.value)){
			alert('Invalid Value');
				frm.CNUM.focus();
			return false;
		}else{
			return true;
		}
	}
}
function changePass(){
var frm = document.forms[0];
if(frm.userid.value ==""){
 	alert('Email Address is Empty');
	frm.userid.focus();
	return false;
}
if(frm.newpass.value ==""){
 	alert('New Password is Empty');
	frm.newpass.focus();
	return false;
}
if(frm.oldpass.value ==""){
 	alert('Old Passowrd is Empty');
	frm.oldpass.focus();
	return false;
}
if(frm.rnewpass.value ==""){
 	alert('Repeat New  Password is Empty');
	frm.rnewpass.focus();
	return false;
}
if(frm.newpass.value ==frm.rnewpass.value ){
}else{
 	alert('New  Passowrd & Repeat New Password not Match');
	frm.rnewpass.focus();
	return false;
}

}
function checklogin(frm){
	if(frm.userid.value ==""){
 	alert('Email address is Empty');
	frm.userid.focus();
	return false;
}
if(frm.userpass.value ==""){
 	alert('Password is Empty');
	frm.userpass.focus();
	return false;
}
}

function checkmForm(){
	

var frm = document.forms[0];


for (i=0; i<frm.length; i++) {
if(frm.elements[i].type=="text" || frm.elements[i].type=="password"  ) {
if(frm.elements[i].value ==""){
	alert('Empty Value');
	frm.elements[i].focus();
	return false;
}
}
}
if(frm.password1.value==""){
	alert('Please select your Password');
	frm.password1.focus();
	return false;
	}
if(frm.password2.value==""){
alert('Empty Value for Confirm Password');
	frm.password2.focus();
return false;
}
if(frm.password1.value==frm.password2.value){
}else{
	alert('Password & conform Password don\'t Match');
	frm.password1.focus();
	return false;
}
if( echeck(frm.email.value)){
}else{
	//alert('Invalid Email Address');
	frm.email.focus();
return false;
}

	if(frm.gender.value==""){
	alert('Please select your gender');
	frm.gender.focus();
	return false;
	}
if(frm.residing.value==""){
alert('Please select your residing');
	frm.residing.focus();
return false;
}





}
function echeck(str) 
{
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1)
	{   alert("Invalid E-mail ID") 
	  return false
	}
	if (str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{   alert("Invalid E-mail ID")  
	 return false
	}
	if (str.indexOf(dot)==-1)
	{alert("Invalid E-mail ID")    
	return false
	}
	if (str.indexOf(dot)<lat)
	{alert("Invalid E-mail ID")    
	return false
	} 
	if (str.indexOf(at,(lat+1))!=-1)
	{alert("Invalid E-mail ID")   
	 return false 
	}
	if (str.indexOf(" ")!=-1)
	{alert("Invalid E-mail ID")    
	return false
	} 
 	if (str.indexOf(dot)==(lat+1))
	{alert("Invalid E-mail ID")    
	return false
	} 
return true
}
