﻿
/*
'---------------------------------------------------------------------------------
'Program Name       : AdvertiseWithUs.js (Busrex/Js)
'Author Name        : K. Vivekanandan
'Program summary    : This form is used to new advertisement registeration validation
'Created date       : 
'Updated by         : 
'Updated date       : 11/06/2008
'Version No         :
'Change Details     : Country/State/Contact/Phone Nuumber Validations
'Status             : 
'---------------------------------------------------------------------------------
*/

function Advt_ViewPayment(val)
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    
    if(val == "yes")
    {
        document.getElementById(ctlAdvertiseReg_Edit + "divViewPayment").style.display='none'; 
        document.getElementById(ctlAdvertiseReg_Edit + "divPayment").style.display='inline'; 
        document.getElementById(ctlAdvertiseReg_Edit + "divThanks").style.display='none'; 
        document.getElementById(ctlAdvertiseReg_Edit + "divNoThanks").style.display='none'; 
        document.getElementById("ifrm").src=document.getElementById("ifrm").src;
    }
    else if(val == "no")
    {
        document.getElementById(ctlAdvertiseReg_Edit + "divViewPayment").style.display='inline'; 
        document.getElementById(ctlAdvertiseReg_Edit + "divPayment").style.display='none'; 
        document.getElementById(ctlAdvertiseReg_Edit + "divThanks").style.display='none'; 
        document.getElementById(ctlAdvertiseReg_Edit + "divNoThanks").style.display='inline'; 
    }
}

function checkFileUpload()
{        
    if(document.getElementById("ctl00_cphMain_AdvertiseWithUs_flupldPhoto").value == "")
    {
        alert('Please select your file to upload');
        return false;        
    }
    else
    {
        var strFileName=document.getElementById("ctl00_cphMain_AdvertiseWithUs_flupldPhoto").value;
        if(strFileName.indexOf("%20")>=0)
        {
            alert('Invalid file name.');
            return false;
        }
    }
    
    var tbl;
    tbl=document.getElementById("ctl00_cphMain_AdvertiseWithUs_gvPhotoUpload");
    if(tbl==null)
    {
        tbl=document.getElementById("ctl00_cphMain_ctl00_gvPhotoUpload");
    }   
    if(document.getElementById("ctl00_cphMain_AdvertiseWithUs_flupldPhoto").value.substring(document.getElementById("ctl00_cphMain_AdvertiseWithUs_flupldPhoto").value.length-3).toLowerCase()=="dat")
    {
        alert('Please select jpg/jpeg/swf/gif file type');            
        var who=document.getElementsByName("ctl00$cphMain$AdvertiseWithUs$flupldPhoto")[0];         
        var who2= who.cloneNode(false);    
        who2.onchange= who.onchange;    
        who.parentNode.replaceChild(who2,who);              
        return false;        
    }                 
    if(tbl!=null)    
    {            
        var fileupd=document.getElementById("ctl00_cphMain_AdvertiseWithUs_flupldPhoto");
        var filename=fileupd.value;   
        filename=filename.substr(filename.lastIndexOf("\\")+1);            
        for(i=1;i<tbl.rows.length;i++)
        {
            if(filename==tbl.rows[i].cells[1].innerText)
            {
                alert("Selected File Already Exists...");
                return false;
            }
        }
    }
    return true;
}

function ClearLogin()
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_"; 
    document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
    document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").value="";
    document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
    return false;        
}

