﻿// JScript File

function myopen(myurl) {
var win=window.open(myurl);
win.focus();
return;
 }
// Registration for user
function isAlphabet(elem, helperMsg)
{
      var alphaExp = "[^'.a-z|A-Z|+|$ ]";      
      
      if(elem.value.match(alphaExp))
      {
            alert(helperMsg);
            elem.focus();
            return false;
      }
      else
      {      
      return true;
      }
}

function isAlphabetnum(elemnew, helperMsgnew)
{
      var alphaExpnew = "[^'a-z|A-Z|+|$ 0-9]";      
      
      if(elemnew.value.match(alphaExpnew))
      {
            alert(helperMsgnew);
            elemnew.focus();
            return false;
      }
      else
      {      
      return true;
      }
}

function loginfront()
{

     if (document.getElementById('ctl00_CPH_txt_username').value=="")
        {
            alert("Please enter your email id");
            document.getElementById('ctl00_CPH_txt_username').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_username').value!="")
        {        
           if (checkEmail(document.getElementById('ctl00_CPH_txt_username').value)==1)
             {
                 alert("Please enter valid email address");
                 document.getElementById('ctl00_CPH_txt_username').focus();
                 return false;
             }
        } 
      if (document.getElementById('ctl00_CPH_txt_password').value=="")
        {
            alert("Please enter your password");
            document.getElementById('ctl00_CPH_txt_password').focus();
            return false;
        }
}



function check_cookie()
{
    if (navigator.cookieEnabled == 0) {
      alert("Cookies needs to be enabled for site to work!");
    }
}
function valid_event()
{

     if (document.getElementById('ctl00_CPH_txt_name').value=="")
        {
            alert("Please enter your name");
            document.getElementById('ctl00_CPH_txt_name').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_name').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_name'),"Please enter alphabets only")))
          {
               return false;
          }
        }
         if (document.getElementById('ctl00_CPH_txt_org').value=="")
        {
            alert("Please enter your Organisation name");
            document.getElementById('ctl00_CPH_txt_org').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_org').value!="")
        {        
          if(!(validchar(document.getElementById('ctl00_CPH_txt_org'),"Special characters are not allowed")))
          {
               return false;
          }
        }
      
       if (document.getElementById('ctl00_CPH_txt_mobile').value=="")
        {
            alert("Please enter your Mobile no.");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txt_mobile').value!="")
        {
           if (!(val_mobile(document.getElementById('ctl00_CPH_txt_mobile').value)))
           {
            alert("Please enter valid mobile number");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
            }
        }
         if (document.getElementById('ctl00_CPH_txt_email').value=="")
        {
            alert("Please enter your E-mail ID");
            document.getElementById('ctl00_CPH_txt_email').focus();
            return false;
        }
         if (checkEmail(document.getElementById('ctl00_CPH_txt_email').value)==1)
         {
             alert("Please enter valid email address");
             document.getElementById('ctl00_CPH_txt_email').focus();
             return false;
         }
         if(document.getElementById('ctl00_CPH_txtInterest')!=null)
         {
        if (document.getElementById('ctl00_CPH_txtInterest').value=="")
        {
            alert("Please enter your interests");
            document.getElementById('ctl00_CPH_txtInterest').focus();
            return false;
        }
        }
         if(document.getElementById('ctl00_CPH_txtInterest')!=null)
         {
       if (document.getElementById('ctl00_CPH_txtInterest').value!="")
        {
           if (!(validchar(document.getElementById('ctl00_CPH_txtInterest'),"special characters are not allowed")))
           {
            return true;
            }
        }
        }
        
        
}
function valid_invest()
{


     if (trim(document.getElementById('ctl00_CPH_txt_name').value)=="")
        {
            alert("Please enter your name");
            document.getElementById('ctl00_CPH_txt_name').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_name').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_name'),"Please enter alphabets only")))
          {
               return false;
          }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_org').value)=="")
        {
            alert("Please enter your Organisation name");
            document.getElementById('ctl00_CPH_txt_org').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_org').value!="")
        {        
          if(!(validchar(document.getElementById('ctl00_CPH_txt_org'),"Special characters are not allowed")))
          {
               return false;
          }
        }
      
       if (trim(document.getElementById('ctl00_CPH_txt_mobile').value)=="")
        {
            alert("Please enter your Mobile no.");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txt_mobile').value!="")
        {
           if (!(val_mobile(document.getElementById('ctl00_CPH_txt_mobile').value)))
           {
            alert("Please enter valid mobile number");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_email').value)=="")
        {
            alert("Please enter your E-mail ID");
            document.getElementById('ctl00_CPH_txt_email').focus();
            return false;
        }
         if (checkEmail(document.getElementById('ctl00_CPH_txt_email').value)==1)
         {
             alert("Please enter valid email address");
             document.getElementById('ctl00_CPH_txt_email').focus();
             return false;
         }
        if(document.getElementById('ctl00_CPH_txtbriefinfo')!= null)
        { 
            if(trim(document.getElementById('ctl00_CPH_txtbriefinfo').value)=="")
            {
                alert("Please provide brief information");
                document.getElementById('ctl00_CPH_txtbriefinfo').focus();
                return false;
            }  
            if (document.getElementById('ctl00_CPH_txtbriefinfo').value!="")
            {
               if (!(validchar(document.getElementById('ctl00_CPH_txtbriefinfo'),"special characters are not allowed")))
               {
                return true;
               }
            }
        }
}
function valid_winetaste()
{


     if (trim(document.getElementById('ctl00_CPH_txt_name').value)=="")
        {
            alert("Please enter your name");
            document.getElementById('ctl00_CPH_txt_name').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_name').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_name'),"Please enter alphabets only")))
          {
               return false;
          }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_title').value)=="")
        {
            alert("Please enter your title");
            document.getElementById('ctl00_CPH_txt_title').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_title').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_title'),"Please enter alphabets only")))
          {
               return false;
          }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_org').value)=="")
        {
            alert("Please enter your Organisation name");
            document.getElementById('ctl00_CPH_txt_org').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_org').value!="")
        {        
          if(!(validchar(document.getElementById('ctl00_CPH_txt_org'),"Special characters are not allowed")))
          {
               return false;
          }
        }
        if (trim(document.getElementById('ctl00_CPH_txt_telephone').value)=="")
        {
            alert("Please enter your telephone number");
            document.getElementById('ctl00_CPH_txt_telephone').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txt_telephone').value!="")
        {
           if (!(val_phone(document.getElementById('ctl00_CPH_txt_telephone').value)))
           {
            alert("Please enter valid telephone number");
            document.getElementById('ctl00_CPH_txt_telephone').focus();
            return false;
            }
        }
       if (trim(document.getElementById('ctl00_CPH_txt_mobile').value)=="")
        {
            alert("Please enter your Mobile no.");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txt_mobile').value!="")
        {
           if (!(val_mobile(document.getElementById('ctl00_CPH_txt_mobile').value)))
           {
            alert("Please enter valid mobile number");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_email').value)=="")
        {
            alert("Please enter your E-mail ID");
            document.getElementById('ctl00_CPH_txt_email').focus();
            return false;
        }
         if (checkEmail(document.getElementById('ctl00_CPH_txt_email').value)==1)
         {
             alert("Please enter valid email address");
             document.getElementById('ctl00_CPH_txt_email').focus();
             return false;
         }
        if(document.getElementById('ctl00_CPH_txtbriefinfo')!= null)
        {  
            if (trim(document.getElementById('ctl00_CPH_txtbriefinfo').value)=="")
            {
                alert("Please provide brief information");
                document.getElementById('ctl00_CPH_txtbriefinfo').focus();
                return false;
            }  
            if (document.getElementById('ctl00_CPH_txtbriefinfo').value!="")
            {
               if (!(validchar(document.getElementById('ctl00_CPH_txtbriefinfo'),"special characters are not allowed")))
               {
                return true;
               }
            }
        }
}
function valid_defence()
{


     if (trim(document.getElementById('ctl00_CPH_txt_name').value)=="")
        {
            alert("Please enter your name");
            document.getElementById('ctl00_CPH_txt_name').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_name').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_name'),"Please enter alphabets only")))
          {
               return false;
          }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_title').value)=="")
        {
            alert("Please enter your title");
            document.getElementById('ctl00_CPH_txt_title').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_title').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_title'),"Please enter alphabets only")))
          {
               return false;
          }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_org').value)=="")
        {
            alert("Please enter your Organisation name");
            document.getElementById('ctl00_CPH_txt_org').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_org').value!="")
        {        
          if(!(validchar(document.getElementById('ctl00_CPH_txt_org'),"Special characters are not allowed")))
          {
               return false;
          }
        }
        if ((document.getElementById('ctl00_CPH_txt_std').value=="")||(document.getElementById('ctl00_CPH_txt_std').value.length < 3))
        {
            alert("Please enter the STD code");
            document.getElementById('ctl00_CPH_txt_std').focus();
            return false;
        }        
        if (document.getElementById('ctl00_CPH_txt_std').value!="")
        {
           if (!(stdcode(document.getElementById('ctl00_CPH_txt_std').value)))
           {
            alert("Please enter valid Std code");
            document.getElementById('ctl00_CPH_txt_std').focus();
            return false;
            }
         }
        if (trim(document.getElementById('ctl00_CPH_txt_telephone').value)=="")
        {
            alert("Please enter your telephone number");
            document.getElementById('ctl00_CPH_txt_telephone').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txt_telephone').value!="")
        {
           if (!(val_phone(document.getElementById('ctl00_CPH_txt_telephone').value)))
           {
            alert("Please enter valid telephone number");
            document.getElementById('ctl00_CPH_txt_telephone').focus();
            return false;
            }
        }
         if ((document.getElementById('ctl00_CPH_txt_code').value=="") ||(document.getElementById('ctl00_CPH_txt_code').value.length < 3))
        {
            alert("Please enter the country code");
            document.getElementById('ctl00_CPH_txt_code').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_code').value!="")
        {
           if (!(stdcode(document.getElementById('ctl00_CPH_txt_code').value)))
           {
            alert("Please enter valid country code");
            document.getElementById('ctl00_CPH_txt_code').focus();
            return false;
            }
         }
       if (trim(document.getElementById('ctl00_CPH_txt_mobile').value)=="")
        {
            alert("Please enter your Mobile no.");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txt_mobile').value!="")
        {
           if (!(val_mobile(document.getElementById('ctl00_CPH_txt_mobile').value)))
           {
            alert("Please enter valid mobile number");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_email').value)=="")
        {
            alert("Please enter your E-mail ID");
            document.getElementById('ctl00_CPH_txt_email').focus();
            return false;
        }
         if (checkEmail(document.getElementById('ctl00_CPH_txt_email').value)==1)
         {
             alert("Please enter valid email address");
             document.getElementById('ctl00_CPH_txt_email').focus();
             return false;
         }
        if(document.getElementById('ctl00_CPH_txtbriefinfo')!= null)
        {  
            if (trim(document.getElementById('ctl00_CPH_txtbriefinfo').value)=="")
            {
                alert("Please provide brief information");
                document.getElementById('ctl00_CPH_txtbriefinfo').focus();
                return false;
            }  
            if (document.getElementById('ctl00_CPH_txtbriefinfo').value!="")
            {
               if (!(validchar(document.getElementById('ctl00_CPH_txtbriefinfo'),"special characters are not allowed")))
               {
                return true;
               }
            }
        }
}
function val_partener()
{
    if (document.getElementById('ctl00_CPH_txt_name').value=="")
        {
            alert("Please enter your name");
            document.getElementById('ctl00_CPH_txt_name').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_name').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_name'),"Please enter alphabets only")))
          {
               return false;
          }
        }
         if (document.getElementById('ctl00_CPH_txt_org').value=="")
        {
            alert("Please enter your Organisation name");
            document.getElementById('ctl00_CPH_txt_org').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_org').value!="")
        {        
          if(!(validchar(document.getElementById('ctl00_CPH_txt_org'),"Special characters are not allowed")))
          {
               return false;
          }
        }
      
       if (document.getElementById('ctl00_CPH_txt_mobile').value=="")
        {
            alert("Please enter your Mobile no.");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txt_mobile').value!="")
        {
           if (!(val_phone(document.getElementById('ctl00_CPH_txt_mobile').value)))
           {
            alert("Please enter valid mobile number");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
            }
        }
         if (document.getElementById('ctl00_CPH_txt_email').value=="")
        {
            alert("Please enter your E-mail ID");
            document.getElementById('ctl00_CPH_txt_email').focus();
            return false;
        }
         if (checkEmail(document.getElementById('ctl00_CPH_txt_email').value)==1)
         {
             alert("Please enter valid email address");
             document.getElementById('ctl00_CPH_txt_email').focus();
             return false;
         }
         
           if (document.getElementById('ctl00_CPH_txtInterest').value=="")
        {
            alert("Please enter your interests");
            document.getElementById('ctl00_CPH_txtInterest').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txtInterest').value!="")
        {
           if (!(validchar(document.getElementById('ctl00_CPH_txtInterest'),"special characters are not allowed")))
           {
            return true;
            }
        }
}

function valid_register()
{

     if (document.getElementById('ctl00_CPH_firstname').value=="")
        {
            alert("Please enter your firstname");
            document.getElementById('ctl00_CPH_firstname').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_firstname').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_firstname'),"Please enter alphabets only")))
          {
               return false;
          }
        } 
      if (document.getElementById('ctl00_CPH_lastname').value=="")
        {
            alert("Please enter your lastname");
            document.getElementById('ctl00_CPH_lastname').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_lastname').value!="")
        {
         if(!(isAlphabet(document.getElementById('ctl00_CPH_lastname'),"Please enter alphabets only")))
          {
               return false;
          }
          
        } 
       if (document.getElementById('ctl00_CPH_txtusername').value=="")
        {
            alert("Please enter your Email ID");
            document.getElementById('ctl00_CPH_txtusername').focus();
            return false;
        }

    if (checkEmail(document.getElementById('ctl00_CPH_txtusername').value)==1)
         {
             alert("Please enter valid email address");
             document.getElementById('ctl00_CPH_txtusername').focus();
             return false;
         }
       if (document.getElementById('ctl00_CPH_txtpassword').value=="")
        {
            alert("Please enter your password");
            document.getElementById('ctl00_CPH_txtpassword').focus();
            return false;
        }
      if (document.getElementById('ctl00_CPH_txtpassword').value!="")
        {
         if ((document.getElementById('ctl00_CPH_txtpassword').value.length<6) || (document.getElementById('ctl00_CPH_txtpassword').value.length>15))
             {
                alert("Password length should be 6 to 15 characters only");
                document.getElementById('ctl00_CPH_txtpassword').focus();
                return false;
             }
       }
        
       if (document.getElementById('ctl00_CPH_txttitle').value=="")
        {
            alert("Please enter the title");
            document.getElementById('ctl00_CPH_txttitle').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txttitle').value!="")
        {
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txttitle'),"Please enter alphabets only")))
          {
               return false;
          }
          
        } 
       if (document.getElementById('ctl00_CPH_org').value=="")
        {
            alert("Please enter the organisation");
            document.getElementById('ctl00_CPH_org').focus();
            return false;
         }  
 
        if (document.getElementById('ctl00_CPH_address').value=="")
        {
            alert("Please enter the address");
            document.getElementById('ctl00_CPH_address').focus();
            return false;
         }  
        if (document.getElementById('ctl00_CPH_txt_std').value=="")
        {
            alert("Please enter the STD code");
            document.getElementById('ctl00_CPH_txt_std').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_std').value!="")
        {
           if (!(stdcode(document.getElementById('ctl00_CPH_txt_std').value)))
           {
            alert("Please enter valid Std code");
            document.getElementById('ctl00_CPH_txt_std').focus();
            return false;
            }
         }
          if (document.getElementById('ctl00_CPH_txt_std').value!="")
        {
         if ((document.getElementById('ctl00_CPH_txt_std').value.length<3))
             {
                alert("Std code should be minimum 3 characters");
                document.getElementById('ctl00_CPH_txt_std').focus();
                return false;
             }
       }
        
        if (document.getElementById('ctl00_CPH_tel').value=="")
        {
            alert("Please enter the telephone");
            document.getElementById('ctl00_CPH_tel').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_tel').value!="")
        {
           if (!(val_phone(document.getElementById('ctl00_CPH_tel').value)))
           {
            alert("Please enter valid telephone number");
            document.getElementById('ctl00_CPH_tel').focus();
            return false;
            }
        }
        if (document.getElementById('ctl00_CPH_faxno').value=="")
        {
            alert("Please enter the fax number");
            document.getElementById('ctl00_CPH_faxno').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_faxno').value!="")
        {
           if (!(val_phone(document.getElementById('ctl00_CPH_faxno').value)))
           {
            alert("Please enter valid fax number");
            document.getElementById('ctl00_CPH_faxno').focus();
            return false;
            }
        }
        if (document.getElementById('ctl00_CPH_mobile').value=="")
        {
            alert("Please enter the mobile number");
            document.getElementById('ctl00_CPH_mobile').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_mobile').value!="")
        {
           if (!(val_mobile(document.getElementById('ctl00_CPH_mobile').value)))
           {
            alert("Please enter valid mobile number");
            document.getElementById('ctl00_CPH_mobile').focus();
            return false;
            }
        }          
        
        if (trim(document.getElementById('ctl00_CPH_txtproducts').value)=="")
        {
            if (document.getElementById('ctl00_CPH_txtproducts').value.length>0)        
            {           
                alert("Please enter valid inputs");
                document.getElementById('ctl00_CPH_txtproducts').focus();
                return false;          
            }
        }
        
         if (trim(document.getElementById('ctl00_CPH_txtsupplies').value)=="") 
         {
            if(document.getElementById('ctl00_CPH_txtsupplies').value.length>0)        
            {           
                alert("Please enter valid inputs");
                document.getElementById('ctl00_CPH_txtsupplies').focus();
                return false;          
            }
         }
         if (trim(document.getElementById('ctl00_CPH_txtservices').value)=="")
         {
             if(document.getElementById('ctl00_CPH_txtservices').value.length>0)        
            {           
                alert("Please enter valid inputs");
                document.getElementById('ctl00_CPH_txtservices').focus();
                return false;          
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txtdistributors').value)=="")
         {
             if(document.getElementById('ctl00_CPH_txtdistributors').value.length>0)
            {           
                alert("Please enter valid inputs");
                document.getElementById('ctl00_CPH_txtdistributors').focus();
                return false;          
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txtpartnership').value)=="")
         {
             if(document.getElementById('ctl00_CPH_txtpartnership').value.length>0)        
            {           
                alert("Please enter valid inputs");
                document.getElementById('ctl00_CPH_txtpartnership').focus();
                return false;          
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txtfranchisee').value)=="")
         {
             if(document.getElementById('ctl00_CPH_txtfranchisee').value.length>0)
            {           
                alert("Please enter valid inputs");
                document.getElementById('ctl00_CPH_txtfranchisee').focus();
                return false;          
            }
         }
         if (trim(document.getElementById('ctl00_CPH_txteducation').value)=="") 
         {
             if(document.getElementById('ctl00_CPH_txteducation').value.length>0)
            {           
                alert("Please enter valid inputs");
                document.getElementById('ctl00_CPH_txteducation').focus();
                return false;          
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txtinvestment').value)=="")
         {
             if(document.getElementById('ctl00_CPH_txtinvestment').value.length>0)
            {           
                alert("Please enter valid inputs");
                document.getElementById('ctl00_CPH_txtinvestment').focus();
                return false;          
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txtcorporate').value)=="")
         {
             if(document.getElementById('ctl00_CPH_txtcorporate').value.length>0)
            {           
                alert("Please enter valid inputs");
                document.getElementById('ctl00_CPH_txtcorporate').focus();
                return false;          
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txtinterests').value)=="")
         {
             if(document.getElementById('ctl00_CPH_txtinterests').value.length>0)
            {           
                alert("Please enter valid inputs");
                document.getElementById('ctl00_CPH_txtinterests').focus();
                return false;          
            }
          }  
        
       if (document.getElementById('ctl00_CPH_TextBox1').value=="")
        {
            alert("Please enter the text that you see in the image");
            document.getElementById('ctl00_CPH_TextBox1').focus();
            return false;
        }
       
}
   
  
function ValidateName(s,args)
  {
     if(args.Value.length < 6 || args.Value.length >15)
      {
       args.IsValid = false
      }
      else
      {                  
        if(args.Value.match(' '))
        {
            args.IsValid = false
        }                  
      }
  }
  
  //

function gtdata()
{
    if (document.getElementById("ctl00_key").value!="")
    {
        window.location.href="Search.aspx?key=" + document.getElementById("ctl00_key").value;
    }
}

function alphanum(alphane)
{
var numaric = alphane;

    for(j=0; j<numaric.length; j++)
    {
        var alphaa = numaric.charAt(j);
         var hh = alphaa.charCodeAt(0);
          if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
		  {
		   
		  }
		  else	
		  {
		
			 return false;
		  }
   
    }
}
function validchar(intext, helperMsg)
{
      var alphaExp =/[<>@%+]$/;  
      if(intext.value.match(alphaExp))
      {
            alert(helperMsg);
            intext.focus();
            return false;
      }else
      {       
          return true;
      }
}
function isAddress(elem,helperMsg)
{
      var alphaExp = /[^-#.',a-zA-Z0-9 \s]/;      
      if(elem.value.match(alphaExp))
      {          
           alert(helperMsg);         
           elem.focus();
           return false;

      }else
      {         
           return true;
      }
}

//Response form
function validaterform()
{
 if (document.getElementById('ctl00_CPH_Txtinform').value=="")
        {
            alert("Please provide the information");
            document.getElementById('ctl00_CPH_Txtinform').focus();
            return false;
        }
  else
        {
         if(!(validchar(document.getElementById('ctl00_CPH_Txtinform'),"Special characters are not allowed")))
          {
               return false;
          }
          
        } 
   
}
// Event registration 

function validateeventreg()
{  
    if (document.getElementById('ctl00_CPH_TextBox1')!=null)
    {
        if (document.getElementById('ctl00_CPH_TextBox1').value=="")
        {
            alert("Please enter the date");
            document.getElementById('ctl00_CPH_TextBox1').focus();
            return false;
        }
        else
        {            
            if(validatedatereg(document.getElementById('ctl00_CPH_TextBox1').value)==0)
            {
                alert("Please enter valid date");
                document.getElementById('ctl00_CPH_TextBox1').focus();
                return false;
            }
        }
    }
    
    if (document.getElementById('ctl00_CPH_TextBox2')!=null)
    {
        if (document.getElementById('ctl00_CPH_TextBox2').value=="")
        {
            alert("Please enter the time");
            document.getElementById('ctl00_CPH_TextBox2').focus();
            return false;
        }
    }
    if (document.getElementById('ctl00_CPH_name1').value=="")
        {
            alert("Please enter your Name");
            document.getElementById('ctl00_CPH_name1').focus();
            return false;
        }
    if (document.getElementById('ctl00_CPH_name1').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_name1'),"Please enter alphabets only")))
          {
               return false;
          }
        } 
   if (document.getElementById('ctl00_CPH_title1').value=="")
        {
            alert("Please enter your Title");
            document.getElementById('ctl00_CPH_title1').focus();
            return false;
        }
    if (document.getElementById('ctl00_CPH_title1').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_title1'),"Please enter alphabets only")))
          {
               return false;
          }
        } 
   if (document.getElementById('ctl00_CPH_mobile1').value=="")
        {
            alert("Please enter your mobile number");
            document.getElementById('ctl00_CPH_mobile1').focus();
            return false;
        }
    else
    {
         if (!(val_mobile(document.getElementById('ctl00_CPH_mobile1').value)))
           {
            alert("Please enter valid mobile number");
            document.getElementById('ctl00_CPH_mobile1').focus();
            return false;
            }
    }
   
    if (document.getElementById('ctl00_CPH_eml1').value=="")
        {
            alert("Please enter the email");
            document.getElementById('ctl00_CPH_eml1').focus();
            return false;
        }
   else
   {
        if (checkEmail(document.getElementById('ctl00_CPH_eml1').value)==1)
             {
                 alert("Please enter valid email address");
                 document.getElementById('ctl00_CPH_eml1').focus();
                 return false;
             }
    }
    if (document.getElementById('ctl00_CPH_name2').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_name2'),"Please enter alphabets only")))
          {
               return false;
          }
        } 
    if (document.getElementById('ctl00_CPH_title2').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_title2'),"Please enter alphabets only")))
          {
               return false;
          }
        } 
    if (document.getElementById('ctl00_CPH_mobile2').value!="")
    {
         if (!(val_phone(document.getElementById('ctl00_CPH_mobile2').value)))
           {
            alert("Please enter valid mobile number");
            document.getElementById('ctl00_CPH_mobile2').focus();
            return false;
            }
    }
  if (document.getElementById('ctl00_CPH_eml2').value!="")
   {
        if (checkEmail(document.getElementById('ctl00_CPH_eml2').value)==1)
             {
                 alert("Please enter valid email address");
                 document.getElementById('ctl00_CPH_eml2').focus();
                 return false;
             }
    }
     if (document.getElementById('ctl00_CPH_name3').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_name3'),"Please enter alphabets only")))
          {
               return false;
          }
        }
          if (document.getElementById('ctl00_CPH_title3').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_title3'),"Please enter alphabets only")))
          {
               return false;
          }
        } 
  if (document.getElementById('ctl00_CPH_mobile3').value!="")
   {
         if (!(val_phone(document.getElementById('ctl00_CPH_mobile3').value)))
           {
            alert("Please enter valid mobile number");
            document.getElementById('ctl00_CPH_mobile3').focus();
            return false;
            }
    }
  if (document.getElementById('ctl00_CPH_eml3').value!="")
   {
        if (checkEmail(document.getElementById('ctl00_CPH_eml3').value)==1)
             {
                 alert("Please enter valid email address");
                 document.getElementById('ctl00_CPH_eml3').focus();
                 return false;
             }
    }
    
      if (document.getElementById('ctl00_CPH_chk1')!=null)
    {
       
    
        if ((document.getElementById('ctl00_CPH_chk1').value!="") &&(document.getElementById('ctl00_CPH_chk1').value!="on"))
        {     
       
            return false;
        }
    }
      if (document.getElementById('ctl00_CPH_chk2')!=null)
    {

           if ((document.getElementById('ctl00_CPH_chk2').value!="") &&(document.getElementById('ctl00_CPH_chk2').value!="on"))
        {       
            return false;
        }
    }
      if (document.getElementById('ctl00_CPH_Checkbox1')!=null)
    {
        if ((document.getElementById('ctl00_CPH_Checkbox1').value!="") &&(document.getElementById('ctl00_CPH_Checkbox1').value!="on"))
        {       
            return false;
        }
    }
      if (document.getElementById('ctl00_CPH_Checkbox2')!=null)
    {
           if ((document.getElementById('ctl00_CPH_Checkbox2').value!="") &&(document.getElementById('ctl00_CPH_Checkbox2').value!="on"))
        {       
            return false;
        }
    }
    
}

 function validateschedule()
 {
     if (document.getElementById('ctl00_CPH_Txtmeet').value=="")
        {
            alert("Please enter the name");
            document.getElementById('ctl00_CPH_Txtmeet').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_Txtmeet').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_Txtmeet'),"Please enter alphabets only")))
          {
               return false;
          }
        }
      if (document.getElementById('ctl00_CPH_Txtobj').value=="")
        {
            alert("Please enter the objective");
            document.getElementById('ctl00_CPH_Txtobj').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_Txtobj').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_Txtobj'),"Please enter alphabets only")))
          {
               return false;
          }
        }
      if (document.getElementById('ctl00_CPH_Txtparticipants1').value=="")
        {
            alert("Please enter the participants name");
            document.getElementById('ctl00_CPH_Txtparticipants1').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_Txtparticipants1').value!="")
        {        
          if(!(isAlphabetnum(document.getElementById('ctl00_CPH_Txtparticipants1'),"Please enter alphabets only")))
          {
               return false;
          }
        }
        if (document.getElementById('ctl00_CPH_Txtparticipants2').value!="")
        {        
          if(!(isAlphabetnum(document.getElementById('ctl00_CPH_Txtparticipants2'),"Please enter alphabets only")))
          {
               return false;
          }
        }
       if (document.getElementById('ctl00_CPH_Txtprofile').value=="")
        {
            alert("Please enter the company profile");
            document.getElementById('ctl00_CPH_Txtprofile').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_Txtprofile').value!="")
        {        
            if(!(validchar(document.getElementById('ctl00_CPH_Txtprofile'),"Special characters are not allowed")))
          {
               return false;
          }
        }
          if (document.getElementById('ctl00_CPH_ddllocation').value=="0")
        {
            alert("Please select the location");
            document.getElementById('ctl00_CPH_ddllocation').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_Txtwebsite').value=="")
        {
            alert("Please enter the website address");
            document.getElementById('ctl00_CPH_Txtwebsite').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_Txtemail').value=="")
        {
            alert("Please enter the email");
            document.getElementById('ctl00_CPH_Txtemail').focus();
            return false;
        }
       else
       {
             if (checkEmail(document.getElementById('ctl00_CPH_Txtemail').value)==1)
             {
                 alert("Please enter valid email address");
                 document.getElementById('ctl00_CPH_Txtemail').focus();
                 return false;
             }
       }
       
       if (document.getElementById('ctl00_CPH_Txtlandline').value=="")
        {
            alert("Please enter the landline number");
            document.getElementById('ctl00_CPH_Txtlandline').focus();
            return false;
        }
        else
        {            
           if (!(val_phone(document.getElementById('ctl00_CPH_Txtlandline').value)))
           {
            alert("Please enter valid phone number");
            document.getElementById('ctl00_CPH_Txtlandline').focus();
            return false;
            }           
        }
       if (document.getElementById('ctl00_CPH_Txtmobile').value=="")
        {
            alert("Please enter the mobile number");
            document.getElementById('ctl00_CPH_Txtmobile').focus();
            return false;
        }
        else
        {
            if (!(val_mobile(document.getElementById('ctl00_CPH_Txtmobile').value)))
           {
            alert("Please enter valid mobile number");
            document.getElementById('ctl00_CPH_Txtmobile').focus();
            return false;
            }
        }
 }
  
   
var flag_email=0;
function checkEmail2(email) 

    {
        if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
        {
            flag_email=0;
        }
        else
        {
            flag_email=1;
        }
        return flag_email;
    }
 function val_phone(val)
 {   
      var validchrs='+ 0123456789-';
      var isnumeric=true;
      var i;
      var chrs;

      if (val.length<6|| val.length>15)
      {
      isnumeric=false;
      }
      else
      {
        for (i=0;i<val.length;i++)
          {     
              chrs=val.charAt(i);   
              if ((validchrs.indexOf(chrs)!="-1")&& isnumeric==true)
              {
              isnumeric=true;     
              }
              else
              {
              isnumeric=false;    
              }  
          }
       }
          return isnumeric;  
 }
  
  
   function stdcode(sval)
      {   
      var svalidchrs='+ 0123456789-';
      var sisnumeric=true;
      var si;
      var schrs;

    
        for (si=0;si<sval.length;si++)
          {     
              schrs=sval.charAt(si);   
              if ((svalidchrs.indexOf(schrs)!="-1")&& sisnumeric==true)
              {
              sisnumeric=true;     
              }
              else
              {
              sisnumeric=false;    
              }  
          }
     
          return sisnumeric;  
      }
      
      
 function val_enquiry()
 {
      if (document.getElementById('ctl00_CPH_txt_name').value=="")
        {
            alert("Please enter your name");
            document.getElementById('ctl00_CPH_txt_name').focus();
            return false;
        }
      else
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_name'),"Please enter alphabets only")))
          {
               return false;
          }
        }
      if (document.getElementById('ctl00_CPH_txt_degn').value=="")
        {
            alert("Please enter your designation");
            document.getElementById('ctl00_CPH_txt_degn').focus();
            return false;
        }
      else
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_degn'),"Please enter alphabets only")))
          {
               return false;
          }
        }
       if (document.getElementById('ctl00_CPH_txt_org').value=="")
        {
            alert("Please enter organisation name");
            document.getElementById('ctl00_CPH_txt_org').focus();
            return false;
        }
      else
        {                
           if(!(validchar(document.getElementById('ctl00_CPH_txt_org'),"Special characters are not allowed")))
          {
               return false;
          }
          
        }
        if (document.getElementById('ctl00_CPH_txt_address').value=="")
        {
            alert("Please enter your address");
            document.getElementById('ctl00_CPH_txt_address').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_telno1').value=="")
        {
            alert("Please enter your telephone no. ");
            document.getElementById('ctl00_CPH_txt_telno1').focus();
            return false;
        }
          else
        {
            var faxexp = /[-+ 0-9]/;
	          if(!document.getElementById("ctl00_CPH_txt_telno1").value.match(faxexp))
	              {
		             alert("Please enter the valid telphone no.");
		             document.getElementById("ctl00_CPH_txt_telno1").focus();
		             return false;
	              }
        }  
        if (document.getElementById('ctl00_CPH_txt_telno2').value=="")
        {
            alert("Please enter your telephone no. ");
            document.getElementById('ctl00_CPH_txt_telno2').focus();
            return false;
        }
        else
        {
            if (!(val_phone(document.getElementById('ctl00_CPH_txt_telno2').value)))
           {
            alert("Please enter valid telephone number");
            document.getElementById('ctl00_CPH_txt_telno2').focus();
            return false;
            }
        }  
        if (document.getElementById('ctl00_CPH_txt_mobileno').value=="")
        {
            alert("Please enter your mobile number   ");
            document.getElementById('ctl00_CPH_txt_mobileno').focus();
            return false;
        }
        else
        {
            if (!(val_mobile(document.getElementById('ctl00_CPH_txt_mobileno').value)))
            {
                alert("Please enter valid mobile number");
                document.getElementById('ctl00_CPH_txt_mobileno').focus();
                return false;
            }  
        }        
        if (document.getElementById('ctl00_CPH_txt_faxno').value=="")
        {
            alert("Please enter fax number  ");
            document.getElementById('ctl00_CPH_txt_faxno').focus();
            return false;
        }
         else
        {
             if (!(val_phone(document.getElementById('ctl00_CPH_txt_faxno').value)))
             {
                alert("Please enter valid fax number");
                document.getElementById('ctl00_CPH_txt_faxno').focus();
                return false;
             }  
        }  
        if (document.getElementById('ctl00_CPH_txt_emailid').value=="")
        {
            alert("Please enter your Email-ID");
            document.getElementById('ctl00_CPH_txt_emailid').focus();
            return false;
        }
        else
        {
            var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,3}$/;
	          if(!document.getElementById("ctl00_CPH_txt_emailid").value.match(emailExp))
	              {
		             alert("Please enter the valid E-mail");
		             document.getElementById("ctl00_CPH_txt_emailid").focus();
		             return false;
	              }
        }
         if (document.getElementById('ctl00_CPH_txt_website').value=="")
        {
            alert("Please enter website address ");
            document.getElementById('ctl00_CPH_txt_website').focus();
            return false;
        }
         if (document.getElementById('ctl00_CPH_txt_orgprofile').value=="")
        {
            alert("Please enter the organization profile");
            document.getElementById('ctl00_CPH_txt_orgprofile').focus();
            return false;
        }
	}	
	
function trim(str)
{
    var str1=str.replace(/\S/g,"|");
    var i=str1.indexOf("|")-1;
    var j=str1.lastIndexOf("|")+1;
    var trimStr=str.substring(0,i).replace(/\s/g,"") + str.substring(i+1,j)
    trimStr = trimStr + str.substring(j).replace(/\s/g,"");
    return trimStr;
}


function newsearchvalid(evt,id)
{

     var kc; 
            if(document.all)
            {
                kc=event.keyCode; 
            }
            else if(document.getElementById)
            {
                kc=evt;  
            }
            else if(document.layers)
            {
                 kc=evt;  
            }              
            if(trim(document.getElementById("ctl00_key").value)=="" && document.getElementById("ctl00_key").value.length>0)
            {
                if(kc!=8)
                {
                    alert("Invalid characters");
                    return false; 
                }
            }               
            if((kc>=48 && kc<=57)||(kc>=65 && kc<=90) || (kc>=97 && kc<=122) || kc ==32 || kc==38 || kc==45 || kc==13 || kc==0 || kc==1 || kc==8)
            {
            
            }
            else
            {      
            
                alert("Invalid characters");
                return false;  
            }
     
    if((kc==13) || (id==2))
    {  
    
          if((document.getElementById("ctl00_key").value!="") )
          {              
                if(trim(document.getElementById("ctl00_key").value)=="" && document.getElementById("ctl00_key").value.length>0)
                {
                    alert("Invalid characters");
                    return false; 
                }   
                else
                {
                     if(kc>=65 && kc<=90 || kc>=97 && kc<=122 || kc ==32 || kc==38 || kc==45 || kc==13 || kc==0 || kc==1)
                    {

                    }
                    else
                    {
                        alert("Invalid characters");
                        return false;  
                    } 
                }    
        } 
        else
        {
              alert("Please enter the keyword");
                        return false;  
        }       
     }
    

}


function searchreturn()
{

   
        if(document.getElementById("ctl00_key").value!="")
        {         
       
           // document.location="search.aspx?key="+document.getElementById("ctl00_key").value;
            window.location="search.aspx?key="+document.getElementById("ctl00_key").value;
        }
    
}
	
function alphabets(e1,id)
{  
    
            var kc;              
            var skc;                                     

            if(document.all)
            {
                kc=event.keyCode; 
            }

            else if(document.getElementById)
            {
                kc=e1;  
            }
            else if(document.layers)
            {
                 kc=e1;                                                        

            }  
            
  if((kc==13) || (id==2))
    {       
  
        if(document.getElementById("ctl00_key").value!="")
        {  
          window.location="search.aspx?key="+document.getElementById("ctl00_key").value;
        }
    }
    
             
else if(kc>=65 && kc<=90 || kc>=97 && kc<=122 || kc ==32 || kc==38 || kc==45)
{
    
      return true;
      
      
}
    else
        {
       
        alert("Invalid characters");
        return false;    
       }
       

}

function search_valid()
{

  if (document.getElementById('ctl00_key').value.length == 0)
  {
     alert("Please enter the keyword");
     document.getElementById('ctl00_key').focus();
     return false;
  } 
 
  if (trim(document.getElementById('ctl00_key').value) == "")
  {
     alert("Please enter the keyword");
     document.getElementById('ctl00_key').focus();
     return false;
  } 
   else
  {
    var s_word=document.getElementById('ctl00_key').value;
    var newsearch=s_word.search("<");
       if(newsearch==0)
       {
         alert("Invalid characters");
         return false;   
       }
       else
       {
        var alphaExp1 = /[^-&a-z|A-Z|0-9|+|$ ]/;
      
        if(document.getElementById('ctl00_key').value.match(alphaExp1))
            {
                  alert("Invalid characters");
                document.getElementById('ctl00_key').focus();
                    return false; 
             }
        else
            { 
                return true;
            }
       }
      
  }
}

function emailid_home(a)
{
if (a.keyCode==13)
{
  if(document.getElementById('ctl00_CPH_txtuser').value =='')
  {
   alert("Please enter the username");
   document.getElementById('ctl00_CPH_txtuser').focus();
   return false;
  }
  else
  {
  document.getElementById('ctl00_CPH_txtPass').focus();
  return false;
  }
}
}
function pwd_home(a)
{
if (a.keyCode==13)
{
 if(document.getElementById('ctl00_CPH_txtPass').value =='')
  {
   alert("Please enter the Password");
   document.getElementById('ctl00_CPH_txtPass').focus();
   return false;
  }
  else
  {
  document.all["ctl00_CPH_btn_login"].click();
  return false;
  }
}
}



function checkall(chk)
{
chk=chk.id;

    if(document.getElementById(chk).checked==true)
    { 
        for(i=0;i<document.getElementById('ctl00_CPH_lstareaofint').length;i++)
        {
            document.getElementById('ctl00_CPH_lstareaofint').options[i].selected=true;
        }
    }
    else
    {
        for(i=0;i<document.getElementById('ctl00_CPH_lstareaofint').length;i++)
        {
            document.getElementById('ctl00_CPH_lstareaofint').options[i].selected=false;
        }
    }
}


function validatedatereg(date)
 {
        var flagdate=1;
var validchrs='0123456789/';
var isnumeric=true;
var i;
var chrs;
    for (i=0;i<date.length;i++)
    {    
    chrs=date.charAt(i); 
        if ((validchrs.indexOf(chrs)!="-1")&& isnumeric==true)
        {
         
                var date_val;
            if (date.length==10)
            {               
                if (!(date.charAt(2)=="/"))
                {    
                    flagdate=0;
                }
                if (!(date.charAt(5)=="/"))
                {
                    flagdate=0;
                }   
                date_val=date.split("/");
                if (date_val.length==3)
                {
                    if ((date_val[0]>31)||(date_val[0].charAt(0)==0 && date_val[0].charAt(1)==0))
                    {
                      flagdate=0; 
                    }

                    if ((date_val[1]>12) ||(date_val[1].charAt(0)==0 && date_val[1].charAt(1)==0)) 
                    {
                    flagdate=0;
                    }
                                           
                }
                else
                {
                    flagdate=0;
                }
            }
            else
            {
               flagdate=0;
            }    
        }
        else
        {
            flagdate=0; 
        }   
    } 
                                                            
        return flagdate;             
    }

function onclicktextbox(txtid)
{

    if((document.getElementById(txtid).value=="") || (document.getElementById(txtid).value=="Please list the sectors, product / service categories or companies you are interested in collaborations, joint ventures  partnerships") || (document.getElementById(txtid).value=="Please list the sectors, product / service categories or companies you are interested in collaborations, joint ventures & partnerships") || (document.getElementById(txtid).value=="Please list products & technology you would like to source") || (document.getElementById(txtid).value=="Please list categories & suppliers you would like to source") || (document.getElementById(txtid).value=="Please list expertise & services you would like to source") || (document.getElementById(txtid).value=="Please list the types of companies, products & services or any specific company that you would like to represent"))
    {
        document.getElementById(txtid).value="";
    }    
}



/* trim function*/
function trim(str)
{
  return RTrim(LTrim(str));
}

 

function RTrim(str)
{
  // We don't want to trip JUST spaces, but also tabs,
  // line feeds, etc.  Add anything else you want to
  // "trim" here in Whitespace
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
    // We have a string with trailing blank(s)...
    var i = s.length - 1;       // Get length of string
    // Iterate from the far right of string until we
    // don't have any more whitespace...
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
      i--;
    // Get the substring from the front of the string to
    // where the last non-whitespace character is...
    s = s.substring(0, i+1);
  }
  return s;
}

 

function LTrim(str)
{
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(0)) != -1) {
    // We have a string with leading blank(s)...
    var j=0, i = s.length;
    // Iterate from the far left of string until we
    // don't have any more whitespace...
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    j++;
    // Get the substring from the first non-whitespace
    // character to the end of the string...
    s = s.substring(j, i);
  }
  return s;
}

 

function ftrim(strval)
{
  var str2=strval.replace(/\S/g,"|");
  var i=str2.indexOf("|")-1;
  var j=str2.lastIndexOf("|")+1;
  var trimStr=strval.substring(0,i).replace(/\s/g,"") + strval.substring(i+1,j);
      trimStr = trimStr + strval.substring(j).replace(/\s/g,"");
  return trimStr;
}
function inputValidation(type,e)
{
    var key;
    if(document.all)
        key=e.keyCode;
    else if(document.getElementById)    
        key=e.which;
    if(key==8 || key==46 || key==13 ||key==32 || key == 16)    
        return true;  
    
    if(type=='message')
    {
        if(isDescription(trim(document.getElementById('ctl00_CPH_txtbriefinfo').value))==false)
        {
            alert("Please avoid using $@#%^&*<>?:;{}!+[]|/");
             var question=document.getElementById('ctl00_CPH_txtbriefinfo').value; 
             document.getElementById('ctl00_CPH_txtbriefinfo').value=question.replace(/[^-.,a-zA-Z0-9\s]/gi,'');            
        return false;
        }
    }        
    return true;
}
function isDescription(objValue)
{
       var alphaExp = /[^-_()".',a-zA-Z0-9\s]/;
      if(objValue.match(alphaExp))
           return false;
      return true;
}
function inputValid(type,e,nam)
{
    var key;
    var ctrlname = nam.id;
    if(document.all)
        key=e.keyCode;
    else if(document.getElementById)    
        key=e.which;
    if(key==8 || key==46 || key==13 ||key==32 || key == 16)    
        return true;  
    
    if(type=='message')
    {
        if(isDescription(trim(document.getElementById(ctrlname).value))==false)
        {
             alert("Please avoid using $@#%^&*<>?:;{}!+[]|/");
             var question=document.getElementById(ctrlname).value; 
             document.getElementById(ctrlname).value=question.replace(/[^-.,a-zA-Z0-9\s]/gi,'');            
        return false;
        }
    }        
    return true;
}
function checkEmail(emailAddress) {
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(2([0-4]\d|5[0-5])|1?\d{1,2})(\.(2([0-4]\d|5[0-5])|1?\d{1,2})){3} \])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    return re.test(emailAddress);
}

function delcook()
{
    var d = new Date();
    var cookie_date = new Date();
    document.cookie = "newss=1;expires=Thu, 01-Jan-1970 00:00:01 GMT;"+ ";";  
    document.cookie ='newss=1;expires=' + cookie_date.toGMTString()+ ';path=/';  
}
  function createobject()
    {       
        var request_obj ;
        var browser = navigator.appName ;
        
    if (browser == "Microsoft Internet Explorer")
     {
        request_obj = new ActiveXObject("Microsoft.XMLHttp");
     } 
    else
     {
        request_obj = new XMLHttpRequest();
     }
        return request_obj;
    }
var http_seocook=new createobject();
function delcookseo(cid)
{
    http_seocook.open('get',"/ajax_seo?id="+cid+"",true); 
     http_seocook.onreadystatechange=returnseo;
    http_seocook.send(null);
   
}
function returnseo()
{
     if(http_seocook.responseText==4)
    {
     alert("sdf");
        document.location.reload();
       
    }
}


function valid_investor_report()
{


     if (trim(document.getElementById('ctl00_CPH_txt_name').value)=="")
        {
            alert("Please enter your name");
            document.getElementById('ctl00_CPH_txt_name').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_name').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_name'),"Please enter alphabets only")))
          {
               return false;
          }
        }
        if (trim(document.getElementById('ctl00_CPH_txt_desig').value)=="")
        {
            alert("Please enter your designation");
            document.getElementById('ctl00_CPH_txt_desig').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_desig').value!="")
        {        
          if(!(isAlphabet(document.getElementById('ctl00_CPH_txt_desig'),"Please enter alphabets only")))
          {
               return false;
          }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_org').value)=="")
        {
            alert("Please enter your Company");
            document.getElementById('ctl00_CPH_txt_org').focus();
            return false;
        }
        if (document.getElementById('ctl00_CPH_txt_org').value!="")
        {        
          if(!(validchar(document.getElementById('ctl00_CPH_txt_org'),"Special characters are not allowed")))
          {
               return false;
          }
        }
       if (trim(document.getElementById('ctl00_CPH_txt_abn').value)=="")
        {
            alert("Please enter your ABN no.");
            document.getElementById('ctl00_CPH_txt_abn').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txt_abn').value!="")
        {
           if (!(val_abnno(document.getElementById('ctl00_CPH_txt_abn').value)))
           {
            alert("Please enter valid ABN number");
            document.getElementById('ctl00_CPH_txt_abn').focus();
            return false;
            }
        }
       if (trim(document.getElementById('ctl00_CPH_txt_mobile').value)=="")
        {
            alert("Please enter your Phone no.");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txt_mobile').value!="")
        {
           if (!(val_phone(document.getElementById('ctl00_CPH_txt_mobile').value)))
           {
            alert("Please enter valid Phone number");
            document.getElementById('ctl00_CPH_txt_mobile').focus();
            return false;
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_fax').value)=="")
        {
            alert("Please enter your Fax no.");
            document.getElementById('ctl00_CPH_txt_fax').focus();
            return false;
        }
       if (document.getElementById('ctl00_CPH_txt_fax').value!="")
        {
           if (!(val_phone(document.getElementById('ctl00_CPH_txt_fax').value)))
           {
            alert("Please enter valid Fax number");
            document.getElementById('ctl00_CPH_txt_fax').focus();
            return false;
            }
        }
         if (trim(document.getElementById('ctl00_CPH_txt_email').value)=="")
        {
            alert("Please enter your E-mail ID");
            document.getElementById('ctl00_CPH_txt_email').focus();
            return false;
        }
         if (checkEmail(document.getElementById('ctl00_CPH_txt_email').value)==1)
         {
             alert("Please enter valid email address");
             document.getElementById('ctl00_CPH_txt_email').focus();
             return false;
         }
}

function val_abnno(inputval)
{     
    var allowedchar='+-. 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    var cond=true;
    var i;
    var chract;  
        for (i=0;i<inputval.length;i++)
        {  
            chract=inputval.charAt(i);  
            if ((allowedchar.indexOf(chract)!="-1")&& cond==true)
                cond=true;  
            else
                cond=false; 
        }
    return cond; 
}

function isDescription_new(objValue)
{
       var alphaExp = /[^-_()"+-.',a-zA-Z0-9\s]/;
      if(objValue.match(alphaExp))
           return false;
      return true;
}

function inputValid_new(type,e,nam)
{
    var key;
    var ctrlname = nam.id;
    if(document.all)
        key=e.keyCode;
    else if(document.getElementById)    
        key=e.which;
    if(key==8 || key==46 || key==13 ||key==32 || key == 16)    
        return true;  
    
    if(type=='message')
    {
        if(isDescription_new(trim(document.getElementById(ctrlname).value))==false)
        {
             alert("Please avoid using $@#%^&*<>?:;{}![]|/");
             var question=document.getElementById(ctrlname).value; 
             document.getElementById(ctrlname).value=question.replace(/[^-.,a-zA-Z0-9\s]/gi,'');            
        return false;
        }
    }        
    return true;
}