﻿// JScript File
function echeck()
{
        var str=document.getElementById('ctl00$content1$CreateTicket1$txtsemailid').value;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}
	
	function ValidateNo()
   {
        var o = document.getElementById('ctl00$content1$CreateProfile1$txtPhNum');
      
        switch (isInteger(o.value))
            {
             case true:
                return true
                break;
             case false:
                alert("Please Enter a Valid PhoneNumber")
                return false
            }
        
      function isInteger(val)
        {
        if(isBlank(val))
            {
            return false;
            }
                for(var i=0;i<val.length;i++)
                {
                if(!isDigit(val.charAt(i)))
                {
                return false;
                }
            }return true;
        }
        function isBlank(val){if(val==null){return true;}for(var i=0;i<val.length;i++){if((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}}return true;}
        function isDigit(num){if(num.length>1){return false;}var string="1234567890";if(string.indexOf(num)!=-1){return true;}return false;}        
        
}
 
        


function validatephinenumber()
{
var NumStr=document.getElementById('ctl00$content1$CreateProfile1$txtPhNum').value;
    var String='1112223333'
    for(var Idx=0; Idx<NumStr.length; Idx++) 
    { 
        var Char = NumStr.charAt(Idx); 
        var Match = false; 
        for(var Idx1=0; Idx1<String.length; Idx1++) 
        { 
            if(Char == String.charAt (Idx1)) 
                Match = true; 
        } 
        if (!Match)
        alert("Please Enter Phone Number in 111-222-4444 format") 
            return false; 
    } 
    return true; 
    }


function NumberValidation2(ph,zipNo)
{
      
       var o = document.getElementById(ph);
  
        if (o.value.length>0)
        {
              if (isInteger(o.value)!=true)
                {
                     alert("Please Enter a Valid PhoneNumber")
                     document.getElementById(ph).focus()	   
                     return false
                }
         }
            
     
     
        var zipcode = document.getElementById(zipNo);
        if (zipcode.value.length>0)
            {
          
                if (isInteger(zipcode.value)!=true)
                    {
                         alert("Please Enter a Valid zipcode")
                         document.getElementById(zipNo).focus()
                          return false
                    }                      
            }   
       
       
     
       function isInteger(val)
        {
              if(isBlank(val))
                {
                  return false;
                }
      
              for(var i=0;i<val.length;i++)
                {
                     if(!isDigit(val.charAt(i)))
                        {
                              return false;
                        }
                }return true;
        }
        function isBlank(val){if(val==null){return true;}for(var i=0;i<val.length;i++){if((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}}return true;}
        function isDigit(num){if(num.length>1){return false;}var string="1234567890";if(string.indexOf(num)!=-1){return true;}return false;}           
        


}

function NumberValidation(ph,faxNo,zipNo)
{
      
       var o = document.getElementById(ph);
  
        if (o.value.length>0)
        {
              if (isInteger(o.value)!=true)
                {
                     alert("Please Enter a Valid PhoneNumber")
                     document.getElementById(ph).focus()	   
                     return false
                }
         }
            
    
   
    var fax = document.getElementById(faxNo);
        if (fax.value.length>0)
            {
          
                if (isInteger(fax.value)!=true)
                    {
                         alert("Please Enter a Valid Fax No.")
                         document.getElementById(faxNo).focus()
                          return false
                    }                      
            }   
     
        var zipcode = document.getElementById(zipNo);
        if (zipcode.value.length>0)
            {
          
                if (isInteger(zipcode.value)!=true)
                    {
                         alert("Please Enter a Valid zipcode")
                         document.getElementById(zipNo).focus()
                          return false
                    }                      
            }   
       
       
     
       function isInteger(val)
        {
              if(isBlank(val))
                {
                  return false;
                }
      
              for(var i=0;i<val.length;i++)
                {
                     if(!isDigit(val.charAt(i)))
                        {
                              return false;
                        }
                }return true;
        }
        function isBlank(val){if(val==null){return true;}for(var i=0;i<val.length;i++){if((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}}return true;}
        function isDigit(num){if(num.length>1){return false;}var string="1234567890";if(string.indexOf(num)!=-1){return true;}return false;}           
        


}


function ValidateAccount(contnum,zp,cn,cvn)
{
        var o = document.getElementById(contnum);
        if (o.value.length>0)
        {
              if (isInteger(o.value)!=true)
                {
                     alert("Please Enter a Valid Contact Number")
                     document.getElementById(contnum).focus()	   
                     return false
                }
         }

        var o = document.getElementById(zp);
  
        if (o.value.length>0)
        {
              if (isInteger(o.value)!=true)
                {
                     alert("Please Enter a Valid zipcode")
                     document.getElementById(zp).focus()	   
                     return false
                }
         }
            
    
   
    var fax = document.getElementById(cn);
        if (fax.value.length>0)
            {
          
                if (isInteger(fax.value)!=true)
                    {
                         alert("Please Enter a Valid Card Number")
                         document.getElementById(cn).focus()
                          return false
                    }                      
            }   
     
        var zipcode = document.getElementById(cvn);
        if (zipcode.value.length>0)
            {
          
                if (isInteger(zipcode.value)!=true)
                    {
                         alert("Please Enter a Valid Card Verfication Number")
                         document.getElementById(cvn).focus()
                          return false
                    }                      
            }   
       
       
     
       function isInteger(val)
        {
              if(isBlank(val))
                {
                  return false;
                }
      
              for(var i=0;i<val.length;i++)
                {
                     if(!isDigit(val.charAt(i)))
                        {
                              return false;
                        }
                }return true;
        }
        function isBlank(val){if(val==null){return true;}for(var i=0;i<val.length;i++){if((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}}return true;}
        function isDigit(num){if(num.length>1){return false;}var string="1234567890";if(string.indexOf(num)!=-1){return true;}return false;}           
}


//update google tickets


function NumberValGoogleAnalyticsDetails(VisitorsNo,PagesPvisits,Pageview)
{

         var o = document.getElementById(VisitorsNo);
        if (o.value.length>0)
        {
              if (isInteger(o.value)!=true)
                {
                     alert("Please Enter a Valid Visitors Number")
                     document.getElementById(VisitorsNo).focus()	   
                     return false
                }
         }

        var o = document.getElementById(PagesPvisits);
  
        if (o.value.length>0)
        {
              if (isInteger(o.value)!=true)
                {
                     alert("Please Enter a Valid Pages/Visit Number ")
                     document.getElementById(PagesPvisits).focus()	   
                     return false
                }
         }
            
    
   
    var o = document.getElementById(Pageview);
        if (o.value.length>0)
            {
          
                if (isInteger(o.value)!=true)
                    {
                         alert("Please Enter a Valid Pageview Number")
                         document.getElementById(Pageview).focus()
                          return false
                    }                      
            }   
     function isInteger(val)
        {
              if(isBlank(val))
                {
                  return false;
                }
      
              for(var i=0;i<val.length;i++)
                {
                     if(!isDigit(val.charAt(i)))
                        {
                              return false;
                        }
                }return true;
        }
        function isBlank(val){if(val==null){return true;}for(var i=0;i<val.length;i++){if((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}}return true;}
        function isDigit(num){if(num.length>1){return false;}var string="1234567890";if(string.indexOf(num)!=-1){return true;}return false;}           

}





//Validate Billing Info

function ValidateBillingAmount(amt)
{

         var o = document.getElementById(amt);
           if (o.value==0)
         {
                     alert("Please Enter a Billing Amount")
                     document.getElementById(amt).focus()	   
                     return false
         }
        if (o.value.length>0)
        {
              if (isInteger(o.value)!=true)
                {
                     alert("Please Enter a Valid Amount")
                     document.getElementById(amt).focus()	   
                     return false
                }
         }
               
     function isInteger(val)
        {
              if(isBlank(val))
                {
                  return false;
                }
      
              for(var i=0;i<val.length;i++)
                {
                     if(!isDigit(val.charAt(i)))
                        {
                              return false;
                        }
                }return true;
        }
        function isBlank(val){if(val==null){return true;}for(var i=0;i<val.length;i++){if((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}}return true;}
        function isDigit(num){if(num.length>1){return false;}var string="1234567890";if(string.indexOf(num)!=-1){return true;}return false;}           

}


function Hide()
{
document.getElementById("sharedImgs").style.display='none';
}

function  LoginValidation(login,pass)
{

    var o = document.getElementById(login);
           if (o.value==0)
         {
                     alert("Please Enter UserName");
                     document.getElementById(login).focus()	   
                     return false
         }
     var o = document.getElementById(pass);
           if (o.value==0)
         {
                     alert("Please Enter Password");
                     document.getElementById(pass).focus()	   
                     return false
         }
}

 function popupvideo(path,video)
{
var o = document.getElementById(video);
 if (o.value.length==0)
         {
                     alert("Video not exist for this story");
                     return false
         }

 var o = document.getElementById(path);

newwindow5=window.open(o.value,"newwin5","scrollbars=yes,toolbar=no,location=no,directories=no,menubar=no,resizable=no,status=no,width=355,height=300");
newwindow5.window.focus();
}
 
function test()
{
var str=document.getElementById("ctl00$content1$FindSurgeon1$drpstate").value;
    if(str=="Select the state")
    {
    
    }
}
function Zipcodeandpriority(zip,priority)
{
    var o = document.getElementById(zip);
    
        if (o.value.length>0)
        {
              if (isInteger(o.value)!=true)
                {
                     alert("Please Enter a Valid Zip Code")
                     document.getElementById(zip).focus()	   
                     return false
                }
         }
        
        
         var o = document.getElementById(priority);
           if(o.value<=0)
           {
             alert("Please enter the Priority greater than zero")
                     document.getElementById(priority).focus()	   
                     return false
           }   
        if (o.value.length>0)
        {
              if (isInteger(o.value)!=true)
                {
                     alert("Please Enter a Valid Priority")
                     document.getElementById(priority).focus()	   
                     return false
                }
         }
}