﻿// JScript File


var titleMsg="Mecklai Fianacial - Contact Us";
var dtCh= "/";
var PHName="ctl00_cphMain_";

 function trim(str)
 {
         if(!str || typeof str != 'string')
            return '';
        return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
 }

function FnMap(str)
{
  WinO= window.open('AboutUs/OfficeMaps.aspx?MAP='+str+'','WinO','status=0, width=925, height=600, top=60, left=50,resizable=no');
}



 function fnValidateBetchmark()
    {
  
    
    if ( document.getElementById(PHName+'rdbtnType_0').checked ||  document.getElementById(PHName+'rdbtnType_1').checked )
    {
    }
    else
    { document.getElementById(PHName+'lblMsg').innerText = 'Please select type';
           document.getElementById(PHName+'rdbtnType_0').focus();
          return false;    
    }
       
         if(trim(document.getElementById(PHName+'txtM1').value) =='' || trim(document.getElementById(PHName+'txtM2').value) =='' || trim(document.getElementById(PHName+'txtM3').value) ==''  || trim(document.getElementById(PHName+'txtM4').value) =='' || trim(document.getElementById(PHName+'txtM5').value) =='' || trim(document.getElementById(PHName+'txtM6').value) =='')
        {
        document.getElementById(PHName+'lblMsg').innerText = 'Please enter avg. realized rate for all months.';
          
           document.getElementById(PHName+'txtM1').focus();
          return false;
        }
       
         if(trim(document.getElementById(PHName+'txtName').value) =='')
        {
        document.getElementById(PHName+'lblMsg').innerText = 'Please enter name.';
                 document.getElementById(PHName+'txtName').focus();
          return false;
        }
        
        if(trim(document.getElementById(PHName+'txtEmail').value)=='')
        {
          document.getElementById(PHName+'lblMsg').innerText = 'Enter e-mail address.';
         
            document.getElementById(PHName+'txtEmail').focus();
            return false;
        }
        
         if(fn_checkValidEmail(trim(document.getElementById(PHName+'txtEmail').value))==false)
        {
          document.getElementById(PHName+'lblMsg').innerText = 'Please enter valid e-mail address.';

           document.getElementById(PHName+'txtEmail').focus();
          return false;
        }
        
         if(trim(document.getElementById(PHName+'txtPhone').value) =='')
        {
        document.getElementById(PHName+'lblMsg').innerText = 'Please enter contact number.';


           document.getElementById(PHName+'txtPhone').focus();
          return false;
        }
      
         
        
    
    }

function fn_ValidateForMail()
{
    

    if(trim(document.getElementById(PHName+'txtName').value)=='')
    {
        alert('Enter your name.');
        document.getElementById(PHName+'txtName').focus();
        return false;
    }
    
    if(trim(document.getElementById(PHName+'txtEmail').value)=='')
    {
        alert('Enter e-mail address.');
        document.getElementById(PHName+'txtEmail').focus();
        return false;
    }
    if(trim(document.getElementById(PHName+'txtPhone').value)=='')
    {
        alert('Enter phone number.');
        document.getElementById(PHName+'txtPhone').focus();
        return false;
    }
    
    if(fn_Telephone(trim(document.getElementById(PHName+'txtPhone').value),'-(),+')==false)
     {
        alert('Only numeric and special characters -(),+ are allowed for phone number.');
        document.getElementById(PHName+'txtPhone').focus();
        return false;
    }
     if(trim(document.getElementById(PHName+'txtBestTime').value)=='')
    {
        alert('Enter best time to call you.');
        document.getElementById(PHName+'txtBestTime').focus();
        return false;
    }
    if(trim(document.getElementById(PHName+'txtCompany').value)=='')
    {
        alert('Enter organization name.');
        document.getElementById(PHName+'txtCompany').focus();
        return false;
    }
    
    
   
    if(fn_checkValidEmail(trim(document.getElementById(PHName+'txtEmail').value))==false)
    {
        alert('Enter valid e-mail address.');
        document.getElementById(PHName+'txtEmail').focus();
        return false;
    }
    else
    {
        return true;
    }
    
     
}



