
function checkBoxValidate(cb) {
for (j = 0; j < 5; j++) {
if (eval("document.membfrm.catmemb[" + j + "].checked") == true) {
document.membfrm.catmemb[j].checked = false;
if (j == cb) {
document.membfrm.catmemb[j].checked = true;
         }
      }
   }
}


function checkBoxValidate7(cb) {
for (j = 0; j < 5; j++) {
if (eval("document.membfrmic.catmemb[" + j + "].checked") == true) {
document.membfrmic.catmemb[j].checked = false;
if (j == cb) {
document.membfrmic.catmemb[j].checked = true;
         }
      }
   }
}


function checkBoxValidate2(cb) {
for (j = 0; j < 2; j++) {
if (eval("document.membfrm.addr[" + j + "].checked") == true) {
document.membfrm.addr[j].checked = false;
if (j == cb) {
document.membfrm.addr[j].checked = true;
         }
      }
   }
}

function checkBoxValidate3(cb) {
for (j = 0; j < 3; j++) {
if (eval("document.membfrm.membfee[" + j + "].checked") == true) {
document.membfrm.membfee[j].checked = false;
if (j == cb) {
document.membfrm.membfee[j].checked = true;
         }
      }
   }
}

function checkBoxValidate4(cb) {
for (j = 0; j < 3; j++) {
if (eval("document.membfrm.show_hide[" + j + "].checked") == true) {
document.membfrm.show_hide[j].checked = false;
if (j == cb) {
document.membfrm.show_hide[j].checked = true;
         }
      }
   }
}


function checkBoxValidate8(cb) {
for (j = 0; j < 3; j++) {
if (eval("document.membfrmic.show_hide[" + j + "].checked") == true) {
document.membfrmic.show_hide[j].checked = false;
if (j == cb) {
document.membfrmic.show_hide[j].checked = true;
         }
      }
   }
}

function checkBoxValidate9(cb) {
for (j = 0; j < 3; j++) {
if (eval("document.editprofile.show_hide[" + j + "].checked") == true) {
document.editprofile.show_hide[j].checked = false;
if (j == cb) {
document.editprofile.show_hide[j].checked = true;
         }
      }
   }
}




function checkIt(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        status = "This field accepts numbers only."
        return false
    }
	
    status = ""
    return true
}










