﻿var cntryDialCode = 1; // USA
var objectIsClicked =false;

/*
 * Returns the object from which an event was fired
 *
 ******************************************/
function getSourceElement(e) {
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) //-- defeat Safari bug
		targ = targ.parentNode;
		
	return targ;
}

/* onkeypress event for numeric only input fields
 * Insures only numeric (and backspace ect.) 
 * keypresses are alowed
 *****************************************/
function AllowOnlyNumericKeyPress(evt)
{
	evt = (evt) ? evt : event;
	
	var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
		((evt.which) ? evt.which : 0 ));
	
	    if(charCode < 32)
		    {return true;
		}
		
	    if (charCode > 31 && (charCode < 48 || charCode > 57)){
		    return false;
	    }
	
	if(cntryDialCode == 1)
	{
		var txtbox = getSourceElement(evt);
	    if((txtbox.value.length + 1)>10)
		    return false;
	}
	
	return true;
}

function IsPolicyRead(_ValidateUserToReadIndicatorInputID)
{
    var blnRead = document.getElementById(_ValidateUserToReadIndicatorInputID).value
    if(blnRead == '1')
   {
        return true;
   } 
   else
   {
        alert('Please read all of Privacy Policy');
        return false;   
   }
}