function records_transfer() {
    var pp=1;
    dml=document.form1;
    len=dml.elements.length;
    var i=0;
    for(i=0; i<len; i++) {
      if ((document.form1.elements[i].type == "radio") && (dml.elements[i].checked==true)) {
         pp=2;
      }
    }
    if (pp==1) {
      alert("You have not selected any Record.");
      return false;
    }
}


function biz_home_valid(chk1) {
	if (chk1.your_name.value.length==0) {
            alert("Enter your name");
            chk1.your_name.focus();
            return false;
    }
    if (chk1.comp_name.value.length==0) {
            alert("Enter your company name");
            chk1.comp_name.focus();
            return false;
         }
         if (chk1.address.value.length ==0) {
            alert("Enter your Postal Address");
            chk1.address.focus();
            return false;
         }
         if (chk1.country.options[chk1.country.selectedIndex].value=="")  {
            alert("Enter your Country");
            chk1.country.focus();
            return false;
         }
         if (chk1.phone.value.length==0)  {
            alert("Enter your Phone Number");
            chk1.phone.focus();
            return false;
         }
         if (chk1.username.value.length == 0) {
            alert("E-mail address can't be left blank");
            chk1.username.focus();
            return false;
         }
         if (chk1.username.value.indexOf('@') == -1) {
               alert("Error in e-mail address");
               chk1.username.focus();
               return false;
         }
         if (chk1.username.value.indexOf('.') == -1) {
               alert("Error in e-mail address");
               chk1.username.focus();
               return false;
         }
         if (chk1.username.value.indexOf('@') != chk1.username.value.lastIndexOf('@')) {
               alert("Please Specify One E-mail address only");
               chk1.username.focus();
               return false;
         }
	if (chk1.your_requirement.value.length==0)  {
            alert("Enter Your Requirement");
        	chk1.your_requirement.focus();
			return false;
    }
}


function openwin1(file,Iwidth,Iheight) {
      var newWin1=window.open(file,'nWin2','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes, copyhistory=no,width='+Iwidth+',height='+Iheight+',screenX=0,screenY=0,left=20,top=20');
}

function checkAll(val) {
   	dml=document.form1;
   	len=dml.elements.length;
   	var i=0;
   	for (i=0; i<len; i++) {
     	if (document.form1.elements[i].type == "checkbox") {
        	if (val == 1) { 
           		dml.elements[i].checked=true;
        	} 
			else {
           		dml.elements[i].checked=false;
        	}
     	}   
   	}
}

   function chk_form1() {
      if (document.form1.tradelead_type.options[document.form1.tradelead_type.selectedIndex].value == "x") {
         alert("Select Trade Lead Type");
         document.form1.tradelead_type.focus();
         return false;
      }
      
      if (document.form1.subject.value.length == 0) {
         alert("Do not leave Subject field blank");
         document.form1.subject.focus();
         return false;
      }
      if (document.form1.keywords.value.length == 0) {
         alert("Do not leave Keyword field blank");
         document.form1.keywords.focus();
         return false;
      }
      if (document.form1.details.value.length>200) {
         alert("Your Details limit upto 200 characters");
         document.form1.details.focus();
         return false;
      }
      if ((!document.form1.details.value.indexOf('.com')) || (!document.form1.details.value.indexOf('.net')) || (!document.form1.details.value.indexOf('.www'))) {
         alert("Don't specify your site address in Details fields");
         document.form1.details.focus();
         return false;
      }
      if (document.form1.details.value.length <= 1) {
         alert("Enter Your Trade Lead Details");
         document.form1.details.focus();
         return false;
      }
  }




      function deleteNow(cnt1,cnt2) {
	var pp=1;
	for (var j = 1; j <= cnt1; j++) {
		box = eval('document.form1.chk_' + j);
		if (box.checked == true) {
			pp=2;
		} 
	}
	if (pp==1) {
		alert("You have not selected any Inquiries .\n\nPlease select the Inquiries and then proceed");
		return false;
	}  
	if (cnt2==4) {
		p2 = confirm('Are you sure want to Restore');
	}
	if (cnt2<4) {
		p2 = confirm('Are you sure want to delete');
	}
	
	if (!p2) {
		return false;
		}
	}
 

