﻿// JScript File
//(event.keyCode != 48)&&(event.keyCode != 49)&&(event.keyCode != 50)&&(event.keyCode != 51)&&(event.keyCode != 52)&&(event.keyCode != 52)&&(event.keyCode != 53)&&(event.keyCode != 54)&&(event.keyCode != 55)&&(event.keyCode != 56)&&(event.keyCode != 57)
//txtdayph
function eNumeric(thi)
{

   if (((event.keyCode < 48) || (event.keyCode > 57)) && (event.keyCode != 46))
   //alert('aaaaa');
      event.returnValue = false;
   if(event.keyCode == 46 && instr(thi.value,",")>=0)
   //alert('aaaaa');
      event.returnValue = false;
      }

function createrma(t)
{
    v=false;         
    if (t.chk1.checked==false)
    {
    alert('Please tick to accept Terms & Conditions!');
    }    
    else
    {
    v=true;
    }      
    return v;    
}

function Tex(item)
    {
        obj=document.getElementById("tab"+item);
        key=document.getElementById(item);
        visible=(obj.style.display!="none");
        //alert(obj.Id);
        if(visible)
        {
            obj.style.display="none";
            key.innerHTML="[+]";
        }
        else
        {
            obj.style.display="block";
            key.innerHTML="[-]";
        }
   }
   
    function ser(t)
    {
		
        var obj=document.getElementById(t);
        if (!(obj.value == "search"))
        {
        if (obj.value=="")
        {
        alert('Please Enter Text,Which You Want To Search !');
        }
        else
        {
            window.location="search.aspx?ser="+obj.value;
                        
        }
        }
    }
    
    function clearTex(t)
    {
    var ob=document.getElementById(t)
        if (ob.value=="search")
        {        
          ob.value = "";
        }                  
    }
    
    
    function validtxt(t)
    {
    
    v=false;
     if (t.txtfname.value=="")
        {
        alert("Enter First Name!");
        t.txtfname.focus();
        } 
    else 
        if (t.txtlname.value=="")
        {
        alert("Enter Last Name!");
        t.txtlname.focus();
        }   
    else 
        if (t.txtaddress.value=="")
        {
        alert("Enter Address!");
        t.txtaddress.focus();
        }
    else 
        if (t.txtcity.value=="")
        {
        alert("Enter City Name!");
        t.txtcity.focus();
        }
    else 
        if (t.ddlstate.value=="")
        {
        alert("Enter State Name!");
        t.ddlstate.focus();
        }
    else 
        if (t.txtzipcode.value=="")
        {
        alert("Enter Pin Code!");
        t.txtzipcode.focus();
        }    
    else 
        if (t.txtdayph.value=="")
        {
        alert("Enter Phone Number!");
        t.txtdayph.focus();
        }
    else 
        if (t.txtemail.value=="")
        {
        alert("Enter E-Mail Id!");
        t.txtemail.focus();
        }        
    else 
        if (t.chk.checked==true)
        {
            if (t.txtpass.value=="" || t.txtpass.value==null)
            {
            alert('Enter Password !');
            t.txtpass.focus();
            }        
            else
            {
            v=true;
            }
        }    
    else
        {
        v=true;
        v=validate_billing();
        }
    return v;
    }         
    
 function validate_billing()
{
    if((document.getElementById('txtemail').value !="")&&(document.getElementById('txtpass').value !=""))
    {
        if(document.getElementById('chk').checked==false)
        {
        //check box not checked
        alert("Please tick checkbox 'Yes! Save my billing and shipping details for future use as a Registered Customer! ' to register");
        return false;
        }
    }
    return true;
}

    function shiptxt(t)
    {    
     v=false;    
     if (t.chkshipadd.checked==false)
     {     
    if (t.txtfname.value=="")
    {
    alert("Enter First Name!");
    t.txtfname.focus();
    } 
    else if (t.txtlname.value=="")
    {
    alert("Enter Last Name!");
    t.txtlname.focus();
    }   
    else if (t.txtaddress.value=="")
    {
    alert("Enter Address!");
    t.txtaddress.focus();
    }
    else if (t.txtcity.value=="")
    {
    alert("Enter City Name!");
    t.txtcity.focus();
    }
    else if (t.ddlstate.value=="")
    {
    alert("Enter State Name!");
    t.ddlstate.focus();
    }
    else if (t.txtzipcode.value=="")
    {
    alert("Enter Pin Code!");
    t.txtzipcode.focus();            
    }
    else if (t.txtdayph.value=="")
    {
    alert("Enter Phone Number!");
    t.txtdayph.focus();
    }
   else if (!(t.txtemail.value=="" || t.txtemail.value==null))
    {    
            apos=t.txtemail.value.indexOf("@"); 
            dotpos=t.txtemail.value.lastIndexOf(".");
            lastpos=t.txtemail.value.length-1;            
            if (apos<1 || dotpos<3 || lastpos<5 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
            {
            {   alert('Incorrect Email Id !');  }
            
            
            }
            else
            {                
                v=true;
            }    
         
    }            
      return v;
    }  
    }
    
      
   function validNewUser(t)
   {
   v=false;
   if (t.txtfname.value=="" || t.txtlname.value=="" || t.txtdayphcountry.value=="" ||t.txtdaypharea.value=="" ||t.txtdayphno.value=="" ||t.txtevephcountry.value=="" ||t.txtevephno.value=="" || t.txtaddress.value=="" || t.txtcity.value=="" || t.txtemail.value=="" || t.txtpassword.value=="" || t.txtvpass.value=="")
        {
            alert("YOUR REGISTRATION IS NOT COMPLETE UNTIL YOU CLICK THE 'REGISTER' BUTTON BELOW AND HIGHLIGHTED IN YELLOW ARE REQUIRED FIELDS !");
        }
        else if(!(t.txtpassword.value==t.txtvpass.value))
        {    
            alert('Password And Verify Password Should Be Same !');
        }
      else if (!(t.txtemail.value=="" || t.txtemail.value==null))
            {
            apos=t.txtemail.value.indexOf("@"); 
            dotpos=t.txtemail.value.lastIndexOf(".");
            lastpos=t.txtemail.value.length-1;
                if (apos<1 || dotpos<3 || lastpos<5 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
                {   
                    alert('Incorrect Email Id !');  
                }
                else
                {                
                    v=true;
                }
            }
            return v;
   }
    
    
    //***************** seal master
    
    function seal(t)
    {
    v=false;
    if (t.txtname.value=="")
    {
    alert('Enter Seal Name');
    t.txtname.focus();
    }
    else
    {
    v=true;
    }
    return v;
    }
    
    function pay(t)
    {
    v=false;    
    
    if (t.r1.checked==false && t.r2.checked==false && t.r3.checked==false && t.r4.checked==false && t.r5.checked==false)
    { 
    alert('Please select payment method!');
    }      
    else if (t.chk1.checked==false)
    {
    alert('Please tick to accept Terms & Conditions !');
    }    
    else
    {
    v=true;
    }      
    return v;
    }
    
    
    function cart(t)
    {
    v=false;
    if (t.HiddenField1.value == 0 )
    {
   alert('Cart is empty. Unable to proceed. Add items to cart before clicking the Proceed to Check-out button');
   window.location="default.aspx";
    }
    else
    {
    v=true;
    }
    return v;
    }
    
    
 function newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/74;
  var wint = (screen.height-h)/52;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';  
  settings += 'scrollBars=' + true + ',';  
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}


function mail(t)
{
v=false;

if(t.txtname.value=="")
 {
 alert('Please Enter Name. !');
 t.txtname.focus();
  }  
  else if(t.txtphone.value=="")
  {
  alert('Please Enter Phone No. !');
   t.txtphone.focus();
  }
  else 
  {
  if (!(t.txtmailid.value=="" || t.txtmailid.value==null))
    {    
            apos=t.txtmailid.value.indexOf("@"); 
            dotpos=t.txtmailid.value.lastIndexOf(".");
            lastpos=t.txtmailid.value.length-1;            
            if (apos<1 || dotpos<3 || lastpos<5 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
            {
            alert('Incorrect Email Id !');  
            t.txtmailid.focus(); 
            }
            else
            {                
                v=true;
            } 
  }
  else
  {
  alert('Please Enter Mail Idjhu!')
  t.txtmailid.focus();
  }
  }  
  return v;
  }
  
             