function validateform(membfrm){
//alert("dddd");
myOption = -1;
for (k=membfrm.catmemb.length-1; k > -1; k--) {
if (membfrm.catmemb[k].checked) {
myOption = k; 
//alert(myOption);
/*if(myOption ==0 || myOption ==1 )
{
  if ( (membfrm.inst_name.value == ""))
  {
     alert("Please enter the Instution");
     document.membfrm.inst_name.focus();
      return false;
  }
}*/

if(myOption ==0 || myOption ==1 || myOption ==2)
{
	  
  if ( (membfrm.firstname.value == ""))
  {
     alert("Please enter the First Name");
     document.membfrm.firstname.focus();
      return false;
  }
  
  if ( (membfrm.lastname.value == ""))
  {
     alert("Please enter the Last Name");
     document.membfrm.lastname.focus();
      return false;
  }
	 
}
k = -1;
}
}
if (myOption == -1) {
alert("You must select the Category of Membership");
return false;
}


/* if ( (membfrm.uname.value == ""))
  {
     alert("Please enter the User Name");
     document.membfrm.uname.focus();
      return false;
  }
*/

 /*var total2=""
for(var j=0; j < document.membfrm.catmemb.length; j++){
if(document.membfrm.catmemb[j].checked)
total2 +=document.membfrm.catmemb[j].value + "\n"
//alert(total2);
}
var tot=String(total2);
alert(tot);
if(tot=="life"){
alert("please select dob");
return false;
}*/


//alert(tt);

	
	 
	 if ( membfrm.dt.selectedIndex == 0 ) { alert ( "Please select the Date" ); return false; } 
	  if ( membfrm.mth.selectedIndex == 0 ) { alert ( "Please select the Month" ); return false; } 
	
	  if ( (membfrm.yr.value == ""))
  {
     alert("Please enter the Year");
     document.membfrm.yr.focus();
      return false;
  }


var total=""
for(var i=0; i < document.membfrm.gender.length; i++){
if(document.membfrm.gender[i].checked)
total +=document.membfrm.gender[i].value + "\n"
}
if(total==""){
alert("Please select the Gender");
return false;
}

/*if ( ( membfrm.gender[0].checked == false ) || ( membfrm.gender[1].checked == false ) ( membfrm.gender[2].checked == false ) || ( membfrm.gender[3].checked == false )  ) { alert ( "Please choose your Gender: Male or Female or Corporate or Instiution" ); return false; }*/ 
 
  if ((membfrm.addr1.value == ""))
  {
      alert("Please Enter the Address");
	  document.membfrm.addr1.focus();
      return false;
  }
  
/*  if ( (membfrm.phone.value == ""))
  {
      alert("Please Enter the Phone No");
	  document.membfrm.phone.focus();
      return false;
  }*/
  /*var phone=membfrm.Phone;
   if(phone.value!=""){
  		phoneVal = Phone.value;
  if(phoneVal.length<=10){
			alert("Please enter valid Phone Number.");
			phone.value="";
			document.membfrm.phone.focus();
			return false;
		}*/
		
		
		 if ( (membfrm.tephone.value == ""))
  {
      alert("Please Enter the Code Number");
	  document.membfrm.tephone.focus();
      return false;
  }
  
   if ( (membfrm.tephone2.value == ""))
  {
      alert("Please Enter the Phone Number");
	  document.membfrm.tephone2.focus();
      return false;
  }
  
   if ( (membfrm.mobile.value == ""))
  {
      alert("Please Enter the Mobile number");
	  document.membfrm.mobile.focus();
      return false;
  }
  
   if ( (membfrm.email.value == ""))
  {
      alert("Please Enter the Email ID");
	  document.membfrm.email.focus();
      return false;
  }
		
	
  if ( (membfrm.email.value.indexOf("@") == -1) || (membfrm.email.value.indexOf(".") == -1) )
  {
    alert("Please enter a valid E-mail address.");
    membfrm.email.select( );
    membfrm.email.focus( );
    return false;
  }
  
   if ( membfrm.select1.selectedIndex == 0 ) { alert ( "Please select country" ); return false; } 
   
  if ( membfrm.select1.selectedIndex == 1 )
  { 
  if ( membfrm.state.selectedIndex == 0 ) {alert ( "Please select State" ); 
  return false;
  }
   if ( membfrm.city.selectedIndex == 0 ) {alert ( "Please select city" ); 
  return false;
  }
  }
  
   if ( membfrm.select1.selectedIndex == 2 )
   {
	    if ( (membfrm.intcountry.value == ""))
  {
      alert("Please Enter the Country Name");
	  document.membfrm.intcountry.focus();
      return false;
  }
   if ( (membfrm.intstate.value == ""))
  {
      alert("Please Enter the State Name");
	  document.membfrm.intstate.focus();
      return false;
  }
   if ( (membfrm.intcity.value == ""))
  {
      alert("Please Enter the City Name");
	  document.membfrm.intcity.focus();
      return false;
  }
   }
  
 /* if ( ( membfrm.addr[0].checked.value == "office" )
					  {
						  alert("office");
					  }
	if ( ( membfrm.addr[1].checked.value == "permanent" )
					  {
						  alert("permanent");
					  }*/
  
 /* if(!document.membfrm.office.checked)
  {
	  if ( (membfrm.addr1.value == ""))
  {
      alert("Please Enter the State Name");
	  document.membfrm.addr1.focus();
      return false;
  }
	  
}*/

/* if(!document.membfrm.permanent.checked)
  {
	  if ( (membfrm.addr2.value == ""))
  {
      alert("Please Enter the State Name");
	  document.membfrm.addr2.focus();
      return false;
  }
}
 */
   
   
   
   
   
  
 /*var total=""
for(var i=0; i < document.membfrm.addr.length; i++){
if(document.membfrm.addr[i].checked)
total +=document.membfrm.addr[i].value + "\n"
}
if(total==""){
alert("Please select the address for correspondence ");
return false;
}
else
{
	var v=total;
	alert(total);
	if(total=="permanent")
	{
		 alert("fdsdfd");
		 if ( (membfrm.addr2.value == ""))
  {
      alert("Please Enter the State Name");
	  document.membfrm.addr2.focus();
      return false;
  } 
	}
	
	if()
	{
		 alert("sdadsa");
	}
	 //alert("fgg");
}*/



/*myOption = -1;
for (k=membfrm.payment_type.length-1; k > -1; k--) {
if (membfrm.payment_type[k].checked) {
myOption = k; 
if(myOption ==0)
{
 myOption2 = -1;
 for (l=membfrm.dOption.length-1; l > -1; l--) {
 if (membfrm.dOption[l].checked) {
 myOption2 = l;
 if(myOption2 ==0)
{
 if(membfrm.sTextBox.value == "")
  alert("enter the membership fees");
  document.membfrm.sTextBox.focus();
 //return false;
 false
}
if(myOption2 ==1)
{
  if(membfrm.eTextBox.value == "")
  alert("enter the membership fees");
  document.membfrm.eTextBox.focus();
 //return false;
 false;
}
l = -1;
}
}
if (myOption2 == -1) {
alert("You must select the Payment Fees");
return false;
}

 //alert("this is online txt");
 //false
}
if(myOption ==1)
{
 if ( (membfrm.cheqno.value == ""))
  {
      alert("Please Enter the Cheque No");
	  document.membfrm.cheqno.focus();
      return false;
  }
  
  if ( (membfrm.dated.value == ""))
  {
      alert("Please Enter the Date");
	  document.membfrm.dated.focus();
      return false;
  }

  //alert("this is cheque txt");
 //false;
}
k = -1;
}
}
if (myOption == -1) {
alert("You must select the payment type");
return false;
}*/


myOptionsh = -1;
for (s=membfrm.show_hide.length-1; s > -1; s--) {
if (membfrm.show_hide[s].checked) {
myOptionsh = s; 
s = -1;
}
}
if (myOptionsh == -1) {
alert("Please select whether you  want to  show or hide your contact details");
return false;
}


if(!document.membfrm.agree.checked){alert("Please Read the guidelines and check the box below");
return false; }
}