function placement_valid(chk2) {
	for (var i = 0; i < chk2.elements.length; i++) {
		ename = chk2.elements[i].name ;
		if (ename == 'field_type[]') {
			var n = 0;
			for ( opt = 0; opt < chk2.elements[i].options.length; opt++) {
				if (chk2.elements[i].options[opt].selected==true)
				n++;
			}

			if ( n < 1 ) { 
				alert("Select Atleast One Category");
				chk2.elements[i].focus();
				return false; 
				break;
			}

			if ( n > 3 ) {
				alert("You cannot select more than 3 categories");
				chk2.elements[i].focus();
				return false; 
				break;
			}
		}
	}
   	if (chk2.state.options[chk2.state.selectedIndex].value == "x") {
	   alert("Please select one State");
	   chk2.state.focus();
	   return false;
	}

   if ((chk2.state.value=="") && (chk2.resi.checked)) {
      alert("Don't check the Residential State Option");
      chk2.resi.focus(); 
      return false;
   }
}


function chk_login(chk2) {
   if (chk2.user_name.value.length == 0) {
      alert("E-mail ID can't be left blank");
      chk2.user_name.focus();
      return false;
   }
   if (chk2.user_name.value.indexOf('@') == -1) {
      alert("Error in Email ID");
      chk2.user_name.focus();
      return false;
   }
   if (chk2.user_name.value.indexOf('.') == -1) {
      alert("Error in Email ID");
      chk2.user_name.focus();
      return false;
   }
   if (chk2.user_name.value.indexOf('@') !=  chk2.user_name.value.lastIndexOf('@')) {
      alert("Please Specify One Email ID only");
      chk2.user_name.focus();
      return false;
   }  
   if (chk2.pass_word.value.length==0) {
      alert("Enter Your Password ");
      chk2.pass_word.focus();
      return false; 
   }
}

function chk12() {
      document.joinForm.char_len.value=document.joinForm.req_desc.value.length;
      if (document.joinForm.req_desc.value.length>500) {
         alert("Your Description exceeds 500 characters");
         document.joinForm.req_desc.focus();
         return false;
      }
   }

var pop = '';
function openwin18(nm,newrows,newcolumns) {
   var name=nm;
   if (pop && !pop.closed) {
      pop.close();
   }
   var key1  = ",";
   var newStr = newrows.replace(/ /gi, key1)
   var newStr1 = newcolumns.replace(/ /gi, key1)
   pop=eval("window.open('"+name+"&newrows="+newStr+"&newcolumns="+newStr1+"','NewWIN','chrome[4],toolbar=no,left=10,top=5,width=600,height=450,directories=no,menubar=no,SCROLLBARS=yes')");
   if (!pop.opener) popUpWin.opener = self;
}

function search_valid(chk2) {
   if (chk2.busty.options[document.search.busty.selectedIndex].value == "0") {
      alert("select a business category");
      chk2.busty.focus();
	  return false;
   }
   if (chk2.term.value.length <=1 ) {
      alert("enter product keyword");
      chk2.term.focus();
	  return false;
   }
}

function openwin(file,Iwidth,Iheight) {
   var newWin1=window.open(file,'nWin1','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes, copyhistory=no,width=400,height=300,screenX=0,screenY=0,left=20,top=20');
}
function openwin1(file,Iwidth,Iheight) {
      var newWin1=window.open(file,'nWin2','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes, copyhistory=no,width='+Iwidth+',height='+Iheight+',screenX=0,screenY=0,left=20,top=20');
}
function openwin2(file,Iwidth,Iheight) {
      var newWin1=window.open(file,'nWin3','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes, copyhistory=no,width=650,height=500,screenX=0,screenY=0,left=20,top=20');
}
function openwin4(file,Iwidth,Iheight) {
      var newWin1=window.open(file,'nWin4','x=0,y=0,toolbar=no,location=no,directories=no,status=no,scrollbars=yes, copyhistory=no,width='+Iwidth+',height='+Iheight+',screenX=0,screenY=0,left=20,top=20');
}
function newBizValid(id1, chk1) {
	if (chk1=="chk") {
   		len=id1.elements.length;
   		var i=0;
 		var pp=1;
   		for (i=0; i<len; i++) {
	   		 if (id1.elements[i].type == "checkbox" && id1.elements[i].checked==true) {
				pp=2;
			}
		}
  		if (pp==1) {
	  		alert("Please select your Product checkbox");
	  		return false;
  		} 
   	}	
   if (id1.your_name.value.length==0) {
      alert("Enter your name");
	  id1.your_name.focus();
      return false;
   }
   if (id1.comp_name.value.length==0) {
      alert("Enter your company name");
	  id1.comp_name.focus();
      return false;
   }
   if (id1.address.value.length ==0) {
      alert("Enter your Postal Address");
      id1.address.focus();
      return false;
   }
   if (id1.country.value.length==0)  {
      alert("Enter your Country");
      id1.country.focus();
      return false;
   }
   if (id1.phone.value.length==0)  {
      alert("Enter your Country");
      id1.phone.focus();
      return false;
   }
   if (id1.username.value.length == 0) {
      alert("E-mail address can't be left blank");
      id1.username.focus();
      return false;
   }
   if (id1.username.value.indexOf('@') == -1) {
      alert("Error in e-mail address");
      id1.username.focus();
      return false;
   }
   if (id1.username.value.indexOf('.') == -1) {
      alert("Error in e-mail address");
      id1.username.focus();
      return false;
   }
   if (id1.username.value.indexOf('@') != id1.username.value.lastIndexOf('@')) {
      alert("Please Specify One E-mail address only");
      id1.username.focus();
      return false;
   }
   if (id1.your_requirement.value.length==0)  {
      alert("Enter Your Requirement");
      id1.your_requirement.focus();
      return false;
   }		
}

