﻿// JScript File
function  blankCheck(control,message)
{
    if (control.value=='')
    {
        alert('Please Enter The '+message);
        control.focus();
        return false;
    }
}

function  integerCheck(control,message)
{
    var digits='0123456789';
    var temp;
    for (var i=0;i<control.value.length;i++)
        {
            temp=control.value.substring(i,i+1);
            if (digits.indexOf(temp)==-1)
            {
                alert("'"+temp+"'" +" character in Your "+ message +" seems incorrect. Please try again.");
                control.focus();
                return false;
            }        
        }      
}

function  checkBoxSelection(chkGn,message)
{

   var gnSelStatus=false;
   for (var i=0;i<chkGn.length;i++)
   {
        if (chkGn[i].checked==true)
        {
           gnSelStatus=true;
           break; 
        }
        
   }
   if (gnSelStatus==false)
   {
        chkGn[0].focus();
        alert('Please Select '+message);
        return false;
   }
}



function validateEmails(field, delimiter) {
 var delimiter = delimiter || ';';
 var filter  = /([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+>?$/; 
 var error = 0;

 // Create an array by splitting the field along the delimiter
 var aEmails = field.value.split(';');
 
 // For each of the emails
 for(index = 0; index < aEmails.length; index++) {
  // Trim spaces from the ends
  aEmails[index] = (aEmails[index].replace(/^\s+/,'')).replace(/\s+$/,'');
  // Check whether an email is present
  if(aEmails[index] != '' && aEmails[index].search(filter) == -1)
  {
   error = 1;
   alert('Your Email Id Is Not Valid');
   }
 }
 return error
 
 // Update the value of the field
 field.style.backgroundColor = (error == 1) ? 'FFFFCC' : 'FFFFFF';
}


function clientSideInclude(id, url) 
{ 

var element = document.getElementById(id);
 //debugger;
element.innerText="";

element.innerHTML ="Loading...........";

  var req = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
 //var element = document.getElementById(id);
 if (!element) {
  alert("Bad id " + id +
   "passed to clientSideInclude." +
   "You need a div or span element " +
   "with this id in your page.");
  return;
 }
  if (req) {
    // Synchronous request, wait till we have it all
    req.open('GET', url, false);
    req.send(null);
    
   
    element.innerHTML = req.responseText;
  } else {
    element.innerHTML =
   "Sorry, your browser does not support " +
      "XMLHTTPRequest objects. This page requires " +
      "Internet Explorer 5 or better for Windows, " +
      "or Firefox for any system, or Safari. Other " +
      "compatible browsers may also exist.";
  }
  
  return false;
}





function clientSideInclude1(id,id1, url) 
{

 //debugger;
 
//id -> included  center div 
// id1  -> left div
// url -- Opend page url


var Left=document.getElementById(id1); 
Left.innerText="";
Left.style.width="1";
 Left.innerHTML="";

var element = document.getElementById(id);
//debugger;
element.innerText="";
element.style.width="999";
 
element.innerHTML ="Loading...........";

  var req = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
 //var element = document.getElementById(id);
 if (!element) {
  alert("Bad id " + id +
   "passed to clientSideInclude." +
   "You need a div or span element " +
   "with this id in your page.");
  return;
 }
  if (req) {
    // Synchronous request, wait till we have it all
    req.open('GET', url, false);
    req.send(null);
    
   
    element.innerHTML = req.responseText;
  } else {
    element.innerHTML =
    "Sorry, your browser does not support " +
      "XMLHTTPRequest objects. This page requires " +
      "Internet Explorer 5 or better for Windows, " +
      "or Firefox for any system, or Safari. Other " +
      "compatible browsers may also exist.";
  }
  
  return false;
}



function clientSideInclude2(id,id1, url) 
{
//id -> included  center div 
// id1  -> left div
// url -- Opend page url
//debugger;
var urlLeft="UserControls/LeftLink.htm";

  

var Left=document.getElementById(id1); 
Left.innerText="";
Left.innerHTML="";
Left.style.width="190";

 var req1 = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req1 = new XMLHttpRequest();
    } catch (e) {
      req1 = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req1 = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req1 = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req1 = false;
      }
    }
  }
 //var element = document.getElementById(id);
 if (!Left) {
  alert("Bad id " + id1 +
   "passed to clientSideInclude." +
   "You need a div or span element " +
   "with this id in your page.");
  return;
 }
  if (req1) {
    // Synchronous request, wait till we have it all
    req1.open('GET', urlLeft, false);
    req1.send(null);
    
   
    Left.innerHTML = req1.responseText;
  } else {
    Left.innerHTML =
   "Sorry, your browser does not support " +
      "XMLHTTPRequest objects. This page requires " +
      "Internet Explorer 5 or better for Windows, " +
      "or Firefox for any system, or Safari. Other " +
      "compatible browsers may also exist.";
  }
  
 // return false;
 
  