function CheckLogin()
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_"; 
    
    if(!checkAllInputs())
    {
        return false;
    }
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value.trim()))
    {
        str = 'Please enter "User ID"'; 
        str1 = true;
    } 
    else
    {
        str = "";
        str1 = false;
    }
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").value.trim()))
    {
        str=str+'\nPlease enter "Password"'; 
        str2 = true;        
    }  
    else
    {
        str2 = false;
    }   
    
    if (str != "")
    {
        alert(str);
        if(str1==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
	        return false;
        }
        if(str2==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").focus();
	        return false;
        }
    }
    
    // User ID

    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value.trim()))
    {
        alert('Please enter "User ID"'); 
        document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
        return false;
    }
    else
    {        
        if(!validateUserId(document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value.trim()))
        {
            alert('Please enter valid "User ID"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
            return false;
        }
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value.trim()==0)
        {
            alert('"User ID" should not have only zeroes'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
            return false;
        }	
        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value.trim();				
        var len=val.length;
        var Alpha = /^[a-zA-Z0-9]+$/;			
        if(!Alpha.test(val.charAt(0)))
        {
            alert('Please enter valid "User ID"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
            return false;
        }  
        if(!Alpha.test(val.charAt(len-1)))
        {
            alert('Please enter valid "User ID"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
            return false;
        }        
        if(len<5) 
        {            
            alert('"User ID" should be minimum of 5 characters');
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
            return false;							
        }	
        for(i=0;i<len-1;i++)
        {
            var Alpha = /^[_]+$/;
            if((Alpha.test(val.charAt(i))) && (Alpha.test(val.charAt(i+1))))
            {
                alert('Please enter valid "User ID"');
                document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
                document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
                return false;
            }  
        }
    }

    // Password

    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").value.trim()))
    {
        alert('Please enter "Password"');
        document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").focus();
        return false;
    } 
    else
    {         
        var pwd=document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").value.trim();				
        var len=pwd.length;
        if(len<6 || len>8) 
        {
            alert('Please enter "Password" with minimum 6 characters and maximum 8 characters'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").focus();
            return false;							
        }
        if((document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").value.trim())==(document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value.trim()))
        {
            alert('"User ID" and "Password" should not be same'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginPass").focus();
            return false;
        }		  
    }              
}

function checkAdvertiseReg_Edit() 
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_"; 
    
    if(!checkAllInputs())
    {
        return false;
    }
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value.trim()))
    {
        str = 'Please enter "User ID"'; 
        str1 = true;
    } 
    else
    {
        str = "";
        str1 = false;
    }
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").value.trim()))
    {
        str=str+'\nPlease enter "Password"'; 
        str2 = true;        
    }  
    else
    {
        str2 = false;
    }                 
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtConfirmPassword").value.trim()))
    {
        str=str+'\nPlease enter "Confirm Password"';
        str3 = true;        
    }
    else
    {
        str3 = false;
    } 
        
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtName").value.trim()))
    {
        str=str+'\nPlease enter "Name of the Company"'; 
        str6 = true;        
    }
    else
    {
        str6 = false;
    }
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").value.trim()))
    {
        str=str+'\nPlease enter "Address Line1"'; 
        str7 = true;        
    }
    else
    {
        str7 = false;
    }
    
    var val=document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
    if(val.selectedIndex == 0)
    {
        str=str+'\nPlease select "Country"'; 
        str8 = true;   
        str9 = false     
    }
    else
    {
        str8 = false;
    }
    
    var valCountry = document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
    if(valCountry[valCountry.selectedIndex].text == "India")
    {   
        var val=document.getElementById(ctlAdvertiseReg_Edit + "ddlState");
        if(val.selectedIndex == 0)
        {
            str=str+'\nPlease select "State/Province"'; // CReg_013
            str9 = true;        
        }
        else
        {
            str9 = false;
        } 
    } 
    else if(valCountry.selectedIndex == 0)
    {   
        var val=document.getElementById(ctlAdvertiseReg_Edit + "ddlState");
        if(val.selectedIndex == 0)
        {
            str=str+'\nPlease select "State/Province"'; // CReg_013
            str9 = true;        
        }
        else
        {
            str9 = false;
        } 
    } 
    else
    {
        if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").value.trim()))
        {
            str=str+'\nPlease enter "State/Province"'; // CReg_013
            str9 = true;        
        }
        else
        {
            str9 = false;
        }
    }        
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").value.trim()))
    {
        str=str+'\nPlease enter "Postal Code"'; 
        str10 = true;        
    }  
    else
    {
        str10 = false;
    }
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber1").value.trim()))
    {
        str=str+'\nPlease enter "Contact Number1"';
        str11 = true;        
    }
    else
    {
        str11 = false;
    }    
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").value.trim()))
    {
        str=str+'\nPlease enter "Contact Person"';
        str13 = true;        
    }
    else
    {
        str13 = false;
    }   
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value.trim()))
    {		
        str=str+'\nPlease enter "email id"';
        str15 = true;        
    }
    else
    {
        str15 = false;
    }       
    
    if (str != "")
    {
        alert(str);
        if(str1==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
	        return false;
        }
        if(str2==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").focus();
	        return false;
        }
        if(str3==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtConfirmPassword").focus();
	        return false;
        }
        if(str6==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtName").focus();
	        return false;
        }
        if(str7==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").focus();
	        return false;
        }
        if(str8==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry").focus();
	        return false;
        }
        if(str9==true)
        {
            var valCountry = document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
            if(valCountry[valCountry.selectedIndex].text == "India")
            {
	            document.getElementById(ctlAdvertiseReg_Edit + "ddlState").focus();
	            return false;
            }
            else if(valCountry.selectedIndex == 0)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "ddlState").focus();
	            return false;
            }
            else
            {
                document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").focus();
	            return false;
            }	           
        }
        if(str10==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").focus();
	        return false;
        }
        if(str11==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber1").focus();
	        return false;
        }
        if(str13==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").focus();
	        return false;
        }
        if(str15==true)
        {
	        document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").focus();
	        return false;
        }    
    }
    
    // Create User ID

    // User ID

    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value.trim()))
    {
        alert('Please enter "User ID"'); 
        document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
        return false;
    }
    else
    {        
        if(!validateUserId(document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value.trim()))
        {
            alert('Please enter valid "User ID"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";
            if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
            } 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
            return false;
        }
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value.trim()==0)
        {
            alert('"User ID" should not have only zeroes'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";
            if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
            } 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
            return false;
        }	
        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value.trim();				
        var len=val.length;
        var Alpha = /^[a-zA-Z0-9]+$/;			
        if(!Alpha.test(val.charAt(0)))
        {
            alert('Please enter valid "User ID"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";
            if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
            } 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
            return false;
        }  
        if(!Alpha.test(val.charAt(len-1)))
        {
            alert('Please enter valid "User ID"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";
            if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
            } 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
            return false;
        }        
        if(len<5) 
        {            
            alert('"User ID" should be minimum of 5 characters');
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";
            if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
            } 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
            return false;							
        }	
        for(i=0;i<len-1;i++)
        {
            var Alpha = /^[_]+$/;
            if((Alpha.test(val.charAt(i))) && (Alpha.test(val.charAt(i+1))))
            {
                alert('Please enter valid "User ID"');
                document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";
                if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
                {
                    document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                    document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
                } 
                document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
                return false;
            }  
        }
    }

    // Password

    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").value.trim()))
    {
        alert('Please enter "Password"');
        document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").focus();
        return false;
    } 
    else
    {         
        var pwd=document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").value.trim();				
        var len=pwd.length;
        if(len<6 || len>8) 
        {
            alert('Please enter "Password" with minimum 6 characters and maximum 8 characters'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtConfirmPassword").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").focus();
            return false;							
        }
        if((document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").value.trim())==(document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value.trim()))
        {
            alert('"User ID" and "Password" should not be same'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtConfirmPassword").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").focus();
            return false;
        }		  
    }	    

    // Confirm Password

    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtConfirmPassword").value.trim()))
    {
        alert('Please enter "Confirm Password"'); 
        document.getElementById(ctlAdvertiseReg_Edit + "txtConfirmPassword").focus();
        return false;
    }
    else
    {
        var pwd=document.getElementById(ctlAdvertiseReg_Edit + "txtConfirmPassword").value.trim();				
        var len=pwd.length;
        if(len<6 || len>8)
        {
            alert('Please enter "Confirm Password" with minimum 6 characters and maximum 8 characters'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtConfirmPassword").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").focus();
            return false;							
        }
        if((document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").value.trim())!=(document.getElementById(ctlAdvertiseReg_Edit + "txtConfirmPassword").value.trim()))
        {
            alert('"Password" and "Confirm Password" should be same'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtConfirmPassword").value="";
            document.getElementById(ctlAdvertiseReg_Edit + "txtPassword").focus();
            return false;
        }	    
    }	
   
    // New User Profile Registration 

    // Name of the Company
   
    document.getElementById(ctlAdvertiseReg_Edit + "txtName").value = document.getElementById(ctlAdvertiseReg_Edit + "txtName").value.trim();
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtName").value.trim()))
    {
        alert('Please enter "Name of the Company"'); 
        document.getElementById(ctlAdvertiseReg_Edit + "txtName").focus();
        return false;
    }
    else
    {	        
        if(validateNumeric(document.getElementById(ctlAdvertiseReg_Edit + "txtName").value.trim()))
        {
            alert('Please enter valid "Name of the Company"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtName").focus();
            return false;
        }
        if(validateSplChar(document.getElementById(ctlAdvertiseReg_Edit + "txtName").value.trim()))
        {
            alert('Please enter valid "Name of the Company"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtName").focus();
            return false;
        }
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtName").value.trim()==0)
        {
            alert('"Name of the Company" should not have only zeroes');
            document.getElementById(ctlAdvertiseReg_Edit + "txtName").focus();
            return false;
        }		    
        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtName").value.trim();				
        var len=val.length;
        var Alpha = /^[a-zA-Z0-9]+$/;			
        if(!Alpha.test(val.charAt(0)))
        {
            alert('Please enter valid "Name of the Company"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtName").focus();
            return false;
        }         
        if(len<2) 
        {            
            alert('Please check "Name of the Company"... \nsingle characters input in "Name of the Company" is not allowed'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtName").focus();
            return false;							
        }
    }

    // Address Line1

    document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").value = document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").value.trim();
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").value.trim()))
    {
        alert('Please enter "Address Line1"'); 
        document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").focus();
        return false;
    }
    else
    {	                  
        if(validateSplChar(document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").value.trim()))
        {
            alert('Please enter valid "Address Line1"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").focus();
            return false;
        }
        if(validateNumericSpace(document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").value.trim()))
        {
            alert('Please enter valid "Address Line1"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").focus();
            return false;
        }
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").value.trim()==0)
        {
            alert('"Address Line1" should not have only zeroes');
            document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").focus();
            return false;
        }    	
        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").value.trim();	        
        var len=val.length;        
        if(len<2) 
        {
            alert('Please check "Address Line1"... \nsingle characters input in "Address Line1" is not allowed');
            document.getElementById(ctlAdvertiseReg_Edit + "txtAddress1").focus();
            return false;							
        }	    	    
    }

    // Address Line2

    document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").value = document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").value.trim();
    
    if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").value.trim()))
    {        
        if(validateSplChar(document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").value.trim()))
        {
            alert('Please enter valid "Address Line2"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").focus();
            return false;
        }
        if(validateNumericSpace(document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").value.trim()))
        {
            alert('Please enter valid "Address Line2"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").focus();
            return false;
        }	
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").value.trim()==0)
        {
            alert('"Address Line2" should not have only zeroes');
            document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").focus();
            return false;
        }
        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").value.trim();	        
        var len=val.length;        
        if(len<2) 
        {
            alert('Please check "Address Line2"... \nsingle characters input in "Address Line2" is not allowed');
            document.getElementById(ctlAdvertiseReg_Edit + "txtAddress2").focus();
            return false;							
        }		
    }

    // City/Town

    document.getElementById(ctlAdvertiseReg_Edit + "txtCity").value = document.getElementById(ctlAdvertiseReg_Edit + "txtCity").value.trim();
    
    if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtCity").value.trim()))
    {
        if(!validateAlpha(document.getElementById(ctlAdvertiseReg_Edit + "txtCity").value.trim()))
        {
            alert('Please enter valid "City/Town"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtCity").focus();
            return false;
        }
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtCity").value.trim()==0)
        {
            alert('"City/Town" should not have only zeroes'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtCity").focus();
            return false;
        }	
        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtCity").value.trim();	
        var len=val.length;        
        if(len<2) 
        {
            alert('Please check "City/Town"... \nsingle characters input in "City/Town" is not allowed'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtCity").focus();
            return false;							
        }			
    }

    // Country	   

    var val=document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
    if(val.selectedIndex == 0)
    {
        alert('Please select "Country"'); 
        document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry").focus();
        return false;
    }
    
    // State/Province
    
    var valCountry = document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
    if(valCountry[valCountry.selectedIndex].text == "India")
    {
        var val=document.getElementById(ctlAdvertiseReg_Edit + "ddlState");
        if(val.selectedIndex == 0)
        {
            alert('Please select "State/Province"'); // CReg_013
            document.getElementById(ctlAdvertiseReg_Edit + "ddlState").focus();
            return false;
        }
    } 
    else if(valCountry.selectedIndex == 0)
    {
        var val=document.getElementById(ctlAdvertiseReg_Edit + "ddlState");
        if(val.selectedIndex == 0)
        {
            alert('Please select "State/Province"'); // CReg_013
            document.getElementById(ctlAdvertiseReg_Edit + "ddlState").focus();
            return false;
        }    
    }
    else
    {
        document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").value = document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").value.trim();
    
        if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").value.trim()))
        {
            if(!validateAlpha(document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").value.trim()))
            {
                alert('Please enter valid "State/Province"'); // CReg_023_1
                document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").focus();
                return false;
            }
            if(document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").value.trim()==0)
            {
                alert('"State/Province" should not have only zeroes'); // CReg_023_2
                document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").focus();
                return false;
            }	
            var val=document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").value.trim();	
            var len=val.length;        
            if(len<2) 
            {
                alert('Please check "State/Province"... \nsingle characters input in "State/Province" is not allowed'); // CReg_023_3
                document.getElementById(ctlAdvertiseReg_Edit + "txtOthState").focus();                
                return false;							
            }			
        }      
    }      
    
    // Postal Code

    document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").value = document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").value.trim();
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").value.trim()))
    {
        alert('Please enter "Postal Code"');
        document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").focus();
        return false;
    }
    else
    {
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").value.trim()==0)
        {
            alert('"Postal Code" should not have only zeroes'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").focus();
            return false;
        }
        var val=document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
        if(val[val.selectedIndex].text == "India")
        {
            if(!validateNumeric(document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").value.trim()))
            {
                alert('Please enter valid "Postal Code"'); 
                document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").focus();
                return false;
            }
            var val=document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").value.trim();				
            var len=val.length;
            if(len!=6 && len!=8)  
            {
                alert('Please enter valid "Postal Code" with either 6 or 8 digits'); 
                document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").focus();
                return false;							
            }
        }		
        else
        {
            if(!validatePincode(document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").value.trim()))
            {
                alert('Please enter valid "Postal Code"'); 
                document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").focus();
                return false;
            }
            if(validateAlpha(document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").value.trim()))
            {
                alert('Please enter valid "Postal Code"'); 
                document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").focus();
                return false;
            }
            var val=document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").value.trim();				
            var len=val.length;
            if(len<2) 
            {
                alert('Please check "Postal Code"...\nsingle characters input in "Postal Code" is not allowed'); 
                document.getElementById(ctlAdvertiseReg_Edit + "txtPinZipPostCode").focus();                
                return false;							
            }	
        }        
    }
    
    var valCountry = document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
    if(valCountry[valCountry.selectedIndex].text == "India")
    {
        // Contact Number1
        
        if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber1").value.trim()))
        {
            alert('Please enter "Contact Number1"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber1").focus();
            return false;
        }
        else
        {
            if(!validateContactNumber(document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber1").value.trim()))
            {
                alert('Please enter valid "Contact Number1"');
                document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber1").focus();
                return false;
            }      
        }    
                
        // Contact Number2
       
        if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber2").value))
        {
            if(!validateContactNumber(document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber2").value.trim()))
            {
                alert('Please enter valid "Contact Number2"'); 
                document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber2").focus();
                return false;
            } 
        }	
        
        // Fax Number
        
        if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtFaxNumber").value))
        {
            if(!validateFaxNumber(document.getElementById(ctlAdvertiseReg_Edit + "txtFaxNumber").value.trim()))
            {
                alert('Please enter valid "Fax Number"'); 
                document.getElementById(ctlAdvertiseReg_Edit + "txtFaxNumber").focus();
                return false;
            }         
        }
    }
    
    // URL

    var val=document.getElementById(ctlAdvertiseReg_Edit + "txtURL").value;	
    document.getElementById(ctlAdvertiseReg_Edit + "txtURL").value = val.toLowerCase(); 
    document.getElementById(ctlAdvertiseReg_Edit + "txtURL").value = document.getElementById(ctlAdvertiseReg_Edit + "txtURL").value.trim();
    
    if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtURL").value.trim()))
    {			
        if(!validateUrl(document.getElementById(ctlAdvertiseReg_Edit + "txtURL").value.trim()))
        {
            alert('Please enter valid "URL"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtURL").focus();
            return false;
        }
    }
    
    // Name

    document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").value = document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").value.trim();
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").value.trim()))
    {
        alert('Please enter "Contact Person"');
        document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").focus();
        return false;
    }
    else
    {	
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").value.trim()==0)
        {
            alert('"Contact Person" should not have only zeroes'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").focus();
            return false;
        }
        if(!validateContactName(document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").value.trim()))
        {
            alert('Please enter valid "Contact Person"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").focus();
            return false;
        }	 		    
        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").value.trim();				
        var len=val.length;
        var Alpha = /^[a-zA-Z]+$/;			
        if(!Alpha.test(val.charAt(0)))
        {
            alert('Please enter valid "Contact Person"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").focus();
            return false;
        }  
        if(!Alpha.test(val.charAt(len-1)))
        {
            alert('Please enter valid "Contact Person"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").focus();
            return false;
        }
        if(len<2) 
        {
            alert('Please check "Contact Person"... \nsingle characters input for "Contact Person" is not allowed'); 			
            document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").focus();
            return false;							
        }
        for(i=0;i<len-1;i++)
        {
            var Alpha = /^['\.]+$/;
            if((Alpha.test(val.charAt(i))) && (Alpha.test(val.charAt(i+1))))
            {
                alert('Please enter valid "Contact Person"');   
                document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").focus();
                return false;
            }  
        }
        var jointxtval;
        var firstsplit;
        var txtval=document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").value.trim();
        var allvalue=Array();
        var j=0;
																		
        if(txtval!="")
        {
            txtsplit=txtval.split(" ");                                    
            for(i=0;i<txtsplit.length;i++)
            {           
                splitvalue=txtsplit[i];
                if(splitvalue!="")
                {
                    firstsplit=splitvalue.split("");
                    if(firstsplit!="")
                    {
                        firstsplitval=firstsplit[0];
                        firstsplitval=firstsplitval.toUpperCase( );
                        firstsplit[0]=firstsplitval;
                        jointxtval=firstsplit.join("");
                        allvalue[j]=jointxtval;
                        j=j+1;                    
                    }
                }            
            }
            allvaluejoin=allvalue.join(" ");
            document.getElementById(ctlAdvertiseReg_Edit + "txtIndName").value=allvaluejoin;
        }	    
    }
          
    // email id

    var val=document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value;	
    document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value = val.toLowerCase(); 
    document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value = document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value.trim();
    
    if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value.trim()))
    {		
        alert('Please enter "email id"'); 
        document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").focus();
        return false;
    }
    else
    {	
        if(!validateEmail(document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value.trim()))
        {
            alert('Please enter valid "email id"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").focus();
            return false;
        }
    }
    
    var valCountry = document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
    if(valCountry[valCountry.selectedIndex].text == "India")
    {    
        // Phone Number
        
        if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber").value))
        {
            if(!validatePhoneNumber(document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber").value.trim()))
            {
                alert('Please enter valid "Phone Number"');
                document.getElementById(ctlAdvertiseReg_Edit + "txtPhoneNumber").focus();
                return false;
            }        
        }
        
        // Mobile Number
        
        if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtMobileNumber").value))
        {
            if(!validateMobileNumber(document.getElementById(ctlAdvertiseReg_Edit + "txtMobileNumber").value.trim()))
            {
                alert('Please enter valid "Mobile Number"'); 
                document.getElementById(ctlAdvertiseReg_Edit + "txtMobileNumber").focus();
                return false;
            }         
        }  
    }
        
    document.getElementById(ctlAdvertiseReg_Edit + "btnContinue").disabled = true;
    document.getElementById(ctlAdvertiseReg_Edit + "btnReset").disabled = true;
    document.getElementById(ctlAdvertiseReg_Edit + "btnProfileClose").disabled = true;
    document.getElementById(ctlAdvertiseReg_Edit + "btnContinue").className="mfbutton-dis";
    document.getElementById(ctlAdvertiseReg_Edit + "btnReset").className="mfbutton-dis";
    document.getElementById(ctlAdvertiseReg_Edit + "btnProfileClose").className="mfbutton-dis";
     __doPostBack('ctl00$cphMain$AdvertiseWithUs$btnContinue','');
    
    return true;    
}

function Advertise_EmailId()
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    
    var val=document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value;	
    document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value = val.toLowerCase(); 

    if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value.trim()))
    {	       
        if(!validateEmail(document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").value.trim()))
        {
            alert('Please enter valid "email id"');
            //document.getElementById(ctlAdvertiseReg_Edit + "txtEmailId").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtEmailId" + '\')',1);
            elemFocused=true;         
            return false;
        }
    }   
    setTimeout('__doPostBack(\'ctl00$cphMain$AdvertiseWithUs$txtEmailId\',\'\')', 0);       
}

function Advertise_UserName_LCase()
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    var val=document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value;	
    document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value = val.toLowerCase();    
    	
    if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value.trim()))
    {       
        if(!validateUserId(document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value.trim()))
        {
            alert('Please enter valid "User ID"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";            
            if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
            }                
            //document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtUserId" + '\')',1);
            elemFocused=true;
            return false;
        }        
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value.trim()==0)
        {
            alert('"User ID" should not have only zeroes'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";
            if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
            } 
            //document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtUserId" + '\')',1);
            elemFocused=true;
            return false;
        }
        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value.trim();				
        var len=val.length;
        var Alpha = /^[a-zA-Z0-9]+$/;			
        if(!Alpha.test(val.charAt(0)))
        {
            alert('Please enter valid "User ID"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";
            if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
            } 
            //document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtUserId" + '\')',1);
            elemFocused=true;
            return false;
        }  
        if(!Alpha.test(val.charAt(len-1)))
        {
            alert('Please enter valid "User ID"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";
            if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
            } 
            //document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtUserId" + '\')',1);
            elemFocused=true;
            return false;
        }     
        if(len<5) 
        {            
            alert('"User ID" should be minimum of 5 characters'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";	
            if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
            {
                document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
            } 
            //document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtUserId" + '\')',1);
            elemFocused=true;
            return false;							
        }
        for(i=0;i<len-1;i++)
        {
            var Alpha = /^[_]+$/;
            if((Alpha.test(val.charAt(i))) && (Alpha.test(val.charAt(i+1))))
            {
                alert('Please enter valid "User ID"'); 
                document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").value="";
                if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
                {
                    document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
                    document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
                } 		
                //document.getElementById(ctlAdvertiseReg_Edit + "txtUserId").focus();
                setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtUserId" + '\')',1);
                elemFocused=true;
                return false;
            }  
        }
    }   
    else
    {
        if(document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId') != null)
        {
            document.getElementById(ctlAdvertiseReg_Edit + "lblUserId").innerHTML = '';
            document.getElementById('ctl00_cphMain_AdvertiseWithUs_divUserId').style.display='none';   
        }  
    }
    setTimeout('__doPostBack(\'ctl00$cphMain$AdvertiseWithUs$txtUserId\',\'\')', 0);
}

function Advertise_LoginUser_LCase()
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    var val=document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value;	
    document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value = val.toLowerCase();    
    	
    if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value.trim()))
    {       
        if(!validateUserId(document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value.trim()))
        {
            alert('Please enter valid "User ID"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";            
            //document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtLoginUser" + '\')',1);
            elemFocused=true;
            return false;
        }        
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value.trim()==0)
        {
            alert('"User ID" should not have only zeroes'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
            //document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtLoginUser" + '\')',1);
            elemFocused=true;
            return false;
        }
        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value.trim();				
        var len=val.length;
        var Alpha = /^[a-zA-Z0-9]+$/;			
        if(!Alpha.test(val.charAt(0)))
        {
            alert('Please enter valid "User ID"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
            //document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtLoginUser" + '\')',1);
            elemFocused=true;
            return false;
        }  
        if(!Alpha.test(val.charAt(len-1)))
        {
            alert('Please enter valid "User ID"'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
            //document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtLoginUser" + '\')',1);
            elemFocused=true;
            return false;
        }     
        if(len<5) 
        {            
            alert('"User ID" should be minimum of 5 characters'); 
            document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";	
            //document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
            setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtLoginUser" + '\')',1);
            elemFocused=true;
            return false;							
        }
        for(i=0;i<len-1;i++)
        {
            var Alpha = /^[_]+$/;
            if((Alpha.test(val.charAt(i))) && (Alpha.test(val.charAt(i+1))))
            {
                alert('Please enter valid "User ID"'); 
                document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").value="";
                //document.getElementById(ctlAdvertiseReg_Edit + "txtLoginUser").focus();
                setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtLoginUser" + '\')',1);
                elemFocused=true;
                return false;
            }  
        }
    }
}

function checkAdvtTerms()
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    
    if(!checkAllInputs())
    {
        return false;
    }
    
    str9=false;    

    if(document.getElementById(ctlAdvertiseReg_Edit + "hdnfldEvent").value == "1/1/0001 12:00:00 AM")
    {
        str= 'Please select "Start Date" for your Advertisement in Hotspot';
        str9=true;        
    }
    else
    {
        str="";
        str9=false;
    }
    
    if((!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnWeekly").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnMonthly").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnQuarterly").checked))
    {
        str = str+'\nPlease select "Advertisement Period"';
        str1=true;        
    }
    else
    {
        str1=false;
    }
    
    if((!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnWeeklyINR").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnWeeklyUSD").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnMonthlyINR").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnMonthlyUSD").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnQuarterlyINR").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnQuarterlyUSD").checked))
    {
        str=str+'\nPlease select "Advertisement Pricing"';
        str2=true;        
    }
    else
    {
        str2=false;
    }
    
    str3=false;
    str6=false;
    if(document.getElementById(ctlAdvertiseReg_Edit + "hdnAdvtMode").value == "TICKER")
    {    
        if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").value))    
        {
            str=str+'\nPlease enter "Ticker Text"';
            str3=true;        
        }
        else
        {
            str3=false;
        }              
    }
    else if(document.getElementById(ctlAdvertiseReg_Edit + "hdnAdvtMode").value == "UPLOAD")
    {
        if(document.getElementById(ctlAdvertiseReg_Edit + "hdnAdvtMode").value != "FILE")
        {
            str=str+'\nPlease "Upload Your Image"';
            str6=true;        
        }
        else
        {
            str6=false;
        }
    } 
    
    if(!document.getElementById(ctlAdvertiseReg_Edit + "chkSchedule").checked)
    {
        str=str+'\nPlease accept "Schedule and Terms & Conditions"';     
        str4=true;        
    }
    else
    {
        str4=false;
    }
    
    if(!document.getElementById(ctlAdvertiseReg_Edit + "chkTerms").checked)
    {
        str=str+'\nPlease accept "Payment Terms"';        
        str5=true;        
    }
    else
    {
        str5=false;
    }
    
    if(str!="")
    {
        alert(str);
        if(str9==true)
        {
            document.getElementById(ctlAdvertiseReg_Edit + "calEvent").focus();
            return false;
        }
        if(str1==true)
        {
            document.getElementById(ctlAdvertiseReg_Edit + "rdobtnWeekly").focus();
            return false;
        }            
        if(str2==true)
        {
            document.getElementById(ctlAdvertiseReg_Edit + "rdobtnWeeklyINR").focus();
            return false;
        }
        if(str3==true)
        {
            document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").focus();
            return false;
        }
        if(str6==true)
        {
            return false;
        }
        if(str4==true)
        {
            document.getElementById(ctlAdvertiseReg_Edit + "chkSchedule").focus();
            return false;
        }
        if(str5==true)
        {
            document.getElementById(ctlAdvertiseReg_Edit + "chkTerms").focus();
            return false;
        }        
    }
        
    if((!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnWeekly").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnMonthly").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnQuarterly").checked))
    {
        alert('Please select "Advertisement Period"');        
        document.getElementById(ctlAdvertiseReg_Edit + "rdobtnWeekly").focus();
        return false;
    }
    
    if((!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnWeeklyINR").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnWeeklyUSD").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnMonthlyINR").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnMonthlyUSD").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnQuarterlyINR").checked) && (!document.getElementById(ctlAdvertiseReg_Edit + "rdobtnQuarterlyUSD").checked))
    {
        alert('Please select "Advertisement Pricing"');        
        document.getElementById(ctlAdvertiseReg_Edit + "rdobtnWeeklyINR").focus();
        return false;
    }
      
    if(document.getElementById(ctlAdvertiseReg_Edit + "hdnAdvtMode").value == "TICKER")
    {    
        if(!validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").value))    
        {
            alert('Please enter "Ticker Text"');        
            document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").focus();
            return false;                    
        }
        else
        {
            if(document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").value==0)
            {
                alert('"Ticker Text" should not have only zeroes');
                document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").focus();
                return false;
            }            
            if(validateNumericSpace(document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").value.trim()))
            {
                alert('Please enter valid "Ticker Text"');
                document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").focus();
                return false;
            }	
            if(validateSplChar(document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").value.trim()))
            {
                alert('Please enter valid "Ticker Text"');
                document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").focus();
                return false;
            }
	        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").value.trim();	           
            var len=val.length;           
            if(len<2) 
            {
                alert('Please check "Ticker Text"... \nsingle characters input for "Ticker Text" is not allowed');
                document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").focus();
                return false;							
            }	
            var val = document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").value; 
            if (val.length > 300)
            {	
	            alert('Please check "Ticker Text" exceeds 300 characters');	            
	            event.keyCode=0;
	            document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").focus();
	            return false;
            }	 
        }                
    }
       
    var val=document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").value;	
    document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").value = val.toLowerCase(); 
    document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").value = document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").value.trim();
    
    if(validateNotEmpty(document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").value.trim()))
    {	
        /*		
        if(!validateUrl(document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").value.trim()))
        {
            alert('Please enter valid "URL"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").focus();
            return false;
        }
        */
        if(validateSplChar(document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").value))
        {
            alert('Please enter valid "Landing Page URL"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").focus();
            return false;
        }
        if(validateNumericSpace(document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").value))
        {
            alert('Please enter valid "Landing Page URL"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").focus();
            return false;
        }
        if(document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").value.trim()==0)
        {
            alert('Please enter valid "Landing Page URL"');
            document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").focus();
            return false;
        }
        var val=document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").value.trim();	        
        var len=val.length;        
        if(len<2) 
        {
            alert('Please check "Landing Page URL"... \nsingle characters input in "Landing Page URL" is not allowed');
            document.getElementById(ctlAdvertiseReg_Edit + "txtLandURL").focus();
            return false;							
        }
    }
    
    if(!document.getElementById(ctlAdvertiseReg_Edit + "chkSchedule").checked)
    {
        alert('Please accept "Schedule and Terms & Conditions"');     
        document.getElementById(ctlAdvertiseReg_Edit + "chkSchedule").focus();
        return false;
    }
    
    if(!document.getElementById(ctlAdvertiseReg_Edit + "chkTerms").checked)
    {
        alert('Please accept "Payment Terms"');        
        document.getElementById(ctlAdvertiseReg_Edit + "chkTerms").focus();
        return false;
    }
    
    document.getElementById(ctlAdvertiseReg_Edit + "btnSubmit").disabled = true;
    document.getElementById(ctlAdvertiseReg_Edit + "btnReqReset").disabled = true;
    document.getElementById(ctlAdvertiseReg_Edit + "btnReqClose").disabled = true;
    document.getElementById(ctlAdvertiseReg_Edit + "btnSubmit").className="mfbutton-dis";
    document.getElementById(ctlAdvertiseReg_Edit + "btnReqReset").className="mfbutton-dis";
    document.getElementById(ctlAdvertiseReg_Edit + "btnReqClose").className="mfbutton-dis";
     __doPostBack('ctl00$cphMain$AdvertiseWithUs$btnSubmit','');    
     
     return true;
}

function Advt_TickerText(e)
{														
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    
	var val = document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").value; 
    if (val.length > 299)
    {	
        if(window.Event)
        { 
            if((e.which < 32 && e.which > 126) || (e.which == 8) || (e.which == 0))
            {
                return true;
            }
            else
            {
                alert('Please check "Ticker Text" text...\nexceeds 300 characters');
                return false;
            }
        }
        else
        {
            alert('Please check "Ticker Text" text...\nexceeds 300 characters');
            event.keyCode=0;
        }
        //document.getElementById(ctlAdvertiseReg_Edit + "txtTickerText").focus();
        setTimeout('FocusControl(\'' + ctlAdvertiseReg_Edit + "txtTickerText" + '\')',1);
        elemFocused=true;    
    }
}

function checkAdvtPayment()
{
    var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment");
    
    if(!checkAllInputs())
    {
        return false;
    }
    
    if(val.selectedIndex == 0)
    {
        str='Please select "Payment Mode"';
        str2 = true;        			
    }
    else
    {       
        str = ""; 
        str2 = false;
    }
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value))
    {
        str=str+'\nPlease enter "Instrument Number"';
        str3 = true;        			
    }
    else
    {        
        str3 = false;
    }    
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtInstrumentDate").value))
    {
        str=str+'\nPlease enter or select "Instrument Date"';        
        str4 = true;        			
    }
    else
    {        
        str4 = false;
    }
    
    var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlBankname");
    if(val.selectedIndex == 0)
    {
        str=str+'\nPlease select "Bank Name"';
        str5 = true;        			
    }
    else
    {        
        str5 = false;
    }
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value))
    {
        str=str+'\nPlease enter "Branch Name"';
        str6 = true;        			
    }
    else
    {        
        str6 = false;
    }
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value))
    {
        str=str+'\nPlease enter "City/Country"';
        str7 = true;        			
    }
    else
    {        
        str7 = false;
    }
    
    if(str!="")
    {
        alert(str);
        if(str2==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment").focus();
            return false;
        }  
        if(str3==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
            return false;
        } 
        if(str4==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtInstrumentDate").focus();
            return false;
        }  
        if(str5==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlBankname").focus();
            return false;
        }
        if(str6==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
            return false;            
        }
        if(str7==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
            return false;
        }
    }
    
    // Mode
    
    var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment");
    if(val.selectedIndex == 0)
    {
        alert('Please select "Payment Mode"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment").focus();	         
        return false;			
    }

    // Instrument Number
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value))
    {
        alert('Please enter "Instrument Number"');        
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
        return false;
    }                
            
    if(validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value))        
    {
        var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment");
        
        if(val[val.selectedIndex].value == "CQ" || val[val.selectedIndex].value == "DD")
        {
            if(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim()==0)
            {
                alert('"Instrument Number" should not have only zeroes');
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;
            }
            
            if(!validateAlphaNumeric(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim()))
            {
                alert("Please enter valid instrument number") 
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;
            }
            
            var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim();	        
            var len=val.length;        
            if(len<2) 
            {
                alert('Please check "Instrument Number"... \nsingle characters input in "Instrument Number" is not allowed');
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;							
            }
            
            var Alpha = /^[a-zA-Z]+$/;			
            if(Alpha.test(val))
            {
                alert("Please enter valid instrument number") 
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;
            }
        }
        else if(val[val.selectedIndex].value == "MT" || val[val.selectedIndex].value == "WT")
        {
            if(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim()==0)
            {
                alert('"Instrument Number" should not have only zeroes');
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;
            }
            
            var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim();	        
            var len=val.length;        
            if(len<2) 
            {
                alert('Please check "Instrument Number"... \nsingle characters input in "Instrument Number" is not allowed');
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;							
            }
            
            if(validatePaySplChar(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim()))
            {
                alert('Please enter valid "Instrument Number"');
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();                                
                return false;
            }
        }                           
    }
    
    // Instrument Date
            
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtInstrumentDate").value))
    {
        alert('Please enter or select "Instrument Date"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtInstrumentDate").focus();
        return false;
    }    
    
    // Bank Name
        
    var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlBankname");
    if(val.selectedIndex == 0)
    {
        alert('Please select "Bank Name"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlBankname").focus();	         
        return false;			
    }
    
    // Branch Name
    	     
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value))
    {
        alert('Please enter "Branch Name"');        
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
        return false;
    }  
    if(validateSplChar(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value))
    {
        alert('Please enter valid "Branch Name"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
        return false;
    }
    if(validateNumericSpace(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value))
    {
        alert('Please enter valid "Branch Name"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
        return false;
    }
    if(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value.trim()==0)
    {
        alert('"Branch Name" should not have only zeroes');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
        return false;
    }
    var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value.trim();	        
    var len=val.length;        
    if(len<2) 
    {
        alert('Please check "Branch Name"... \nsingle characters input in "Branch Name" is not allowed');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
        return false;							
    }
    var jointxtval;
    var firstsplit;
    var txtval=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value;
    var allvalue=Array();
    var j=0;    																		
    if(txtval!="")
    {
        txtsplit=txtval.split(" ");                                    
        for(i=0;i<txtsplit.length;i++)
        {           
            splitvalue=txtsplit[i];
            if(splitvalue!="")
            {
                firstsplit=splitvalue.split("");
                if(firstsplit!="")
                {
                    firstsplitval=firstsplit[0];
                    firstsplitval=firstsplitval.toUpperCase( );
                    firstsplit[0]=firstsplitval;
                    jointxtval=firstsplit.join("");
                    allvalue[j]=jointxtval;
                    j=j+1;                    
                }
            }            
        }
        allvaluejoin=allvalue.join(" ");
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value=allvaluejoin;
    }
    
    // City/Country
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value))
    {
        alert('Please enter "City/Country"')
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
        return false;
    }	    
    if(!validatePaySubCity(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value))
    {
        alert('Please enter valid "City/Country"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
        return false;
    }   
    if(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value.trim()==0)
    {
        alert('"City/Country" should not have only zeroes');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
        return false;
    }         
    var strValue=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value
    var len=strValue.length;
    var Alpha=/^[a-zA-Z]+$/;
    if(!Alpha.test(strValue.charAt(0)))
    {
        alert('Please enter valid "City/Country"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
        return false;
    }
    if(!Alpha.test(strValue.charAt(len-1)))
    {
        alert('Please enter valid "City/Country"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
        return false;
    }	
    for(i=0;i<len-1;i++)
    {
        var Alpha = /^[/]+$/;
        if((Alpha.test(strValue.charAt(i))) && (Alpha.test(strValue.charAt(i+1))))
        {
            alert('Please enter valid "City/Country"');
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
            return false;
        }  
    }    
    var jointxtval;
    var firstsplit;
    var txtval=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value;
    var allvalue=Array();
    var j=0;    																		
    if(txtval!="")
    {
        txtsplit=txtval.split(" ");                                    
        for(i=0;i<txtsplit.length;i++)
        {           
            splitvalue=txtsplit[i];
            if(splitvalue!="")
            {
                firstsplit=splitvalue.split("");
                if(firstsplit!="")
                {
                    firstsplitval=firstsplit[0];
                    firstsplitval=firstsplitval.toUpperCase( );
                    firstsplit[0]=firstsplitval;
                    jointxtval=firstsplit.join("");
                    allvalue[j]=jointxtval;
                    j=j+1;                    
                }
            }            
        }
        allvaluejoin=allvalue.join(" ");
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value=allvaluejoin;
    }
    
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_btnPaySubmit").disabled = true;
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_btnPayReset").disabled = true;
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_btnPayClose").disabled = true;
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_btnEdit").disabled = true;
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_btnPaySubmit").className="mfbutton-dis";
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_btnPayReset").className="mfbutton-dis";
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_btnPayClose").className="mfbutton-dis";
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_btnEdit").className="mfbutton-dis";
     __doPostBack('ctl00$cphMain$AdvertiseWithUs$btnPaySubmit',''); 
     
    return true;     
}

function checkAdvtPaymentPrint()
{
    var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment");
    
    if(!checkAllInputs())
    {
        return false;
    }
    
    if(val.selectedIndex == 0)
    {
        str='Please select "Payment Mode"';
        str2 = true;        			
    }
    else
    {       
        str = ""; 
        str2 = false;
    }
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value))
    {
        str=str+'\nPlease enter "Instrument Number"';
        str3 = true;        			
    }
    else
    {        
        str3 = false;
    }    
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtInstrumentDate").value))
    {
        str=str+'\nPlease enter or select "Instrument Date"';        
        str4 = true;        			
    }
    else
    {        
        str4 = false;
    }
    
    var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlBankname");
    if(val.selectedIndex == 0)
    {
        str=str+'\nPlease select "Bank Name"';
        str5 = true;        			
    }
    else
    {        
        str5 = false;
    }
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value))
    {
        str=str+'\nPlease enter "Branch Name"';
        str6 = true;        			
    }
    else
    {        
        str6 = false;
    }
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value))
    {
        str=str+'\nPlease enter "City/Country"';
        str7 = true;        			
    }
    else
    {        
        str7 = false;
    }
    
    if(str!="")
    {
        alert(str);
        if(str2==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment").focus();
            return false;
        }  
        if(str3==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
            return false;
        } 
        if(str4==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtInstrumentDate").focus();
            return false;
        }  
        if(str5==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlBankname").focus();
            return false;
        }
        if(str6==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
            return false;            
        }
        if(str7==true)
        {
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
            return false;
        }
    }
    
    // Mode
    
    var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment");
    if(val.selectedIndex == 0)
    {
        alert('Please select "Payment Mode"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment").focus();	         
        return false;			
    }

    // Instrument Number
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value))
    {
        alert('Please enter "Instrument Number"');        
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
        return false;
    }                
            
    if(validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value))        
    {
        var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment");
        
        if(val[val.selectedIndex].value == "CQ" || val[val.selectedIndex].value == "DD")
        {
            if(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim()==0)
            {
                alert('"Instrument Number" should not have only zeroes');
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;
            }
            
            if(!validateAlphaNumeric(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim()))
            {
                alert("Please enter valid instrument number") 
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;
            }
            
            var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim();	        
            var len=val.length;        
            if(len<2) 
            {
                alert('Please check "Instrument Number"... \nsingle characters input in "Instrument Number" is not allowed');
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;							
            }
            
            var Alpha = /^[a-zA-Z]+$/;			
            if(Alpha.test(val))
            {
                alert("Please enter valid instrument number") 
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;
            }
        }
        else if(val[val.selectedIndex].value == "MT" || val[val.selectedIndex].value == "WT")
        {
            if(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim()==0)
            {
                alert('"Instrument Number" should not have only zeroes');
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;
            }
            
            var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim();	        
            var len=val.length;        
            if(len<2) 
            {
                alert('Please check "Instrument Number"... \nsingle characters input in "Instrument Number" is not allowed');
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();
                return false;							
            }
            
            if(validatePaySplChar(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value.trim()))
            {
                alert('Please enter valid "Instrument Number"');
                document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").focus();                                
                return false;
            }
        }                           
    }
    
    // Instrument Date
            
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtInstrumentDate").value))
    {
        alert('Please enter or select "Instrument Date"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtInstrumentDate").focus();
        return false;
    }    
    
    // Bank Name
        
    var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlBankname");
    if(val.selectedIndex == 0)
    {
        alert('Please select "Bank Name"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlBankname").focus();	         
        return false;			
    }
    
    // Branch Name
    	     
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value))
    {
        alert('Please enter "Branch Name"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
        return false;
    }  
    if(validateSplChar(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value))
    {
        alert('Please enter valid "Branch Name"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
        return false;
    }
    if(validateNumericSpace(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value))
    {
        alert('Please enter valid "Branch Name"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
        return false;
    }
    if(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value.trim()==0)
    {
        alert('"Branch Name" should not have only zeroes');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
        return false;
    }
    var val=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value.trim();	        
    var len=val.length;        
    if(len<2) 
    {
        alert('Please check "Branch Name"... \nsingle characters input in "Branch Name" is not allowed');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").focus();
        return false;							
    }
    var jointxtval;
    var firstsplit;
    var txtval=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value;
    var allvalue=Array();
    var j=0;    																		
    if(txtval!="")
    {
        txtsplit=txtval.split(" ");                                    
        for(i=0;i<txtsplit.length;i++)
        {           
            splitvalue=txtsplit[i];
            if(splitvalue!="")
            {
                firstsplit=splitvalue.split("");
                if(firstsplit!="")
                {
                    firstsplitval=firstsplit[0];
                    firstsplitval=firstsplitval.toUpperCase( );
                    firstsplit[0]=firstsplitval;
                    jointxtval=firstsplit.join("");
                    allvalue[j]=jointxtval;
                    j=j+1;                    
                }
            }            
        }
        allvaluejoin=allvalue.join(" ");
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value=allvaluejoin;
    }
    
    // City/Country
    
    if(!validateNotEmpty(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value))
    {
        alert('Please enter "City/Country"')
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
        return false;
    }	    
    if(!validatePaySubCity(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value))
    {
        alert('Please enter valid "City/Country"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
        return false;
    }   
    if(document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value.trim()==0)
    {
        alert('"City/Country" should not have only zeroes');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
        return false;
    }         
    var strValue=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value
    var len=strValue.length;
    var Alpha=/^[a-zA-Z]+$/;
    if(!Alpha.test(strValue.charAt(0)))
    {
        alert('Please enter valid "City/Country"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
        return false;
    }
    if(!Alpha.test(strValue.charAt(len-1)))
    {
        alert('Please enter valid "City/Country"');
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
        return false;
    }	
    for(i=0;i<len-1;i++)
    {
        var Alpha = /^[/]+$/;
        if((Alpha.test(strValue.charAt(i))) && (Alpha.test(strValue.charAt(i+1))))
        {
            alert('Please enter valid "City/Country"');
            document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").focus();
            return false;
        }  
    }    
    var jointxtval;
    var firstsplit;
    var txtval=document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value;
    var allvalue=Array();
    var j=0;    																		
    if(txtval!="")
    {
        txtsplit=txtval.split(" ");                                    
        for(i=0;i<txtsplit.length;i++)
        {           
            splitvalue=txtsplit[i];
            if(splitvalue!="")
            {
                firstsplit=splitvalue.split("");
                if(firstsplit!="")
                {
                    firstsplitval=firstsplit[0];
                    firstsplitval=firstsplitval.toUpperCase( );
                    firstsplit[0]=firstsplitval;
                    jointxtval=firstsplit.join("");
                    allvalue[j]=jointxtval;
                    j=j+1;                    
                }
            }            
        }
        allvaluejoin=allvalue.join(" ");
        document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value=allvaluejoin;
    }        
}

function CallAdvtPaymentPrint()
{
    window.open ("PrintFrame.aspx?Data=RegAdvtAdvertiseModes","","fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no,width=700,height=700,left=0,top=0");    
}

function clearPaymentCtrls()
{
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment").value="--Select--";
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtChequeNo").value="";
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtInstrumentDate").value="";
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlBankname").value="--Select--";
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtBranch").value=""; 
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_txtCountry").value="";
    document.getElementById("ctl00_cphMain_AdvertiseWithUs_ddlPayment").focus();
    return false;
}

function ADCheckPhone(CtrlPhone, PhNo)
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    var valCountry = document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
    if(valCountry[valCountry.selectedIndex].text == "India")
    {
        if(validateNotEmpty(document.getElementById(CtrlPhone).value.trim()))
        {
            if(!validatePhoneNumber(document.getElementById(CtrlPhone).value.trim()))
            {            
                alert('Please enter valid "Phone Number' + PhNo + '"');            
                setTimeout('FocusControl(\'' + CtrlPhone + '\')',1);
                elemFocused=true; 
                return false;
            }
        }
    }
}

function ADCheckContact(CtrlPhone, PhNo)
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    var valCountry = document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
    if(valCountry[valCountry.selectedIndex].text == "India")
    {
        if(validateNotEmpty(document.getElementById(CtrlPhone).value.trim()))
        {
            if(!validateContactNumber(document.getElementById(CtrlPhone).value.trim()))
            {            
                alert('Please enter valid "Contact Number' + PhNo + '"');            
                setTimeout('FocusControl(\'' + CtrlPhone + '\')',1);
                elemFocused=true; 
                return false;
            }
        }
    }
}
function ADCheckFax(CtrlFax)
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    var valCountry = document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
    if(valCountry[valCountry.selectedIndex].text == "India")
    {
        if(validateNotEmpty(document.getElementById(CtrlFax).value.trim()))
        {
            if(!validateFaxNumber(document.getElementById(CtrlFax).value.trim()))
            {
                alert('Please enter valid "Fax Number"');            
                setTimeout('FocusControl(\'' + CtrlFax + '\')',1);
                elemFocused=true; 
                return false;
            }
        }
    }
}

function ADCheckMobile(CtrlMobile)
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    var valCountry = document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");
    if(valCountry[valCountry.selectedIndex].text == "India")
    {
        if(validateNotEmpty(document.getElementById(CtrlMobile).value))
        {
            if(!validateMobileNumber(document.getElementById(CtrlMobile).value.trim()))
            {
                alert('Please enter valid "Mobile Number"');            
                setTimeout('FocusControl(\'' + CtrlMobile + '\')',1);
                elemFocused=true;  
                return false;
            }
        }
    }
}

function ADCheckNumeric(e)
{
    var ctlAdvertiseReg_Edit = "ctl00_cphMain_AdvertiseWithUs_";
    var valCountry = document.getElementById(ctlAdvertiseReg_Edit + "ddlCountry");    
    if(valCountry[valCountry.selectedIndex].text == "India")
    {
        if(window.Event)
        {
            if((e.which >= 45 && e.which <= 57) || (e.which == 8) || (e.which == 46) || (e.which == 47) || (e.which == 0))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        else
        {
            if(event.keyCode < 45 || event.keyCode > 57 || event.keyCode == 46 || event.keyCode == 47)
            {
                event.returnValue = false;
            }
        }
    }
}