function chktrim(inputString) {
         if (typeof inputString != "string") { return inputString; }
         var retValue = inputString;
         var ch = retValue.substring(0, 1);
         while (ch == " ") { 
           retValue = retValue.substring(1, retValue.length);
           ch = retValue.substring(0, 1);
         } 
         ch = retValue.substring(retValue.length-1, retValue.length);
         while (ch == " ") { 
            retValue = retValue.substring(0, retValue.length-1);
            ch = retValue.substring(retValue.length-1, retValue.length);
         }
         while (retValue.indexOf("  ") != -1) { 
            retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
         }
         return retValue; 
} 

function validform(chk) {
	if (chktrim(chk.imp_keyword.value).length==0) {
		alert("Please Enter the important keyword");
    	chk.imp_keyword.focus();
    	return false;
   	}
	if (chktrim(chk.imp_keyword.value).length<50) {
		alert("Important keyword should be of atleast 50 Characters");
    	chk.imp_keyword.focus();
    	return false;
   	}
}
   	
function	bizvalid(chk) {
	if (chktrim(chk.comment_title.value).length == 0) {
		alert("Title  can't be left blank");
    	chk.comment_title.focus();
    	return false;
   	}
	if (chktrim(chk.comment_detail.value).length == 0) {
		alert("Description can't be left blank");
    	chk.comment_detail.focus();
    	return false;
   	}
	
}

function validbiz_contents(chk,content_type){
	 if(content_type=="Q") {
	 	if (chk.name.value.length==0) {
			alert("Enter the Name");
			chk.name.focus();
			return false;
	     } 
     }
     if(content_type=="Q" ||  content_type=="G") {
		 if (chk.email.value.length==0) {
			alert("Enter the Email-Id");
			chk.email.focus();
			return false;
     	} 	
   		if (chk.email.value.indexOf('.') == -1) {
      		alert("Error in Email ID");
      		chk.email.focus();
      		return false;
   		}
   		if (chk.email.value.indexOf('@') !=  chk.email.value.lastIndexOf('@')) {
      		alert("Please Specify One Email ID only");
      		chk.email.focus();
      		return false;
   		}  
 	}
 	
 	if(content_type=="Q" ||  content_type=="N") {
 	 	if (chk.content_subject.value.length==0) {
			alert("Enter the Subject");
			chk.content_subject.focus();
			return false;
    	}
	}
	 	
   	if (chk.content_detail.value.length==0) {
		alert("Enter the Detail");
		chk.content_detail.focus();
		return false;
    } 	
}