function fn_Validate_CapexilMember()
{
    

    if(trim(document.getElementById(PHName+'txtCapexilID').value)=='')
    {
        alert('Enter CAPAXIL membership number.');
        document.getElementById(PHName+'txtCapexilID').focus();
        return false;
    }
    
     if(trim(document.getElementById(PHName+'txtCompany').value)=='')
    {
        alert('Enter company name.');
        document.getElementById(PHName+'txtCompany').focus();
        return false;
    }
    if(trim(document.getElementById(PHName+'txtContactPerson').value)=='')
    {
        alert('Enter contact person name.');
        document.getElementById(PHName+'txtContactPerson').focus();
        return false;
    }
    
    
   
    if(trim(document.getElementById(PHName+'txtEmail').value)=='')
    {
        alert('Enter e-mail address.');
        document.getElementById(PHName+'txtEmail').focus();
        return false;
    }
     if(fn_checkValidEmail(trim(document.getElementById(PHName+'txtEmail').value))==false)
    {
        alert('Enter valid e-mail address.');
        document.getElementById(PHName+'txtEmail').focus();
        return false;
    }
    if(trim(document.getElementById(PHName+'txtPhone').value)=='')
    {
        alert('Enter phone number.');
        document.getElementById(PHName+'txtPhone').focus();
        return false;
    }
    
    if(fn_Telephone(trim(document.getElementById(PHName+'txtPhone').value),'-(),+')==false)
     {
        alert('Only numeric and special characters -(),+ are allowed for phone number.');
        document.getElementById(PHName+'txtPhone').focus();
        return false;
    }
     
}

function fn_Telephone(str,SpecialCharString)
{   
if(str==null)
    {
    return false;
    }
   
    var OnlyNum = "0123456789"+ SpecialCharString;
    var Char;
    for (i = 0; i < str.length; i++) 
    { 
      Char = str.charAt(i); 
     if (OnlyNum.indexOf(Char) == -1) 
     {
       return false;
     }
   }
   return true;
     
}


function fn_checkValidEmail(mailids)
{
 if(trim(mailids)=='')
 {
    return false;
 }

    var arr = new Array('.com','.net','.org','.biz','.coop','.info','.museum','.name','.pro'
    ,'.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag','.ai','.al',
    '.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw','.az','.ba','.bb',
    '.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm','.bn','.bo','.br','.bs',
    '.bt','.bv','.bw','.by','.bz','.ca','.cc','.cd','.cf','.cg','.ch','.ci',
    '.ck','.cl','.cm','.cn','.co','.cr','.cu','.cv','.cx','.cy','.cz','.de',
    '.dj','.dk','.dm','.do','.dz','.ec','.ee','.eg','.eh','.er','.es','.et',
    '.fi','.fj','.fk','.fm','.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh',
    '.gi','.gl','.gm','.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy',
    '.hk','.hm','.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io',
    '.iq','.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
    '.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li','.lk',
    '.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg','.mh','.mk',
    '.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt','.mu','.mv','.mw',
    '.mx','.my','.mz','.na','.nc','.ne','.nf','.ng','.ni','.nl','.no','.np',
    '.nr','.nu','.nz','.om','.pa','.pe','.pf','.pg','.ph','.pk','.pl','.pm',
    '.pn','.pr','.ps','.pt','.pw','.py','.qa','.re','.ro','.rw','.ru','.sa',
    '.sb','.sc','.sd','.se','.sg','.sh','.si','.sj','.sk','.sl','.sm','.sn',
    '.so','.sr','.st','.sv','.sy','.sz','.tc','.td','.tf','.tg','.th','.tj',
    '.tk','.tm','.tn','.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug',
    '.uk','.um','.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu',
    '.ws','.wf','.ye','.yt','.yu','.za','.zm','.zw'); 
    var mai = mailids;
    var val = true;

    var dot = mai.lastIndexOf(".");
    var ext = mai.substring(dot,mai.length);
    var at = mai.indexOf("@");
    var dom = dot - at;
    var sp = mai.indexOf(" ");

    if(dom >= 4 && at >1 && sp == -1)
    {
        for(var i=0; i<arr.length; i++)
         {
            if(ext == arr[i])
            {
                val = true;
                break;
            } 
            else
            {
                val = false;
            }
        }
            if(val == false)
            {
               return false;
            }
    }
    else
    {
       return false;
    }
 return true;
 
}

function fn_onLoad()
{
if(typeof(document.getElementById('6').childNodes[0].style)!="undefined")
  {
    document.getElementById('6').childNodes[0].style.fontWeight= 'bold';
   }
 //document.getElementById('6').childNodes[0].style.fontWeight= 'bold';
     res = screen.width+"x"+screen.height;
     // document.getElementById('tr1').style.display ='none';
     var resWidth=screen.width;
     var resHeight=screen.height;
     if((resWidth < "1024") && (resHeight < "768"))
     {
        alert("Please change your screen resolution to 1024x768.");
     }
}

 function fnGetAddress()
{
    WinC= window.open('OfficeLocations.aspx','WinOL','status=1, width=742, height=350,top=200, left=150,scrollbars=yes');
}

 function pageLoad()
 {
    
    fn_onLoad();
     
   
  
 }
 
 function fn_CheckKeyCode(strValue,len)
{

    if((window.event.keyCode == 46) || (window.event.keyCode >= 48 && window.event.keyCode <= 57)) 
    {
        if (window.event.keyCode == 46)
        {
            if(strValue.indexOf('.') == -1 )
            {
                return true; 
            }
            else 
                return false;
        }
        else
            return true;
    }
    else 
    {
        return false;
    }

}
 


