﻿//hide errors

function catchError(msg, url, linenumber){
//ignore the error generated by AJAX
    return true;
/*
if (msg.match("this.get_element().style"))
    return true;
else
    alert('A javascript error has occurred:\n\n'+msg);
*/
}

window.onerror = catchError;


function IsNumber(e)
{ 
    var charCode = (e.which) ? e.which : event.keyCode
    if ((charCode < 48 || charCode > 57) && charCode != 17 && charCode != 67 && charCode != 86 && charCode != 99 && charCode != 118 && charCode != 88 && charCode != 120 && charCode != 8)
        return false;

    return true;
}

function LeaveCheckoutConfirm(){
    return confirm('Players that are entered for registration (if any) will be lost by proceeding. Continue?');
}

function DisallowPaste(e) {
    var forbiddenKeys = new Array('v');
    var keyCode = (e.keyCode) ? e.keyCode : e.which;
    var isCtrl;

    if(window.event)
        isCtrl = e.ctrlKey
    else
        isCtrl = (window.Event) ? ((e.modifiers & Event.CTRL_MASK) == Event.CTRL_MASK) : false;
    if(isCtrl) {
        for(i = 0; i < forbiddenKeys.length; i++) {
            if(forbiddenKeys[i] == String.fromCharCode(keyCode).toLowerCase()) {
                alert('You are prompted to type this twice for a reason!');
                return false;
            }
        }
    }
    return true;
}

function NMSignupNewWindowAlert(){
    
}
function OpenNMSignupWindow() {
    alert('The Signup Form will pop up in a new browser window.\n\nOnce Signup is completed, you will receive a Team Tennis ID which can be used on this page.');

	var newwin;
	var a = screen.availWidth/1.2||screen.width/1.2;
	var b = screen.availHeight/1.2||screen.height/1.2;
	var c = screen.availHeight/10||screen.height/10;
	var d = screen.availHeight/10||screen.height/10;

    newwin = window.open("","newwindow","toolbar=no,location=no,directories=no,status=no,Menubar=no,scrollbars=yes,resizable=yes,,");
	newwin.moveTo(c,d);
	/*newwin.resizeTo(a,b);*/
	newwin.focus();
}
