function check_subscriber(thisform){
var s=document.subscriber_form;
myOption=-1;
myOption1=-1;
for(i=thisform.country_wise.length-1; i>-1; i--){
if(thisform.country_wise[i].checked){
myOption=i; i=-1;
}
}
if(myOption==-1){
alert("You must select a plan.");
return false;
}
for(j=thisform.month_wise.length-1; j>-1; j--){
if(thisform.month_wise[j].checked){
myOption1=j; j=-1;
}
}
if(myOption1==-1){
alert("You must select a monthly/yearly plan.");
return false;
}
if(s.SubCon.options.length==0)
{
alert("You must select a Country.");
return false;
}
if(s.SubCat.options.length==0)
{
alert("You must select a Category.");
return false;
}
if(s.amount.value=='')
{
alert("You must have amount.Please click on the Calculate Amount:");
return false;
}
var CountryList="";
var CatList="";
var prefered_catlist="";
var prefered_countrylist="";
for(i=s.SubCon.options.length-1;i>=0;i--){
if(i==s.SubCon.options.length-1)
{
CountryList+=s.SubCon[i].value;
prefered_countrylist+=s.SubCon[i].value;
}
else
{
CountryList+="# "+s.SubCon[i].value;
prefered_countrylist+="#"+s.SubCon[i].value;
}
}
if(s.SubCon.options.length==238)
{
CountryList="All Countries";
}
s.conreq.value=CountryList;
for(i=s.SubCat.options.length-1;i>=0;i--){
if(i==s.SubCat.options.length-1)
{
CatList+=s.SubCat[i].value;
prefered_catlist+=s.SubCat[i].value;
}
else
{
CatList+="# "+s.SubCat[i].value;
prefered_catlist+="#"+s.SubCat[i].value;
}
}
s.catreq.value=CatList;
s.prefered_categories.value=prefered_catlist;
s.prefered_country.value=prefered_countrylist;
}
function check_register()
{
var s1=document.register_form;
company=s1.company.value;
company=company.replace(/^[\s]+/,'').replace(/\s*$/,'');
first_name=s1.first_name.value;
first_name=first_name.replace(/^[\s]+/,'').replace(/\s*$/,'');
address=s1.address.value;
address=address.replace(/^[\s]+/,'').replace(/\s*$/,'');
city=s1.city.value;
city=city.replace(/^[\s]+/,'').replace(/\s*$/,'');
zip=s1.zip.value;
zip=zip.replace(/^[\s]+/,'').replace(/\s*$/,'');
pc_code=s1.pc_code.value;
pc_code=pc_code.replace(/^[\s]+/,'').replace(/\s*$/,'');
pa_code=s1.pa_code.value;
pa_code=pa_code.replace(/^[\s]+/,'').replace(/\s*$/,'');
pp_code=s1.pp_code.value;
pp_code=pp_code.replace(/^[\s]+/,'').replace(/\s*$/,'');
cntryrequirements=s1.cntryrequirements.value;
cntryrequirements=cntryrequirements.replace(/^[\s]+/,'').replace(/\s*$/,'');
catrequirements=s1.catrequirements.value;
catrequirements=catrequirements.replace(/^[\s]+/,'').replace(/\s*$/,'');

var regexLetter = /[a-zA-z]/;
if(company.length==0)
{
alert("Please Enter Company Name!");
s1.company.focus();
return(false);
}
else if(first_name.length==0)
{
alert("Please Enter First Name!");
s1.first_name.focus();
return(false);
}
else if(address.length==0)
{
alert("Please Enter Address!");
s1.address.focus();
return(false);
}
else if(city.length==0)
{
alert("Please Enter City!");
s1.city.focus();
return(false);
}
else if(zip.length==0)
{
alert("Please Enter Zip code!");
s1.zip.focus();
return(false);
}
else if(regexLetter.test(s1.zip.value))
{
alert("Zip should not contain alphabets");
s1.zip.focus();
return(false);
}
else if(s1.country.selectedIndex==0)
{
alert("Please Select Country!");
s1.country.focus();
return(false);
}
else if(s1.email.value==''||!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(s1.email.value))) 
{
alert("Invalid Email ID. Kindly enter the correct alternate E-mail ID.");
s1.email.focus();
return(false);
}
else if(pc_code.length==0)
{
alert("Please Enter Phone Country Code!");
s1.pc_code.focus();
return(false);
}
else if(isNaN(s1.pc_code.value))
{
alert("Phone Country Code should be numeric");
s1.pc_code.focus();
return(false);
}

else if(pa_code.length==0)
{
alert("Please Enter Phone Area Code!");
s1.pa_code.focus();
return(false);
}
else if(isNaN(s1.pa_code.value))
{
alert("Phone Area Code should be numeric");
s1.pa_code.focus();
return(false);
}

