﻿
//----------------------------<Common Functions>--------------------------------------------------------

function Trim(str)
{

   return str.replace(/^\s*|\s*$/g,"");
}

function IsValidURL(urlStr) {

   
    if (urlStr.indexOf(" ") != -1) 
    {
        alert("Spaces are not allowed in a URL");
        return false;
    }
    if(urlStr.indexOf(".") == -1) 
    {
        alert("Invalid URL.\nURL should have at least one (.) character");
        return false;
    }
//    var domArr=urlStr.split(".");
//    var len=domArr.length;
//    alert(len);
//    if(len<2)
//    {
//        
//    }
  //  var x= ((urlStr.indexOf("http://") == -1) + (urlStr.indexOf("https://") == -1));
   
   var x= ((urlStr.indexOf("http://")) + (urlStr.indexOf("https://")));
   // alert(x);alert(urlStr.indexOf("http://"));alert(urlStr.indexOf("https://"));
    if(x==-2)
    {
        alert("Invalid URL.\nURL should start with http:// or https://");
        return false;
    }
    return true;
    
}


//function IsValidURL(urlStr) {

//   
//    if (urlStr.indexOf(" ") != -1) 
//    {
//        alert("Spaces are not allowed in a URL");
//        return false;
//    }
//    if(urlStr.indexOf(".") == -1) 
//    {
//        alert("Invalid URL");
//        return false;
//    }
//  //  var x= ((urlStr.indexOf("http://") == -1) + (urlStr.indexOf("https://") == -1));
//   
//   var x= ((urlStr.indexOf("http://")) + (urlStr.indexOf("https://")));
//   // alert(x);alert(urlStr.indexOf("http://"));alert(urlStr.indexOf("https://"));
//    if(x==-2)
//    {
//        alert("Invalid URL");
//        return false;
//    }
//    return true;
//    
//}

function isValidCharacter(evt)
			{
			// MOzilla , safari, IE
				var charCode = (evt.which) ? evt.which : event.keyCode
		
			     if ((charCode>=65 && charCode<=90) || (charCode>=97 && charCode<=122) ||  charCode==32 ||  charCode==8)
                    {
                     return true;
                    }		
				return false;
			}


