function Validate(str)
{
	var reg= new RegExp("^[01]?[- .]?(\\([2-9]\\d{2}\\)|[2-9]\\d{2})[- .]?\\d{3}[- .]?\\d{4}$");
	
	return str.match(reg);
}

$(document).ready(function() {

	$("[id$='_txtClickToCallPhone']").val("Enter Your Phone");
    // Define what happens when the textbox comes under focus
    // Remove the watermark class and clear the box
    $("[id$='_txtClickToCallPhone']").focus(function() {

        $(this).filter(function() {

            // We only want this to apply if there's not
            // something actually entered
            return $(this).val() == "" || $(this).val() == "Enter Your Phone"

        }).removeClass("watermarkOn").val("");

    });

    // Define what happens when the textbox loses focus
    // Add the watermark class and default text
    $("[id$='_txtClickToCallPhone']").blur(function() {

        $(this).filter(function() { 

            // We only want this to apply if there's not
            // something actually entered
            return $(this).val() == ""

        }).addClass("watermarkOn").val("Enter Your Phone");

    });
    
    $("[id$='_btnCall']").click(function(){
        
		if(!Validate($("[id$='_txtClickToCallPhone']").val())){
		$("[id$='_txtClickToCallPhone']").addClass('invalidField');
		
		} 
    });
    
    $("[id$='_btnCall']").click(function(){
     
     if(Validate($("[id$='_txtClickToCallPhone']").val()))
     {
		return true;
     }
     else
     {
		return false;
     }
     });
    //Check the Enter Key
    
    $("[id$='_txtClickToCallPhone']").keydown(function(e){
   
    if(e.keyCode==13){
			window.event.returnValue=false;
			window.event.cancel=true;
		}

    }); 
});