function chk1_valid(chk,titlestatus){
	 if (chk.product_name.value.length==0) {
		alert("Enter Your Product Name");
		chk.product_name.focus();
		return false;
     } 
	 if (chk.full_desc.value.length==0) {
		alert("Enter Your Product Details");
		chk.full_desc.focus();
		return false;
     } 
     if(titlestatus=="Y"){ 
	 	if (chk.short_desc.value.length>250) {
	 		alert("Your short description exceed 250 characters");
	    	chk.short_desc.focus();
	    	return false;
	 	}
	 	if (chktrim(chk.tbl_row1.value).length>0) {
		 	if (!parseInt(chk.tbl_row1.value)) {
			 	alert("Invalid Numbers of Rows in your 1st Table");
			 	chk.tbl_row1.focus();
			 	return false;
		 	}
		 	if (chktrim(chk.tbl_col1.value).length==0) {
			 	alert("Please specify the Numbers of coloumn in your 1st Table");
			 	chk.tbl_col1.focus();
			 	return false;
		 	}
		 	if (chktrim(chk.tbl_row1.value)>30) {
			 	alert("Maximum Number of Rows in one Table is 30");
			 	chk.tbl_row1.focus();
			 	return false;
		 	}
	 	}
	 	if (chktrim(chk.tbl_col1.value).length>0) {
		 	if (!parseInt(chk.tbl_col1.value)) {
			 	alert("Invalid Numbers of columns in your 1st Table");
			 	chk.tbl_col1.focus();
			 	return false;
		 	}
		 	if (chktrim(chk.tbl_row1.value).length==0) {
			 	alert("Please specify the Rows of coloumn in your 1st Table");
			 	chk.tbl_row1.focus();
			 	return false;
		 	}
		 	if (chktrim(chk.tbl_col1.value)>8) {
			 	alert("Maximum Number of columns in one Table is 8");
			 	chk.tbl_col1.focus();
			 	return false;
		 	}
	 	}
	 	if (chktrim(chk.tbl_row2.value).length>0) {
		 	if (!parseInt(chk.tbl_row2.value)) {
			 	alert("Invalid Numbers of Rows in your 2nd Table");
			 	chk.tbl_row2.focus();
			 	return false;
		 	}
		 	if (chktrim(chk.tbl_col2.value).length==0) {
			 	alert("Please specify the Numbers of coloumn in your 2nd Table");
			 	chk.tbl_col2.focus();
			 	return false;
		 	}
		 	if (chktrim(chk.tbl_row2.value)>30) {
			 	alert("Maximum Number of Rows in one Table is 30");
			 	chk.tbl_row2.focus();
			 	return false;
		 	}
	 	}
	 	if (chktrim(chk.tbl_col2.value).length>0) {
		 	if (!parseInt(chk.tbl_col2.value)) {
			 	alert("Invalid Numbers of columns in your 2nd Table");
			 	chk.tbl_col2.focus();
			 	return false;
		 	}
		 	if (chktrim(chk.tbl_row2.value).length==0) {
			 	alert("Please specify the Rows of coloumn in your 2nd Table");
			 	chk.tbl_row2.focus();
			 	return false;
		 	}
		 	if (chktrim(chk.tbl_col2.value)>8) {
			 	alert("Maximum Number of columns in one Table is 8");
			 	chk.tbl_col2.focus();
			 	return false;
		 	}
	 	}
	}
 	if(titlestatus=="nofinaltitle"){ 
		if ((!chk.final_title[0].checked) && (!chk.final_title[1].checked) && (!chk.final_title[2].checked)) {
   			alert("The Description above is about ");
   			return false;
		}
	}	  	         	  
}

function chk42(chk) {
   chk.char_len.value=chk.short_desc.value.length;   
      if (chk.short_desc.value.length>250) {
        alert("Your Description exceeds 250 characters");
        chk.short_desc.focus();
        return false;
  	  }
}
   	  

function chk1() {
     if (chktrim(document.form1.npassword.value).length <6) {
        alert("New Password must be 6 characters ");
        document.form1.npassword.focus();
        return false; 
     }
     if (chktrim(document.form1.cpassword.value).length <6) {
        alert("Confirm New Password must be 6 characters ");
        document.form1.cpassword.focus();
        return false; 
     }
     if (document.form1.cpassword.value != document.form1.npassword.value) { 
        alert("Your new password and confirm new password dosn't match");
        document.form1.npassword.focus();
        return false; 
     }
   }