else if(pp_code.length==0)
{
alert("Please Enter Phone Number!");
s1.pp_code.focus();
return(false);
}
else if(isNaN(s1.pp_code.value))
{
alert("Phone Number should be numeric");
s1.pp_code.focus();
return(false);
}

else if(cntryrequirements.length==0)
{
alert("Please Enter Your Preferred Countries!");
s1.cntryrequirements.focus();
return(false);
}
else if(catrequirements.length==0)
{
alert("Please Enter Your Preferred Products/Services!");
s1.catrequirements.focus();
return(false);
}
newCookie=s1.company.value;
newCookie+="|"+s1.salutation.value;
newCookie+=" "+s1.first_name.value;
newCookie+=" "+s1.last_name.value;
newCookie+="|"+s1.job_title.value;
newCookie+="|"+s1.address.value;
newCookie+="|"+s1.city.value;
newCookie+="|"+s1.state.value;
newCookie+="|"+s1.zip.value;
newCookie+="|"+s1.country.value;
newCookie+="|"+s1.email.value;
newCookie+="|"+s1.pc_code.value;
newCookie+="-"+s1.pa_code.value;
newCookie+="-"+s1.pp_code.value;
newCookie+="|"+s1.fc_code.value;
newCookie+="-"+s1.fa_code.value;
newCookie+="-"+s1.fp_code.value;
newCookie+="|";
setCookie("newImeshID",newCookie);
return true;
}
function setCookie(name, value){
if(value.length>0)
document.cookie=name+"="+escape(value)+";"+"expires="+expires.toGMTString()+";"
}
function check_update()
{
var s2=document.update_form;
if(s2.password.value.length>0 && s2.password.value!=s2.repassword.value)
{
alert("Please Fill Both Passwords Same!");
s2.repassword.focus();
return(false);
}
else if(s2.first_name.value.length==0)
{
alert("Please Enter First Name!");
s2.first_name.focus();
return(false);
}
else if(s2.last_name.value.length==0)
{
alert("Please Enter Last Name!");
s2.last_name.focus();
return(false);
}
else if(s2.country.selectedIndex==0)
{
alert("Please Select Country!");
s2.country.focus();
return(false);
}
else if(s2.city.value.length==0)
{
alert("Please Enter City!");
s2.city.focus();
return(false);
}
else if(s2.pa_code.value.length==0)
{
alert("Please Enter Phone Area Code!");
s2.pa_code.focus();
return(false);
}
else if(s2.pp_code.value.length==0)
{
alert("Please Enter Phone Number!");
s2.pp_code.focus();
return(false);
}
else if(s2.alt_email.value!='' && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(s2.alt_email.value))) 
{
alert("Invalid Email ID. Kindly enter the correct alternate E-mail ID.");
s2.alt_email.focus();
return(false);
}
return true;
}
function check_login()
{
var s3=document.login_form;
s3.usr_id.value=s3.usr_id.value.replace(/^[\s]+/,'');
s3.usr_id.value=s3.usr_id.value.replace(/[\s]+$/,'');
s3.usr_pass.value=s3.usr_pass.value.replace(/^[\s]/,'');
s3.usr_pass.value=s3.usr_pass.value.replace(/[\s]$/,'');
if(s3.usr_id.value.length==0)
{
alert("Please Enter User Id!");
s3.usr_id.focus();
return(false);
}
else if(s3.usr_pass.value.length==0)
{
alert("Please Enter Password!");
s3.usr_pass.focus();
return(false);
}
return true;
}
function check_feedback()
{
var sb=document.feedback;
var regexLetter = /[a-zA-z]/;
var name=sb.realname.value;
name=name.replace(/^[\s]+/,'').replace(/\s*$/,'');
;
var phone=sb.Phone.value;
phone=phone.replace(/^[\s]+/,'').replace(/\s*$/,'');
var feedback=sb.feedback.value;
feedback=feedback.replace(/^[\s]+/,'').replace(/\s*$/,'');

if(name.length==0)
{
alert("Please Enter Your Name!");
sb.realname.focus();
return(false);
}
else if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(sb.email.value))) 
{
alert("Please Enter Correct Email Id!");
sb.email.focus();
return(false);
}
else if(phone.length==0)
{
alert("Please Enter Your Phone Number!");
sb.Phone.focus();
return(false);
}
else if(regexLetter.test(sb.Phone.value))
{
alert("Phone Number should not contain alphabets");
sb.Phone.focus();
return(false);
}
else if(sb.country.selectedIndex==0)
{
alert("Please Select Your Country!");
sb.country.focus();
return(false);
}
else if(feedback.length==0)
{
alert("Please Describe Your Feedback!");
sb.feedback.focus();
return(false);
}
return true;
}
function openchild(url,w,h)
{
msgWindow=window.open(url,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width='+w+',height='+h);
msgWindow.focus();
}
function checkcountry()
{
var s1=document.register_form;
window.opener.s1.cntryrequirements.value="";
var count=0;
var sa=document.country;
for(var i=0;i<sa.elements.length;i++)
{
if(sa.elements[i].checked==true)
{
window.opener.s1.cntryrequirements.value=window.opener.s1.cntryrequirements.value + sa.elements[i].value + "\n";
count=count+1;
}
}
window.opener.s1.citycount.value=count;
self.close();
}
function checkonecountry(selectedcheckbox,countrywise)
{
if(countrywise==1)
{
var count1=0;
var sa=document.country;
for(var i=0;i<sa.elements.length;i++)
{
if(sa.elements[i].checked==true && i != selectedcheckbox-1)
{
count1=count1+1;
sa.elements[i].checked=false;
}
}
if(count1>0)
{
alert("You can not select more than one country");
}
}
}
function checkonecategory(selectedcheckbox,catwise)
{
if(catwise==2)
{
var count1=0;
var s4=document.category;
for(var i=0;i<s4.elements.length;i++)
{
if(s4.elements[i].checked==true && i != selectedcheckbox-1 )
{
count1=count1+1;
s4.elements[i].checked=false;
}
}
if(count1>0)
{
alert("You can not select more than one Products/ Services");
}
}
}
function againcheckcountry()
{
var s1=document.register_form;
var all_sel_countries=new Array();
var sa=document.country;
all_sel_countries=window.opener.s1.cntryrequirements.value.split("\n");
for(var i=0;i<sa.elements.length;i++)
{
for(var j=0;j<all_sel_countries.length-1;j++)
{
if(sa.elements[i].value==all_sel_countries[j])
{
sa.elements[i].checked=true;
break;
}
}
}
}
function show_hide_child(child,image)
{
var childid=document.getElementById('child'+child);
if(childid.style.display=="none")
{
childid.style.display="";	
image.src="/gifs/minus.gif";
}
else
{
childid.style.display="none";
image.src="/gifs/zero.gif";
}
}
function checkcategory()
{
var s1=document.register_form;
var s4=document.category;
window.opener.s1.catrequirements.value="";
var count=0;
for(var i=0;i<s4.elements.length;i++)
{
if(s4.elements[i].checked==true)
{
window.opener.s1.catrequirements.value=window.opener.s1.catrequirements.value+s4.elements[i].value+"\n\n";
count=count+1;
}
}
window.opener.s1.catcount.value=count;
self.close();
}
function show_hide_products(image)
{
var childid=document.getElementById('products_table');
if(childid.style.display=="none")
{
childid.style.display="";	
image.src="/gifs/minus.gif";
}
else
{
childid.style.display="none";
image.src="/gifs/plus.gif";
}
}
function show_hide_services(image)
{
var childid=document.getElementById('services_table');
if(childid.style.display=="none")
{
childid.style.display="";	
image.src="/gifs/minus.gif";
}
else
{
childid.style.display="none";
image.src="/gifs/plus.gif";
}
}
function CheckDataSearch(Form)
{
Form.q.value=Form.q.value.replace(/^\s+/g,'').replace(/\s+$/g,'');
if(Form.q.value.length<3)
{
alert("Enter at least three characters for search.");
Form.q.focus();
return false;
}
}
function addOption_list(){
var s=document.subscriber_form;
for(i=s.Category.options.length-1;i>=0;i--){
var Category=s.Category;
if(s.Category[i].selected){
if(s.country_wise[1].checked)
{
s.addcategory.disabled=true;
s.Category.disabled=true;
}
var k=addOption(s.SubCat, s.Category[i].value, s.Category[i].value);
if(k!=false)
{
removeOption(Category,i);
}
}
}
s.amount.value='';
}
function addOptionCountry_list(){
var s=document.subscriber_form;
for(i=s.Country.options.length-1;i>=0;i--){
var Country=s.Country;
if(s.Country[i].selected){
if(s.country_wise[0].checked)
{
s.addcountry.disabled=true;
s.Country.disabled=true;
}
addOption(s.SubCon, s.Country[i].value, s.Country[i].value);
removeOption(Country,i);
}
}
s.amount.value='';
}
function removeOptions_list(){
var s=document.subscriber_form;
for(i=s.SubCat.options.length-1;i>=0;i--){
var Category=s.SubCat;
if(s.SubCat[i].selected){
if(s.country_wise[1].checked)
{
s.addcategory.disabled=false;
s.Category.disabled=false;
}
addOption(s.Category, s.SubCat[i].value, s.SubCat[i].value);
removeOption(Category,i);
}
}
s.amount.value='';
}
function removeOptionsCountry_list(){
var s=document.subscriber_form;
for(i=s.SubCon.options.length-1;i>=0;i--){
var Country=s.SubCon;
if(s.SubCon[i].selected){
if(s.country_wise[0].checked)
{
s.addcountry.disabled=false;
s.Country.disabled=false;
}
addOption(s.Country, s.SubCon[i].value, s.SubCon[i].value);
removeOption(Country,i);
}
}
s.amount.value='';
}
function move_all_CountryOption(selectbox){
var s=document.subscriber_form;
for(i=s.Country.options.length-1;i>=0;i--){
var Country=s.Country;
addOption(s.SubCon, s.Country[i].value, s.Country[i].value);
}
removeAllOptionsCategory(s.Country);
s.amount.value='';
}
function removeAllOptionsCategory(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
selectbox.remove(i);
}
}
function removeAllOptionsCountry(selectbox)
{
var s=document.subscriber_form;
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
addOption(s.Country, s.SubCon[i].value, s.SubCon[i].value);
selectbox.remove(i);
}
s.amount.value='';
}
function addOption(selectbox,text,value)
{
var s=document.subscriber_form;
if(s.country_wise[0].checked)
{
if(selectbox.name=='SubCat' && selectbox.length==5)
{
alert("You cannot add more than five categories.");
return false;
}
if(selectbox.name=='SubCon' && selectbox.length==1)
{
alert("You cannot add more than one country.");
return false;
}
}
else if(s.country_wise[1].checked)
{
if(selectbox.name=='SubCat' && selectbox.length==1)
{
alert("You cannot add more than One category.");
return false;
}
}
var optn=document.createElement("OPTION");
optn.text=text;
optn.value=value;
selectbox.options.add(optn);
}
function removeOption(listbox,i)
{
listbox.remove(i);
}
function enablebutton()
{
var s=document.subscriber_form;
if(s.country_wise[0].checked)
{
s.addcategory.disabled=false;
s.removecategory.disabled=false;
s.addcountry.disabled=false;
s.addallcountry.disabled=true;
s.removecountry.disabled=false;
s.removeallcountry.disabled=true;
s.Country.disabled=false;
s.Category.disabled=false;
removeAllOptionsCountry(s.SubCon);
removeAllOptionsCategory(s.SubCat);
}
else if(s.country_wise[1].checked)
{
s.addcategory.disabled=false;
s.removecategory.disabled=false;
s.addcountry.disabled=false;
s.addallcountry.disabled=false;
s.removecountry.disabled=false;
s.removeallcountry.disabled=false;
s.Country.disabled=false;
s.Category.disabled=false;
removeAllOptionsCountry(s.SubCon);
removeAllOptionsCategory(s.SubCat);
}
s.amount.value='';
}
function emptyamount()
{
var s=document.subscriber_form;
s.amount.value='';
}
function calculateamount()
{
var s=document.subscriber_form;
myOption=-1;
myOption1=-1;
for(i=s.country_wise.length-1; i>-1; i--){
if(s.country_wise[i].checked){
myOption=i; i=-1;
}
}
var total_cat=s.SubCat.options.length;
var total_con=s.SubCon.options.length;
var total_amount=0;
if(s.country_wise[0].checked)
{
if(total_con==1 && total_cat>=1)
{
if(s.month_wise[0].checked)
{
total_amount=399+79*(total_cat-1);
}
else if(s.month_wise[1].checked)
{
total_amount=599+99*(total_cat-1);
}
}
s.amount.value=total_amount;
}
else if(s.country_wise[1].checked)
{
if(total_cat==1 && total_con>=1)
{
if(s.month_wise[0].checked)
{
total_amount=399+79*(total_con-1);
if(total_amount>799)
{
total_amount=799;
}
}
else if(s.month_wise[1].checked)
{
total_amount=599+99*(total_con-1);
if(total_amount>1099)
{
total_amount=1099;
}
}
}
s.amount.value=total_amount;
}
}
var xmlHttp
function showUser(pid)
{ 
xmlHttp=GetXmlHttpObject()
if(xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="/includes/tender_payment.php"
url=url+"?pid="+pid
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged() 
{ 
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
if(xmlHttp.responseText==-1)
{
alert('This tender has been expired.');
return false;
}
else
{
document.tenders.orders_id.value=xmlHttp.responseText;
document.tenders.submit();
}
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}