function chMd()
 {
  // initialize form with empty field
  document.forms[0].sTextBox.disabled=false;
  document.forms[0].sTextBox.value="";
  //document.forms[0].goServer.disabled=false;

  for(var i=0;i<document.forms[0].elements.length;i++)
  {
    if(document.forms[0].elements[i].name=="dOption")
    {
     /*if(document.forms[0].elements[i].value=="N")
     {
       if(document.forms[0].elements[i].checked==true){

        document.forms[0].sTextBox.disabled=true;
              document.forms[0].eTextBox.disabled=true;
     
        document.forms[0].goServer.disabled=true;
       }
     }*/
      if(document.forms[0].elements[i].value=="india")
     {
       if(document.forms[0].elements[i].checked==true){
        document.forms[0].sTextBox.disabled=false;
               document.forms[0].eTextBox.disabled=true;
             //document.forms[0].goServer.disabled=false;
       }
     }
     else if(document.forms[0].elements[i].value=="us")
     {
       if(document.forms[0].elements[i].checked==true){
        document.forms[0].sTextBox.disabled=true;
               document.forms[0].eTextBox.disabled=false;
              //document.forms[0].goServer.disabled=false;
       }
     }
    }
  }
 }
 
 
 
 //validation for online awqrd submit form
 
 function onlinevalidateform(awardform){
if ( (awardform.Name.value == ""))
  {
      alert("Please Enter the Name");
	  document.awardform.Name.focus();
      return false;
  }
  if ( (awardform.Dob.value == ""))
  {
      alert("Please Enter the Date of Birth");
	  document.awardform.Dob.focus();
      return false;
  }
  if ( (awardform.Address.value == ""))
  {
      alert("Please Enter the Address");
	  document.awardform.Address.focus();
      return false;
  }
  if ( (awardform.Phone.value == ""))
  {
      alert("Please Enter the Phone Number");
	  document.awardform.Phone.focus();
      return false;
  }
 
  if ( (awardform.Email.value == ""))
  {
      alert("Please Enter the Email");
	  document.awardform.Email.focus();
      return false;
  }
  if ( (awardform.Email.value.indexOf("@") == -1) || (awardform.Email.value.indexOf(".") == -1) )
  {
    alert("Please enter a Valid  Email id");
    awardform.Email.select( );
    awardform.Email.focus( );
    return false;
  }
  if ( (awardform.Acadqualif.value == ""))
  {
      alert("Please Enter Academic Qualifications");
	  document.awardform.Acadqualif.focus();
      return false;
  }
  if ( (awardform.Poshld.value == ""))
  {
      alert("Please Enter Positions Held");
	  document.awardform.Poshld.focus();
      return false;
  }
  if ( (awardform.Recognitionsrec.value == ""))
  {
      alert("Please Enter Awards/Honours/Recognitions received");
	  document.awardform.Recognitionsrec.focus();
      return false;
  }
  if ( (awardform.Fellowships.value == ""))
  {
      alert("Please Enter Fellowships of Academies");
	  document.awardform.Fellowships.focus();
      return false;
  }if ( (awardform.Professionalsocieties.value == ""))
  {
      alert("Please Enter Memberships of Professional Societies");
	  document.awardform.Professionalsocieties.focus();
      return false;
  }
  if ( (awardform.Contributions.value == ""))
  {
      alert("Please Enter Outstanding Contributions made by the Nominee");
	  document.awardform.Contributions.focus();
      return false;
  }
  if ( (awardform.Products.value == ""))
  {
      alert("Please Enter Products/Projects guided by the Nominee");
	  document.awardform.Products.focus();
      return false;
  }
  if ( (awardform.Patents.value == ""))
  {
      alert("Please Enter the Patents ");
	  document.awardform.Patents.focus();
      return false;
  }
   if ( (awardform.Journalpublications.value == ""))
  {
      alert("Please Enter Significant International Journal Publications of the Nominee during the last five year");
	  document.awardform.Journalpublications.focus();
      return false;
  }
   if ( (awardform.Citation.value == ""))
  {
      alert("Please Enter Citation in about 50 words");
	  document.awardform.Citation.focus();
      return false;
  }
   if ( (awardform.Relevant.value == ""))
  {
      alert("Please Enter the Any other relevant information");
	  document.awardform.Relevant.focus();
      return false;
  }
   if ( (awardform.vercode.value == ""))
  {
      alert("Enter Verification Code");
	  document.awardform.vercode.focus();
      return false;
  }
   if ( (awardform.NameACS.value == ""))
  {
      alert("Please Enter the Name of ACS Permanent / Life Member");
	  document.awardform.NameACS.focus();
      return false;
  }
   if ( (awardform.EmailACS.value == ""))
  {
      alert("Please Enter the Email id of ACS Permanent / Life Member");
	  document.awardform.EmailACS.focus();
      return false;
  }
  if ( (awardform.EmailACS.value.indexOf("@") == -1) || (awardform.EmailACS.value.indexOf(".") == -1) )
  {
    alert("Please enter a Valid  Email id of ACS Permanent / Life Member");
    awardform.EmailACS.select( );
    awardform.EmailACS.focus( );
    return false;
  }
   
 }
 
 //end of the online application validation form
 
 
 //start for validation for corporate add projects
 
 function corporatevalidateform(corporate){
	 //alert("fgf");
if ( (corporate.title.value == ""))
  {
      alert("Please Enter the  title");
	  document.corporate.title.focus();
      return false;
  }
  
  
  if ( (corporate.description.value == ""))
  {
      alert("Please Enter the Project Details");
	  document.corporate.description.focus();
      return false;
  }


if ( (corporate.email.value == ""))
  {
      alert("Please Enter the Email");
	  document.corporate.email.focus();
      return false;
  }
  
  
  if ( (corporate.email.value.indexOf("@") == -1) || (corporate.email.value.indexOf(".") == -1) )
  {
    alert("Please enter a valid E-mail address.");
    corporate.email.select( );
    corporate.email.focus( );
    return false;
  }

 }
 
 //end of the corporate validtaion
 
 //start for validation for student add projects
 
 function studentvalidateform(student){
 
  if ( (student.description.value == ""))
  {
      alert("Please Enter the Area of interest");
	  document.student.description.focus();
      return false;
  }


if ( (student.email.value == ""))
  {
      alert("Please Enter the Email Id");
	  document.student.email.focus();
      return false;
  }
  
  
  if ( (student.email.value.indexOf("@") == -1) || (student.email.value.indexOf(".") == -1) )
  {
    alert("Please enter a valid E-mail address.");
    student.email.select( );
    student.email.focus( );
    return false;
  }

 }
 
 //end of the Student validtaion
 
 //png tranparent code
 
 function correctPNG() 
{
   for(var i=0; i<document.images.length; i++)
   {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase();
	  if( (img.src.indexOf("google.com") >= 0) || (img.src.indexOf("maps.gstatic") >= 0) ){
			//IF the images are from google server dont apply pngfix						
		}
		else{
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
					  {
						 var imgID = (img.id) ? "id='" + img.id + "' " : ""
						 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
						 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
						 var imgStyle = "display:inline-block;" + img.style.cssText 
						 if (img.align == "left") imgStyle = "float:left;" + imgStyle
						 if (img.align == "right") imgStyle = "float:right;" + imgStyle
						 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
						 var strNewHTML = "<span " + imgID + imgClass + imgTitle
						 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
						 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
						 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
						 img.outerHTML = strNewHTML
						 i = i-1
					  }
		}
			
   }
}
try{
	window.attachEvent("onload", correctPNG); 
}catch(err){
}