function chk_joinnow(var2,check_login) {
   
   if(check_login!="true" && check_login!="already_member"){
	    
   	if(var2.username.value.length == 0) {
      alert("E-mail address can't be left blank");
      var2.username.focus();
      return false;
   	}
   	 if (var2.username.value.indexOf('@') == -1) {
      alert("Error in e-mail address");
      var2.username.focus();
      return false;
     }
     if (var2.username.value.indexOf('.') == -1) {
      alert("Error in e-mail address");
      var2.username.focus();
      return false;
    }
   	if (var2.username.value.indexOf('@') != var2.username.value.lastIndexOf('@')) {
      alert("Please Specify One E-mail address only");
      var2.username.focus();
      return false;
   	}
     if (chktrim(var2.cpassword.value).length <6) {
        alert("Password must be 6 characters ");
        var2.cpassword.focus();
        return false;
     }
     if (chktrim(var2.confirmpassword.value).length <6) {
        alert("Re-enter Password must be 6 characters ");
        var2.confirmpassword.focus();
        return false;
     }
     if (var2.cpassword.value != var2.confirmpassword.value) {
        alert("Your Password and Re-enter password dosn't match");
        var2.cpassword.focus();
        return false;
     }
       
    if (chktrim(var2.your_name.value).length==0) {
        alert("Enter your name");
        var2.your_name.focus();
        return false;
     }
   	 if (var2.country.options[var2.country.selectedIndex].value == "x") {
      alert("Select Country Name ");
      var2.country.focus();
      return false;
     }
     if (chktrim(var2.street_address.value).length ==0) {
        alert("Enter your Street Address");
        var2.street_address.focus();
        return false;
     }
     if ((var2.country.value == "IN") &&  (var2.state.options[var2.state.selectedIndex].value == "x")) {
        alert("Select your State");
        var2.state.focus();
        return false;
     }
     if (var2.country.value == "IN" && var2.postal_code.value.length<6) {
        alert("Enter Zip/Postal Code ");
        var2.postal_code.focus();
        return false;
     }
     if (!parseInt(var2.ph_ccode.value)) {
        alert("Incorrect Phone  - Country Code");
        var2.ph_ccode.focus();
        return false;
     }
     if (var2.ph_acode.value.length ==0) {
        alert("Enter Phone Number - Area Code");
        var2.ph_acode.focus();
        return false;
     }
     if (!parseInt(var2.ph_acode.value)) {
        alert("Incorrect Phone - Area Code");
        var2.ph_acode.focus();
        return false;
     }
     if (var2.ph_ccode.value.length ==0) {
        alert("Enter Phone Number - Country Code");
        var2.ph_ccode.focus();
        return false;
     }
     if (var2.ph_number.value.length ==0) {
        alert("Enter Phone Number");
        var2.ph_number.focus();
        return false;
     }
     if (!parseInt(var2.ph_number.value)) {
        alert("Incorrect Phone Number");
        var2.ph_number.focus();
        return false;
     }
}
     if (var2.req_tit.value.length<20) {
        alert("Please enter yout Requirement keyword");
        var2.req_tit.focus();
        return false;
     }
     if (var2.req_desc.value.length>500) {
        alert("Enter Requirement Detail (max. 500 characters)");
        var2.req_desc.focus();
        return false;
     }
     if ((!var2.req_desc.value.indexOf('.com')) || (!var2.req_desc.value.indexOf('.net')) || (!var2.req_desc.value.indexOf('.www'))) {
        alert("Don't specify your site address in Requirement Details");
        var2.req_desc.focus();
        return false;
     }
     if (var2.req_desc.value.length <= 1) {
        alert("Enter Your Requirement Details");
        var2.req_desc.focus();
        return false;
    	 }
    
	}






function validChgInfo(dml) {
	if (dml.ph_acode.value.length ==0) {
        alert("Enter Phone Number - Area Code");
        dml.ph_acode.focus();
        return false;
     }
     if (!parseInt(dml.ph_acode.value)) {
        alert("Incorrect Phone - Area Code");
        dml.ph_acode.focus();
        return false;
     }
     if (chktrim(dml.ph_number.value).length ==0) {
        alert("Enter Phone Number");
        dml.ph_number.focus();
        return false;
     }
	if (chktrim(dml.username.value).length == 0) {
	    alert("E-mail address can't be left blank");
	    dml.username.focus();
		return false;
	}
	if (dml.username.value.indexOf('@') == -1) {
		alert("Error in e-mail address");
	    dml.username.focus();
	    return false;
	}
	if (dml.username.value.indexOf('.') == -1) {
		alert("Error in e-mail address");
	    dml.username.focus();
		return false;
	}
}	

function validCheckbox1(dml) {
	var pp=1;
	len=dml.elements.length;
	var i=0;
	for(i=0; i<len; i++) {
    	if (dml.elements[i].type == "checkbox" && dml.elements[i].checked==true) {
           	pp=2;
		} 
	}
    if (pp==1) {
    	alert("You have not selected the checkbox");
		return false;
	}  
}

function validCheckbox(dml, msg, delstat) {
	var pp=1;
	len=dml.elements.length;
	var i=0;
	for(i=0; i<len; i++) {
    	if (dml.elements[i].type == "checkbox" && dml.elements[i].checked==true) {
           	pp=2;
		} 
	}
    if (pp==1) {
    	alert("You have not selected the checkbox");
		return false;
	}  
    else if (delstat=="Y")  {
    	return confirm('Are you sure you want to delete')      
	}
	if (dml.table1_title.value.length ==0) {
        alert("Please Enter title for Ist Table");
        dml.table1_title.focus();
        return false;
     }
	if (dml.table2_title.value.length ==0) {
        alert("Please Enter title for IInd Table");
        dml.table2_title.focus();
        return false;
     }
}