function CheckMail(control,message) 
{
    var controlname=document.getElementById(control);
    var str= document.getElementById(control).value;
    if (str.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
    {
    
        return true;
    }
    else
    {
        alert(message);
        controlname.focus();
        return false;
    }					
}

function isNumberKey(evt)
			{
				var charCode = (evt.which) ? evt.which : event.keyCode
				if (charCode > 31 && (charCode < 48 || charCode > 57))
					return false;
				return true;
			}



function isNumberKey_Phone(evt)
			{
				var charCode = (evt.which) ? evt.which : event.keyCode
				if ((charCode > 31 && (charCode < 48 || charCode > 57)) || charCode ==107 || charCode==109 ) 
					return false;
				return true;
			}
	
	//----------------------------</Common Functions>--------------------------------------------------------	
			
			
	//----------------------------<Header Validaions>--------------------------------------------------------
	
			
	function ValidateLoginPassword()
    {
        var username=document.getElementById("Header1_txtUserName");
         var password=document.getElementById("Header1_txtPassword");
         if(Trim(username.value)=="")
         {
            alert("Please enter Username");
            username.focus();
            return false;
         }
         
        
         if(Trim(password.value)=="")
         {
            alert("Please enter Password");
            password.focus();
            return false;
         }
         
         

    }		

		
	
	function SetOnFocus(obj)
		{
		
		     if(obj.id=='Header1_txtUserName')
		    {
		        if(Trim(obj.value)=='Username')obj.value='';
    		
		    }
		    else if(obj.id=='Header1_txtPassword')
		     {
		        if(Trim(obj.value)=='Password')obj.value='';
		     }
		
		}
		
function SetOnBlur(obj)
		{
		
		     if(obj.id=='Header1_txtUserName')
		    {
		        if(Trim(obj.value)=='')obj.value='Username';
    		
		    }
		    else if(obj.id=='Header1_txtPassword')
		     {
		        if(Trim(obj.value)=='')obj.value='Password';
		     }
		
		}
			
//----------------------------</Header Validaions>--------------------------------------------------------


//----------------------------<Search Panel Validaions>--------------------------------------------------------

function ValidateSearchTextBox()
    {
        var txtSearch=document.getElementById("SearchPanel1_txtSearch");
        
         if(Trim(txtSearch.value)=="")
         {
            alert("Please enter Search Text.");
            txtSearch.focus();
            return false;
         }
        

    }
    
//----------------------------</Search Panel Validaions>-------------------------------------------------------- 

//----------------------------<Customer Registration>-------------------------------------------------------- 
function validateCustomerRegistration()
				{
				
				    if(Trim(document.Form1.txtUsername.value)=="")
						{
						alert("Please enter Username");
						document.Form1.txtUsername.focus();
						return false;
						}
						
					var Username=Trim(document.Form1.txtUsername.value)	
					if(Username.length<6 || Username.length>15)
					{
					    alert('Username should be of 6 to 15 characters');
					    document.Form1.txtUsername.focus();
					    return false;
					}
					
					if(Trim(document.Form1.txtPassword.value)=="")
						{
						alert("Please enter the password");
						document.Form1.txtPassword.focus();
						return false;
						}
						
						var Password=Trim(document.Form1.txtPassword.value)
						
						if(Password.length<6 || Password.length>15)
						{
						    alert('Password should be of 6 to 15 characters.');
						    document.Form1.txtPassword.focus();
						    return false;
						}
						
						if(Trim(document.Form1.txtReTypePassword.value)=="")
						{
						alert("Please Retype the password");
						document.Form1.txtReTypePassword.focus();
						return false;
						}
						
				if(Trim(document.Form1.txtPassword.value)!= Trim(document.Form1.txtReTypePassword.value))
						{
						alert("Please Retype password correctly.");
						document.Form1.txtReTypePassword.focus();
						return false;
						}
					
				
					if(Trim(document.Form1.txtEmail.value)=="")
						{
						alert("Please enter Email");
						document.Form1.txtEmail.focus();
						return false;
						}
					
			
					if(!CheckMail("txtEmail","Invalid Email"))
                         {
                            return false;
                         }
					
//					if(Trim(document.getElementById("txtAlternateEmail").value)=="")
//						{
//						    alert("Please enter the Alternate Email");
//						    document.getElementById("txtAlternateEmail").focus();
//						    return false;
//						}
						
			            if(Trim(document.getElementById("txtAlternateEmail").value)!="")
			            {
					        if(!CheckMail("txtAlternateEmail","Invalid Email"))
                                 {
                                    return false;
                                 }
					    }
					
				
					if(Trim(document.Form1.txtFname.value)=="")
						{
						alert("Please enter the Customer Name");
						document.Form1.txtFname.focus();
						return false;
						}
					
						if(Trim(document.Form1.txtCompanyName.value)=="")
						{
						alert("Please enter the Company Name ");
						document.Form1.txtCompanyName.focus();
						return false;
						}

						if ((document.Form1.ddlBusinessType.value) == "0")
						{
						alert("Please select the Business Type");
						document.Form1.ddlBusinessType.focus();
						return false;
						}


						if ((document.Form1.ddlDesignation.value) == "0")
						{
						alert("Please select the Designation");
						document.Form1.ddlDesignation.focus();
						return false;
						}
						
						
						if(Trim(document.Form1.txtAddress.value)=="")
						{
						alert("Please enter the Address");
						document.Form1.txtAddress.focus();
						return false;
						}
						if(Trim(document.Form1.txtCity.value)=="")
						{
						alert("Please enter the City");
						document.Form1.txtCity.focus();
						return false;
						}
//						if(Trim(document.Form1.txtState.value)=="")
//						{
//						alert("Please enter the State");
//						document.Form1.txtState.focus();
//						return false;
//						}
						
						if(document.getElementById('ddlCountry').value==0)
						{
						  alert('Please Select country');
						  document.getElementById('ddlCountry').focus();
						  return false;
						}
						
						if(Trim(document.getElementById('txtPin').value)!="")
						{
						    if(isNaN(Trim(document.getElementById('txtPin').value)))
                            {
                                alert('Pin Code should be numeric.');
                                document.getElementById('txtPin').focus()
                                return false;
                            }
						}
						
						
//						if((Trim(document.Form1.txtPhone.value)=="")&&(Trim(document.Form1.txtMobile.value)==""))
//						{
//						alert("Please enter the Mobile or Phone Number");
//						document.Form1.txtPhone.focus();
//						return false;
//						}
						
						
						if((Trim(document.Form1.txtPhone.value)==""))
						{
						alert("Please enter the Phone Number");
						document.Form1.txtPhone.focus();
						return false;
						}
						
						
						if((Trim(document.Form1.txtMobile.value)==""))
						{
						alert("Please enter the Mobile Number");
						document.Form1.txtMobile.focus();
						return false;
						}
						
					
							if(Trim(document.getElementById('txtPhone').value)!="")
						    {
						        // if phone no is entered; make mandatory country code as well as STD code.
    						   
                                if(isNaN(Trim(document.getElementById('txtPhone').value)))
                                {
                                    alert('Phone No. should be numeric.');
                                    document.getElementById('txtPhone').focus()
                                    return false;
                                }
    						   
    						   
						        if(Trim(document.getElementById('txtCountryCode').value)=="")
						        {
						          alert('Please Select Phone-Country Code');
						          document.getElementById('txtCountryCode').focus();
						          return false;
						        }
						        
    						    if(isNaN(Trim(document.getElementById('txtCountryCode').value)))
                                {
                                    alert('Phone-Country Code should be numeric.');
                                    document.getElementById('txtCountryCode').focus()
                                    return false;
                                }
						        
						        if(Trim(document.getElementById('txtSTDCode').value)=="")
						        {
						          alert('Please Select Phone-STD Code');
						          document.getElementById('txtSTDCode').focus();
						          return false;
						        }
    						    
    						    if(isNaN(Trim(document.getElementById('txtSTDCode').value)))
                                {
                                    alert('Phone-STD Code should be numeric.');
                                    document.getElementById('txtSTDCode').focus()
                                    return false;
                                }
    						    
    						    
						    }
						
						    if(Trim(document.getElementById('txtMobile').value)!="")
						    {
						        // if Mobile no is entered; make mandatory country code.
    						   
    						   if(isNaN(Trim(document.getElementById('txtMobile').value)))
    						   {
    						        alert('Mobile No. should be numeric.');
    						        document.getElementById('txtMobile').focus()
    						        return false;
    						   }
    						   
    						   //-----If country is India--- Min 10 digits in Mobile no. and start with 9
    						   
    						   if(document.getElementById('ddlCountry').value==65)
    						   {
    						        if(Trim(document.getElementById('txtMobile').value).length<10)
    						        {
                                        alert('Mobile No. should be of minimum 10 digits.');
                                        document.getElementById('txtMobile').focus()
                                        return false;
    						        }
    						        
                                    if (Trim(document.getElementById('txtMobile').value).charAt(0)!="9")
                                    {
                                        alert("Mobile No. should start with 9 ");
                                        document.getElementById('txtMobile').focus();
                                        return false
                                    }

    						   }
    						   
    						   
						        if(Trim(document.getElementById('txtCountryCodeMobile').value)=="")
						        {
						          alert('Please Select Mobile-Country Code');
						          document.getElementById('txtCountryCodeMobile').focus();
						          return false;
						        }
						        
						        if(Trim(document.getElementById('txtCountryCodeMobile').value)!="")
						        { 
                                    if(isNaN(Trim(document.getElementById('txtCountryCodeMobile').value)))
                                    {
                                        alert('Country Code-Mobile No. should be numeric.');
                                        document.getElementById('txtCountryCodeMobile').focus()
                                        return false;
                                    }
                                    
    						   }
    						    						    
						    }
						
						if(Trim(document.getElementById('txtWebSite').value)!="")
						{
						    if(!IsValidURL(document.getElementById('txtWebSite').value))
				            {
				                document.getElementById('txtWebSite').focus();
                                return false;				            
				            }
												
						}
						
						


					    if (document.getElementById('ddlWhereHear').value == "0")
					     {
					    	alert('Please select where did you hear about us.');
					    	document.getElementById('ddlWhereHear').focus();
					    	return false;
					    }

					    if (document.getElementById('ddlWhereHear').value == "Others") 
					    {

					    	if (Trim(document.getElementById("txtWhereOther").value) == "") 
					    	{
					    		alert("Please enter source name if other is selected.");
					    		document.getElementById("txtWhereOther").focus();
					    		return false;
					    	}
					    
					    }

					    if (document.getElementById('ddlSecurityQuestion').value == "0") {
					    	alert('Please select security hint question.');
					    	document.getElementById('ddlSecurityQuestion').focus();
					    	return false;
					    }

					    if (Trim(document.getElementById("txtAnswer").value) == "") {
					    	alert("Please enter the answer of security hint question.");
					    	document.getElementById("txtAnswer").focus();
					    	return false;
					    }

					    if (document.getElementById('chkAgree').checked != true) {
					    	alert('you cannot proceed without agreement of terms and conditions.');
					    	return false;
					    }

					    if (Trim(document.getElementById("CaptchaTextBox").value) == "") {
					    	alert("Please enter the text shown in image");
					    	document.getElementById("CaptchaTextBox").focus();
					    	return false;
					    }

					    
					   
					
					
			return true;
			}   
			
			
function ResetRegistration()
{
    document.getElementById('txtEmail').value='';
    document.getElementById('txtPassword').value='';
    document.getElementById('txtReTypePassword').value='';
    document.getElementById('txtFname').value='';
    
    document.getElementById('rblGender_0').checked='checked';
    
    document.getElementById('txtCompanyName').value='';
    document.getElementById('ddlBusinessType').value='0';
    document.getElementById('ddlDesignation').value='0';
    document.getElementById('txtAddress').value='';
    document.getElementById('txtCity').value='';
    document.getElementById('txtState').value='';
    if(document.getElementById('ddlCountry')!=null)
    {
        document.getElementById('ddlCountry').value='0';
    }
    document.getElementById('txtPin').value='';
    
    document.getElementById('txtSTDCode').value='';
    document.getElementById('txtCountryCode').value='';
    document.getElementById('txtPhone').value='';
    
    
    document.getElementById('txtCountryCodeMobile').value='';
    document.getElementById('txtMobile').value='';
    
    document.getElementById('txtWebSite').value='';
    document.getElementById('txtAlternateEmail').value='';
    document.getElementById('ddlWhereHear').value='0';
    document.getElementById('ddlSecurityQuestion').value='0';
    document.getElementById('txtAnswer').value='';
    document.getElementById('CaptchaTextBox').value='';
    
     document.getElementById('txtEmail').focus();
    
   return false;
}			
			
			
//----------------------------</Customer Registration>-------------------------------------------------------- 


//----------------------------<Customer Login>-------------------------------------------------------- 
    function validateCustomerLogin()
				        {
						    if(Trim(document.Form1.txtEmail.value)=="")
						    {
						    alert("Please enter username.");
						    document.Form1.txtEmail.focus();
						    return false;
						    }
						    
						    if(Trim(document.Form1.txtPassword.value)=="")
						    {
						    alert("Please enter password.");
						    document.Form1.txtPassword.focus();
						    return false;
						    }
						    
						    
						    
						}
//----------------------------</Customer Login>-------------------------------------------------------- 	



//----------------------------<Customer Forgot password>-------------------------------------------------------- 
      function validateCustomerForgotPassword()
				        {
				        
				        
				        if(Trim(document.Form1.txtUsername.value)=="")
						{
						alert("Please enter Username");
						document.Form1.txtUsername.focus();
						return false;
						}
						
					    var Username=Trim(document.Form1.txtUsername.value)	
					    if(Username.length<6 || Username.length>15)
					    {
					        alert('Username should be of 6 to 15 characters');
					        document.Form1.txtUsername.focus();
					        return false;
					    }
				
				        
						    if(Trim(document.Form1.txtEmail.value)=="")
						    {
						    alert("Please enter email.");
						    document.Form1.txtEmail.focus();
						    return false;
						    }
						    
						    if(!CheckMail("txtEmail","Invalid email."))
                            {
                                return false;
                            }
						 
						}
//----------------------------</Customer Forgot password>-------------------------------------------------------- 						


//----------------------------<Customer Reset password>-------------------------------------------------------- 
      function validateCustomerResetForgotPassword()
				        {
						    	if(Trim(document.Form1.txtPassword.value)=="")
						{
						alert("Please enter the password");
						document.Form1.txtPassword.focus();
						return false;
						}
						
						var Password=Trim(document.Form1.txtPassword.value)
						
						if(Password.length<6)
						{
						    alert('Password should be of six or more characters.');
						    document.Form1.txtPassword.focus();
						    return false;
						}
						
						if(Trim(document.Form1.txtReTypePassword.value)=="")
						{
						alert("Please Retype the password");
						document.Form1.txtReTypePassword.focus();
						return false;
						}
						
				if(Trim(document.Form1.txtPassword.value)!= Trim(document.Form1.txtReTypePassword.value))
						{
						alert("Please Retype password correctly.");
						document.Form1.txtReTypePassword.focus();
						return false;
						}
						 
						}
//----------------------------</Customer Reset password>--------------------------------------------------------


//----------------------------<Customer Change password>-------------------------------------------------------- 
      function validateCustomerChangePassword()
				        {
						 
						if(Trim(document.Form1.txtOldPassword.value)=="")
						{
						alert("Please enter the Old Password");
						document.Form1.txtOldPassword.focus();
						return false;
						}    	
						    	
						    	
						if(Trim(document.Form1.txtPassword.value)=="")
						{
						alert("Please enter the password");
						document.Form1.txtPassword.focus();
						return false;
						}
						
						var Password=Trim(document.Form1.txtPassword.value)
						
						if(Password.length<6)
						{
						    alert('Password should be of six to 15 characters.');
						    document.Form1.txtPassword.focus();
						    return false;
						}
						
						if(Trim(document.Form1.txtReTypePassword.value)=="")
						{
						alert("Please Retype the password");
						document.Form1.txtReTypePassword.focus();
						return false;
						}
						
				if(Trim(document.Form1.txtPassword.value)!= Trim(document.Form1.txtReTypePassword.value))
						{
						alert("Please Retype password correctly.");
						document.Form1.txtReTypePassword.focus();
						return false;
						}
						 
						}
//----------------------------</Customer Change password>-------------------------------------------------------- 			

//----------------------------<Update Profile>-------------------------------------------------------- 
function validateUpdateCustomerProfile()
				{
				
				
					if(Trim(document.Form1.txtEmail.value)=="")
						{
						alert("Please enter email");
						document.Form1.txtEmail.focus();
						return false;
						}
					
			
					if(!CheckMail("txtEmail","Invalid email"))
                         {
                            return false;
                         }
					
//					if(Trim(document.Form1.txtAlternateEmail.value)=="")
//						{
//						    alert("Please enter Alternate Email");
//						    document.Form1.txtAlternateEmail.focus();
//						    return false;
//						}
					
					if(!CheckMail("txtAlternateEmail","Invalid email"))
                                 {
                                    return false;
                                 }
					
//					if(Trim(document.getElementById("txtAlternateEmail").value)!="")
//			            {
//					        if(!CheckMail("txtAlternateEmail","Invalid email"))
//                                 {
//                                    return false;
//                                 }
//					    }
				
					if(Trim(document.Form1.txtFname.value)=="")
						{
						alert("Please enter the customer name");
						document.Form1.txtFname.focus();
						return false;
						}
						
						if(Trim(document.Form1.txtCompanyName.value)=="")
						{
						alert("Please enter the company name ");
						document.Form1.txtCompanyName.focus();
						return false;
						}


						if ((document.Form1.ddlBusinessType.value) == "0") {
							alert("Please select the Business Type");
							document.Form1.ddlBusinessType.focus();
							return false;
						}


						if ((document.Form1.ddlDesignation.value) == "0") {
							alert("Please select the Designation");
							document.Form1.ddlDesignation.focus();
							return false;
						}
						
						
						
						
//						if(Trim(document.Form1.txtBusinessType.value)=="")
//						{
//						alert("Please enter the business type");
//						document.Form1.txtBusinessType.focus();
//						return false;
//						}
//						
//						
//                  if(Trim(document.Form1.txtDesignation.value)=="")
//						{
//						alert("Please enter the designation");
//						document.Form1.txtDesignation.focus();
//						return false;
//						}
						
						
						if(Trim(document.Form1.txtAddress.value)=="")
						{
						alert("Please enter the address");
						document.Form1.txtAddress.focus();
						return false;
						}
						if(Trim(document.Form1.txtCity.value)=="")
						{
						alert("Please enter the city");
						document.Form1.txtCity.focus();
						return false;
						}
						
//						if(Trim(document.Form1.txtState.value)=="")
//						{
//						alert("Please enter the state");
//						document.Form1.txtState.focus();
//						return false;
//						}
						
						if(document.getElementById('ddlCountry').value==0)
						{
						  alert('Please Select country');
						  document.getElementById('ddlCountry').focus();
						  return false;
						}
						
						if(Trim(document.getElementById('txtPin').value)!="")
						{
						    if(isNaN(Trim(document.getElementById('txtPin').value)))
                            {
                                alert('Pin Code should be numeric.');
                                document.getElementById('txtPin').focus()
                                return false;
                            }
						}
						
						
//						if((Trim(document.Form1.txtPhone.value)=="")&&(Trim(document.Form1.txtMobile.value)==""))
//						{
//						alert("Please enter the mobile or phone number");
//						document.Form1.txtPhone.focus();
//						return false;
//						}
						
						if((Trim(document.Form1.txtPhone.value)==""))
						{
						alert("Please enter the Phone Number");
						document.Form1.txtPhone.focus();
						return false;
						}
						
						
						if((Trim(document.Form1.txtMobile.value)==""))
						{
						alert("Please enter the Mobile Number");
						document.Form1.txtMobile.focus();
						return false;
						}
						
						
						
						
							if(Trim(document.getElementById('txtPhone').value)!="")
						    {
						        // if phone no is entered; make mandatory country code as well as STD code.
    						   
                                if(isNaN(Trim(document.getElementById('txtPhone').value)))
                                {
                                    alert('Phone No. should be numeric.');
                                    document.getElementById('txtPhone').focus()
                                    return false;
                                }
    						   
    						   
						        if(Trim(document.getElementById('txtCountryCode').value)=="")
						        {
						          alert('Please Select Phone-Country Code');
						          document.getElementById('txtCountryCode').focus();
						          return false;
						        }
						        
    						    if(isNaN(Trim(document.getElementById('txtCountryCode').value)))
                                {
                                    alert('Phone-Country Code should be numeric.');
                                    document.getElementById('txtCountryCode').focus()
                                    return false;
                                }
						        
						        if(Trim(document.getElementById('txtSTDCode').value)=="")
						        {
						          alert('Please Select Phone-STD Code');
						          document.getElementById('txtSTDCode').focus();
						          return false;
						        }
    						    
    						    if(isNaN(Trim(document.getElementById('txtSTDCode').value)))
                                {
                                    alert('Phone-STD Code should be numeric.');
                                    document.getElementById('txtSTDCode').focus()
                                    return false;
                                }
    						    
    						    
						    }
						
						    if(Trim(document.getElementById('txtMobile').value)!="")
						    {
						        // if Mobile no is entered; make mandatory country code.
    						   
    						   if(isNaN(Trim(document.getElementById('txtMobile').value)))
    						   {
    						        alert('Mobile No. should be numeric.');
    						        document.getElementById('txtMobile').focus()
    						        return false;
    						   }
    						   
    						    //-----If country is India--- Min 10 digits in Mobile no. and start with 9
    						   
    						   if(document.getElementById('ddlCountry').value==65)
    						   {
    						        if(Trim(document.getElementById('txtMobile').value).length<10)
    						        {
                                        alert('Mobile No. should be of minimum 10 digits.');
                                        document.getElementById('txtMobile').focus()
                                        return false;
    						        }
    						        
                                    if (Trim(document.getElementById('txtMobile').value).charAt(0)!="9")
                                    {
                                        alert("Mobile No. should start with 9 ");
                                        document.getElementById('txtMobile').focus();
                                        return false
                                    }

    						   }
    						   
    						   
    						   
						        if(Trim(document.getElementById('txtCountryCodeMobile').value)=="")
						        {
						          alert('Please Select Mobile-Country Code');
						          document.getElementById('txtCountryCodeMobile').focus();
						          return false;
						        }
						        
						        if(Trim(document.getElementById('txtCountryCodeMobile').value)!="")
						        { 
                                    if(isNaN(Trim(document.getElementById('txtCountryCodeMobile').value)))
                                    {
                                        alert('Country Code-Mobile No. should be numeric.');
                                        document.getElementById('txtCountryCodeMobile').focus()
                                        return false;
                                    }
    						   }
    						    						    
						    }
						
						
						
						if(Trim(document.getElementById('txtWebSite').value)!="")
						{
						    if(!IsValidURL(document.getElementById('txtWebSite').value))
				            {
				                document.getElementById('txtWebSite').focus();
                                return false;				            
				            }
												
						}
						
						
						
						
						
					    
					
			return true;
			}   
			
//----------------------------</Update Profile>-------------------------------------------------------- 		

//----------------------------<Search Result Page>-------------------------------------------------------- 
function PriceWindow(obj)
{
    //alert(obj);
    
    if(obj=='login.aspx')
    {
        location.href=obj;
    }
    else if(obj.indexOf("PriceRequest.aspx")!=-1)
    {    
        
    }
    else
    {
      window.open(obj,"pricewindow","height=470;width=500;scrollbars=yes");
    }
}	 						

function PriceRequestWindow(id)
{
       
     window.open('PriceRequest.aspx?id='+ id +'', 'EmailLB', 'width=600,height=600,top=50,left=50,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=yes,copyhistory=0');
    
}	

 function EmailPriceRequest(id)
    {
              
        window.open('popups/PriceRequest.aspx?code='+ id +'', 'EmailLB', 'width=450,height=320,top=150,left=150,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=yes,copyhistory=0');
    }
 
  function PriceWindowNew(pid)
    {
       
       window.open("Pricing.aspx?id="+pid+"","pricewindow","height=500;width=500;resizable=yes;scrollbars=yes;copyhistory=0");
      
    }  


function PriceWindowAtImageDetails(obj)
{
    //alert(obj);
    
    if(obj=='login.aspx')
    {
        location.href='login.aspx?ReturnUrl=ImageDetails.aspx';
    }
    else
    {    
       //  window.open(obj,"pricewindow","height=500;width=500");
          window.open(obj, 'pricewindow','width=900,height=550,top=50,left=50,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=yes,copyhistory=0');
         
    }
}	

//----------------------------</Search Result Page>-------------------------------------------------------- 

//----------------------------<popup print lightbox Page>-------------------------------------------------------- 

function printInvoice(var1,var2)
   {
       var printContent = document.getElementById(var1);
        document.getElementById(var2).style.display='none';
       var windowUrl = 'about:blank';
 var uniqueName = new Date();
 var windowName = 'Print' + uniqueName.getTime();
 var printWindow = window.open(windowUrl, windowName, 'left=0,top=0,width=0,height=0');
       printWindow.document.write(printContent.innerHTML);
         printWindow.document.close();
         printWindow.focus();
         printWindow.print();
         document.getElementById(var2).style.display='block';
         printWindow.close();
   }
   
   function printLBSheet(var1,var2)
   {
       var printContent = document.getElementById(var1);
        document.getElementById(var2).style.display='none';
       var windowUrl = 'about:blank';
 var uniqueName = new Date();
 var windowName = 'Print' + uniqueName.getTime();
 var printWindow = window.open(windowUrl, windowName, 'left=0,top=0,width=0,height=0');
       printWindow.document.write(printContent.innerHTML);
         printWindow.document.close();
         printWindow.focus();
         printWindow.print();
         
         document.getElementById(var2).style.display='block';
         printWindow.close();
   }
  
   function printInvoiceSecond(var1)
   {
   // alert('printing.....')
       var printContent = document.getElementById(var1);
     
       var windowUrl = 'about:blank';
 var uniqueName = new Date();
 var windowName = 'Print' + uniqueName.getTime();
 var printWindow = window.open(windowUrl, windowName, 'left=0,top=0,width=0,height=0');
       printWindow.document.write(printContent.innerHTML);
         printWindow.document.close();
         printWindow.focus();
         printWindow.print();
         printWindow.close();
   }
   
   
   function openPrintOrderWindow(arg)
    {
      window.open('PrintOrder.aspx?OID='+arg+'', 'Orders', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=650,height=650,left=100, top=100');
    
    }
   
   
   function printOrder(var1,var2)
   {
       var printContent = document.getElementById(var1);
        document.getElementById(var2).style.display='none';
       var windowUrl = 'about:blank';
 var uniqueName = new Date();
 var windowName = 'Print' + uniqueName.getTime();
 var printWindow = window.open(windowUrl, windowName, 'left=0,top=0,width=0,height=0');
       printWindow.document.write(printContent.innerHTML);
         printWindow.document.close();
         printWindow.focus();
         printWindow.print();
         document.getElementById(var2).style.display='block';
         printWindow.close();
   }
   
   function printCustomerInvoice(var1,var2)
   {
       var printContent = document.getElementById(var1);
       //var windowUrl = 'about:blank';
       var windowUrl ="Invoice.aspx?OID="+var2;
 var uniqueName = new Date();
 var windowName = 'Print' + uniqueName.getTime();
 var printWindow = window.open(windowUrl, windowName, 'left=0,top=0,width=0,height=0');
       //printWindow.document.write(printContent.innerHTML);
       printWindow.document.write();
         printWindow.document.close(windowUrl);
         printWindow.focus();
         printWindow.print();
         printWindow.close();
   }
   
  //----------------------------</popup print lightbox Page>---------------------------------------------------
  
  //------------------------------<create Lightbox popup>-------------------------------------------------
  
  function CreateLightBoxWindow()
  {
   window.open('popups/CreateNewLightBox.aspx', 'CreateLB', 'width=450,height=320,top=150,left=150,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0');  
  }
  
  function CreateNewLightBoxWindow(frm,page,lbid)
  {
   window.open('popups/CreateNewLightBox.aspx?frm='+frm+'&p='+page+'&lbid='+lbid+'', 'CreateLB', 'width=450,height=320,top=150,left=150,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0');  
  }
  
  //------------------------------<rename Lightbox popup>-------------------------------------------------
  
  function RenameLightBoxWindow(var1)
  {
   window.open('popups/RenameLightbox.aspx?lbid='+var1+'', 'CreateLB', 'width=450,height=220,top=150,left=150,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0');  
  }
   function RenameLightBoxWindowNew(var1,var2)
  {
   window.open('popups/RenameLightbox.aspx?lbid='+var1+'&p='+var2+'', 'CreateLB', 'width=450,height=220,top=150,left=150,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0');  
  }
  
  
  
  function openInvoiceWindow(arg)
    {
      window.open('invoice.aspx?OID='+arg+'', 'Orders', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=650,height=650,left=100, top=100');
    
    }

 function openPrintInvoiceWindow(arg)
    {
      window.open('InvoicePrint.aspx?OID='+arg+'', 'Orders', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=650,height=650,left=100, top=100');
    
    }
    
    
    //-------------------------------<Create order>----------------------------------

 function ShowChequeDetails()
    {
      //  alert(document.getElementById("ddlPaymentMode").value)
        if(document.getElementById("ddlPaymentMode").value=="2")
        {
            
           // $("#tr_chequedetails").show();
            document.getElementById("tr_chequedetails").style.display='block';
        }
        else
        {
       
           // $("#tr_chequedetails").hide();
             document.getElementById("tr_chequedetails").style.display='none';
        }        
        
    }
    
  function validatecheckout()
  {
  
                if(Trim(document.getElementById('txtClient').value)=="")
						{
						  alert('Please enter client name');
						  document.getElementById('txtClient').focus();
						  return false;
						}
    
               if(document.getElementById('ddlPaymentMode').value==0)
						{
						  alert('Please select payment mode');
						  document.getElementById('ddlPaymentMode').focus();
						  return false;
						}
            
                    if(document.getElementById("ddlPaymentMode").value=="2")
                          {
                            if( Trim(document.getElementById("txtChequeNumber").value)=="")
                               {
                                    alert('Please enter cheque number');
                                    document.getElementById("txtChequeNumber").focus();
                                    return false;
                               }     
                          if( Trim(document.getElementById("txtChequeDate").value)=="")
                               {
                                    alert('Please enter cheque date');
                                    document.getElementById("txtChequeDate").focus();
                                    return false;
                               }   
                               
                               if( Trim(document.getElementById("txtBankName").value)=="")
                               {
                                    alert('Please enter bank name');
                                    document.getElementById("txtBankName").focus();
                                    return false;
                               }   
                          
                          }
    
    
    
  }



  //-------------------------------</Create order>----------------------------------

  //----------<registration>-------------------------------------------------------------

  function WhereDidYouOther() {
 
  	if (document.getElementById("ddlWhereHear").value == "Others") {


  		//document.getElementById("tr_where0").style.display = 'block';
  		//document.getElementById("tr_where1").style.display = 'block';
  		document.getElementById("divWhere").style.display = 'block';
  		document.getElementById("txtWhereOther").focus();
  	}
  	else {
  		document.getElementById("divWhere").style.display = 'none';
  		//document.getElementById("tr_where0").style.display = 'none';
  		//document.getElementById("tr_where1").style.display = 'none';
  	}

  }


function BusinessTypeOther() 
{
 
  	    if (document.getElementById("ddlBusinessType").value == "Others")
  	     {
  		    document.getElementById("divBusinessTypeOther").style.display = 'block';
  		    document.getElementById("txtBusinessTypeOther").focus();
  	     }
  	    else 
  	    {
  		    document.getElementById("divBusinessTypeOther").style.display = 'none';
      		
  	    }
}
  
 function DesignationOther() 
    {
     
  	        if (document.getElementById("ddlDesignation").value == "Others")
  	         {
  		        document.getElementById("divDesignationOther").style.display = 'block';
  		        document.getElementById("txtDesignationOther").focus();
  	         }
  	        else 
  	        {
  		        document.getElementById("divDesignationOther").style.display = 'none';
          		
  	        }
    } 
  
  
  
  //----------</registration>-------------------------------------------------------------  