var element = document.getElementById(id);
 //debugger;
element.innerText="";
element.style.width="616";
element.innerHTML ="Loading...........";

  var req = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
 //var element = document.getElementById(id);
 if (!element) {
  alert("Bad id " + id +
   "passed to clientSideInclude." +
   "You need a div or span element " +
   "with this id in your page.");
  return;
 }
  if (req) {
    // Synchronous request, wait till we have it all
    req.open('GET', url, false);
    req.send(null);
    
   
    element.innerHTML = req.responseText;
  } else {
    element.innerHTML =
   "Sorry, your browser does not support " +
      "XMLHTTPRequest objects. This page requires " +
      "Internet Explorer 5 or better for Windows, " +
      "or Firefox for any system, or Safari. Other " +
      "compatible browsers may also exist.";
  }
  
  return false;
}






function greenbtnmover(item)
{
    //alert('');
    if (item.disabled==false)
    {
        item.style.color='white';
        item.style.fontSize='13px'; 

    }

}
function greenbtnmout(item)
{

    if ((item.value!='Processing...')&&(item.value!='Searching...'))
    { 
        item.style.color='#0033CC';
        item.style.fontSize='12px'; 
    }
} 

function chkboxSelectionmlfml(chk1,chk2,chkidno) {



    switch (chkidno) {
        case 1:
            chk1.checked = true;
            chk2.checked = false;
            break;

        case 2:
            chk1.checked = false;
            chk2.checked = true;
            break;

    }

}


function ValidateMembershipNew(txtName,chkGender,txtAddress,txtCountry,txtState,txtDistrict,txtPinCode,txtTelephone,txtEmail,optSel,mmbrShipOpt)
{
    

    var myBoolean=new Boolean(true);  
 
    //Name 
    myBoolean=blankCheck(txtName,'Name');    
    if(myBoolean==false)
    {   
        return false;
    } 
  
  
  //Gender
    var chkGn=document.getElementsByName(chkGender);

    myBoolean=checkBoxSelection(chkGn,'Gender');    
    if(myBoolean==false)
    {   
        return false;
    }    

//Address

    myBoolean=blankCheck(txtAddress,'Address');    
    if(myBoolean==false)
    {   
        return false;
    } 


//Country

    myBoolean=blankCheck(txtCountry,'Country');    
    if(myBoolean==false)
    {   
        return false;
    } 





myBoolean=CountryCheck(txtCountry,'Country');    
if(myBoolean==false)
{   
     return false;
} 
 






//State

    myBoolean=blankCheck(txtState,'State');    
    if(myBoolean==false)
    {   
        return false;
    } 



//txtPinCode

    myBoolean=blankCheck(txtPinCode,'Pin Code');    
    if(myBoolean==false)
    {   
        return false;
    } 


myBoolean=integerCheck(txtPinCode,'Pin Code');   
if(myBoolean==false)
{   
   // txtZip.style.borderColor='red';
  //  txtZip.style.borderWidth='2px';
    return false;
}
else
{
   // txtZip.style.borderColor='#68c417';
   // txtZip.style.borderWidth='1px';
}

    if(txtPinCode.value.length!=6)
    {
    alert('Please Enter Six Digit Pin Code.');
    txtPinCode.focus();
   //  txtZip.style.borderColor='red';
  //  txtZip.style.borderWidth='2px';
    return false;
    
    }






//txtTelephone

    myBoolean=blankCheck(txtTelephone,'Telephone');    
    if(myBoolean==false)
    {   
        return false;
    } 
 
 myBoolean=integerCheck(txtTelephone,'Phone'); 
 if(myBoolean==false)
{   
  //  txtTel.style.borderColor='red';
  //  txtTel.style.borderWidth='2px';
    return false;
} 
else
{
   // txtTel.style.borderColor='#68c417';
  //  txtTel.style.borderWidth='1px';
} 

if (txtTelephone.value.length<5)
{
    alert("Phone Number Can Not Be Less Than 5 Digits.");
    txtTelephone.focus();
  //  txtTel.style.borderColor='red';
  //  txtTel.style.borderWidth='2px';
    return false;
} 
else
{
  //  txtTel.style.borderColor='#68c417';
  //  txtTel.style.borderWidth='1px';
} 
 
    
//txtEmail

    myBoolean=blankCheck(txtEmail,'Email');    
    if(myBoolean==false)
    {   
        return false;
    } 
    

    var  status=validateEmails(txtEmail);
    if (status=="1")
    {
        txtEmail.focus();
        return false; 
    }     


    var chkOpt=document.getElementsByName(optSel);

    myBoolean=checkBoxSelection(chkOpt,'Interested In Option');    
    if(myBoolean==false)
    {   
        return false;
    }    

//txtTelephone

    var chkOpt=document.getElementsByName(mmbrShipOpt);

    myBoolean=checkBoxSelection(chkOpt,'Area you are intersted ');    
    if(myBoolean==false)
    {   
        return false;
    }    







    document.forms[0].action="MembershipThanks.aspx";


}