//end of png transparent code






function validateform_ic(membfrmic){
		myOption = -1;
for (k=membfrmic.catmemb.length-1; k > -1; k--) {
if (membfrmic.catmemb[k].checked) {
myOption = k; 
//alert(myOption);
if(myOption ==0 || myOption ==1 )
{
  if ( (membfrmic.inst_name.value == ""))
  {
     alert("Please enter the Corporate/Instution Name");
     document.membfrmic.inst_name.focus();
      return false;
  }
}

if(myOption ==2 || myOption ==3 || myOption ==4 )
{
	  
  if ( (membfrmic.firstname.value == ""))
  {
     alert("Please enter the First Name");
     document.membfrm.firstname.focus();
      return false;
  }
  
  if ( (membfrmic.lastname.value == ""))
  {
     alert("Please enter the Last Name");
     document.membfrmic.lastname.focus();
      return false;
  }
	 
}
k = -1;
}
}
if (myOption == -1) {
alert("You must select the Category of Membership");
return false;
}


/* if ( (membfrm.uname.value == ""))
  {
     alert("Please enter the User Name");
     document.membfrm.uname.focus();
      return false;
  }
*/

 /*var total2=""
for(var j=0; j < document.membfrm.catmemb.length; j++){
if(document.membfrm.catmemb[j].checked)
total2 +=document.membfrm.catmemb[j].value + "\n"
//alert(total2);
}
var tot=String(total2);
alert(tot);
if(tot=="life"){
alert("please select dob");
return false;
}*/


//alert(tt);


var total=""
for(var i=0; i < document.membfrmic.gender.length; i++){
if(document.membfrmic.gender[i].checked)
total +=document.membfrmic.gender[i].value + "\n"
}
if(total==""){
alert("Please select the type of  Membership");
return false;
}

/*if ( ( membfrm.gender[0].checked == false ) || ( membfrm.gender[1].checked == false ) ( membfrm.gender[2].checked == false ) || ( membfrm.gender[3].checked == false )  ) { alert ( "Please choose your Gender: Male or Female or Corporate or Instiution" ); return false; }*/ 
 
  if ((membfrmic.addr1.value == ""))
  {
      alert("Please Enter the Address");
	  document.membfrmic.addr1.focus();
      return false;
  }
  
/*  if ( (membfrm.phone.value == ""))
  {
      alert("Please Enter the Phone No");
	  document.membfrm.phone.focus();
      return false;
  }*/
  /*var phone=membfrm.Phone;
   if(phone.value!=""){
  		phoneVal = Phone.value;
  if(phoneVal.length<=10){
			alert("Please enter valid Phone Number.");
			phone.value="";
			document.membfrm.phone.focus();
			return false;
		}*/
		 if ( (membfrmic.tephone.value == ""))
  {
      alert("Please Enter the code number");
	  document.membfrmic.tephone.focus();
      return false;
  }
  
   if ( (membfrmic.tephone2.value == ""))
  {
      alert("Please Enter the Phone number");
	  document.membfrmic.tephone2.focus();
      return false;
  }
  
   if ( (membfrmic.fax.value == ""))
  {
      alert("Please Enter the Fax number");
	  document.membfrmic.fax.focus();
      return false;
  }
	 if ( (membfrmic.email.value == ""))
  {
      alert("Please Enter the Email");
	  document.membfrmic.email.focus();
      return false;
  }
  if ( (membfrmic.email.value.indexOf("@") == -1) || (membfrmic.email.value.indexOf(".") == -1) )
  {
    alert("Please enter a valid E-mail address.");
    membfrmic.email.select( );
    membfrmic.email.focus( );
    return false;
  }
  
   if (membfrmic.select1.selectedIndex == 0 ) { alert ( "Please select country" ); return false; } 
   
  if ( membfrmic.select1.selectedIndex == 1 )
  { 
  if (membfrmic.state.selectedIndex == 0 ) {alert ( "Please select State" ); 
  return false;
  }
   if (membfrmic.city.selectedIndex == 0 ) {alert ( "Please select city" ); 
  return false;
  }
  }
  
   if (membfrmic.select1.selectedIndex == 2 )
   {
	    if ( (membfrmic.intcountry.value == ""))
  {
      alert("Please Enter the Country Name");
	  document.membfrmic.intcountry.focus();
      return false;
  }
   if ( (membfrmic.intstate.value == ""))
  {
      alert("Please Enter the State Name");
	  document.membfrmic.intstate.focus();
      return false;
  }
   if ( (membfrmic.intcity.value == ""))
  {
      alert("Please Enter the City Name");
	  document.membfrmic.intcity.focus();
      return false;
  }
   }
  


myOptionsh = -1;
for (s=membfrmic.show_hide.length-1; s > -1; s--) {
if (membfrmic.show_hide[s].checked) {
myOptionsh = s; 
s = -1;
}
}
if (myOptionsh == -1) {
alert("Please select whether you  want to  show or hide your contact details");
return false;
}

 

if(!document.membfrmic.agree.checked){alert("Please Read the guidelines and check the box below");
return false; }
}