function txtBoxOnfoc(txt)
{
txt.style.backgroundColor='#FFFF99';
}


function txtBoxOnBlur(txt)
{
txt.style.backgroundColor='white';
}

 




function HumanBeh(txtName,DOB_Month,DOB_Day,DOB_Year,gender,txtAddress,txtCity,txtTel,txtEmail, beOpt)
{ 
 //debugger;
 var myBoolean=new Boolean(true);  

//Name 
myBoolean=blankCheck(txtName,'Name');    
if(myBoolean==false)
{   
    return false;
}
 
 

var chosenoption=DOB_Month.options[DOB_Month.selectedIndex];  

 if(chosenoption.value=="- Month -")
{
alert('Please Select Month');
 DOB_Month.focus();
   return false;
}


myBoolean=blankCheck(DOB_Day,'DOBDay');    
if(myBoolean==false)
{   
    return false;
}


myBoolean=integerCheck(DOB_Day,'DOB-Day');   
if(myBoolean==false)
{   
     return false;
}
 


// year

//
myBoolean=blankCheck(DOB_Year,'DOB Year');    
if(myBoolean==false)
{   
    return false;
}


myBoolean=integerCheck(DOB_Year,'DOB Year');   
if(myBoolean==false)
{   
     return false;
}
else
{
 }
 //
 //gender
 
var gnd=gender.options[gender.selectedIndex]  
 if(gnd.value=="- Select One -")
{
alert('Please Select Gender');
 gender.focus();
   return false;
}
 //txtAddress
 
myBoolean=blankCheck(txtAddress,'Address');    
if(myBoolean==false)
{   
    return false;
}
//txtCity
myBoolean=blankCheck(txtCity,'City');    
if(myBoolean==false)
{   
    return false;
}
//txtTel 
myBoolean=blankCheck(txtTel,'Phone');    
if(myBoolean==false)
{   
    return false;
}


myBoolean=integerCheck(txtTel,'Phone'); 
 
if(myBoolean==false)
{   
 
    return false;
} 
else
{
  
} 

if (txtTel.value.length<5)
{
    alert("Phone Number Can Not Be Less Than 5 Digits.");
  txtTel.focus();
    return false;
} 
else
{
 
} 
 //txtEmail
 
 
myBoolean=blankCheck(txtEmail,'Email');    
if(myBoolean==false)
{   
   // txtEmail.style.borderColor='red';
   // txtEmail.style.borderWidth='2px';
    return false;
} 
else
{
   // txtEmail.style.borderColor='#68c417';
   // txtEmail.style.borderWidth='1px';
} 


//Email
var  status=validateEmails(txtEmail);
if (status=="1")
{
  //  txtEmail.style.borderColor='red';
   // txtEmail.style.borderWidth='2px';
   txtEmail.focus();
    return false;
} 
else
{
  //  txtEmail.style.borderColor='#68c417';
   // txtEmail.style.borderWidth='1px';
}





  var chkOpt=document.getElementsByName(beOpt);
 
    myBoolean=checkBoxSelection(chkOpt,'Area you are intersted ');    
    if(myBoolean==false)
    {   
        return false;
    }    


    document.forms[0].action="MembershipThanks.aspx?id='Human'";

 

}

 function Reset()
            {
             if (confirm("Are You Sure You Want To Reset All the fields ?","Worldpeacecenter")==true)
                  {
                   return true;
                  }
             else
                {
                return false;
                }
            }


function ValidateMailToUs(txtName,txtEmail,txtAddress,txtCity, txtCountry, txtZip ,txtContactNo,txtMessage)
{
//debugger;
//var txtName=document.getElementById(txtName);
//var txtAddress=document.getElementById(txtAddress);
//var txtContactNo=document.getElementById(txtContactNo);
//var txtEmail=document.getElementById(txtEmail);
//var txtMessage=document.getElementById(txtMessage);

 var myBoolean=new Boolean(true);  


//Name 
myBoolean=blankCheck(txtName,'Name');    
if(myBoolean==false)
{   
    return false;
} 


//Email
myBoolean=blankCheck(txtEmail,'Email');    
if(myBoolean==false)
{   
    return false;
} 




//Email
var  status=validateEmails(txtEmail);
if (status=="1")
{
    txtEmail.focus();
    return false; 
} 



//Address
myBoolean=blankCheck(txtAddress,'Address');    
if(myBoolean==false)
{   
    return false;
} 

// city
myBoolean=blankCheck(txtCity,'City');    
if(myBoolean==false)
{   
    return false;
} 

// country
myBoolean=blankCheck(txtCountry,'Country');    
if(myBoolean==false)
{   
    return false;
} 



myBoolean=CountryCheck(txtCountry,'Country');    
if(myBoolean==false)
{   
     return false;
} 
 




// Zip
myBoolean=blankCheck(txtZip,'Pin Code');    
if(myBoolean==false)
{   
    return false;
}


myBoolean=integerCheck(txtZip,'Zip Code');   
if(myBoolean==false)
{   
   // txtZip.style.borderColor='red';
  //  txtZip.style.borderWidth='2px';
    return false;
}
else
{
   // txtZip.style.borderColor='#68c417';
   // txtZip.style.borderWidth='1px';
}

    if(txtZip.value.length!=6)
    {
    alert('Please Enter Six Digit PinCode.');
    txtZip.focus();
   //  txtZip.style.borderColor='red';
  //  txtZip.style.borderWidth='2px';
    return false;
    
    }


//Contact No.
myBoolean=blankCheck(txtContactNo,'Contact No.');    
if(myBoolean==false)
{   
    return false;
} 


myBoolean=integerCheck(txtContactNo,'Contact No.');   
if(myBoolean==false)
{   
   // txtZip.style.borderColor='red';
  //  txtZip.style.borderWidth='2px';
    return false;
}
else
{
   // txtZip.style.borderColor='#68c417';
   // txtZip.style.borderWidth='1px';
}



if (txtContactNo.value.length<5)
{
    alert("Contact No. Can Not Be Less Than 5 Digits.");
  //  txtTel.style.borderColor='red';
  //  txtTel.style.borderWidth='2px';
  txtContactNo.focus();
    return false;
} 
else
{
  //  txtTel.style.borderColor='#68c417';
  //  txtTel.style.borderWidth='1px';
} 





//txtMessage
myBoolean=blankCheck(txtMessage,'Message');    
if(myBoolean==false)
{   
    return false;
} 


   document.forms[0].action="MailToUsThanks.aspx";

}






//Associate links////



function assLinksOver(it1,it2)
{
//debugger;
var it1=document.getElementById(it1);
var it2=document.getElementById(it2);



it1.style.color='red';
it1.style.fontWeight='bold';
it2.style.color='red';
it2.style.fontWeight='bold';


}

function assLinksOut(it1,it2)
{

var it1=document.getElementById(it1);
var it2=document.getElementById(it2);
 
it1.style.color='#790507';
it1.style.fontWeight='bold';
it2.style.color='#790507';
it2.style.fontWeight='bold';


}


function redirect(redrFirm)
{

    window.location.href=redrFirm;
}




    function hvr(item)
    {
        item.style.backgroundColor='yellow';   
    }
    
    function out(item)
    {
           item.style.backgroundColor='#FFD401';   
    }
    



