function openwindow(url,name,options) {
    newwindow = window.open(url,name,options)
}

function openSignupWindow(url) {
    signupExtraWindow = window.open(url,"signupExtraWindow","toolbars=no,address=no,left=10,top=10,status=yes,width=468,height=400,scrollbars=yes,resizable=no")
}

function profile(url) {
    profwin = window.open(url,"profwin","toolbars=no,address=no,left=10,top=10,status=yes,width=468,height=400,scrollbars=yes,resizable=no")
}

function signup() {
    signupwindow = window.open("applicationform.php","signup","toolbars=no,address=no,left=10,top=10,status=yes,width=468,height=400,scrollbars=yes,resizable=no")
}

function displayError(formNode, validators){
 var errorHTML = "";
 for(var i=0;i<validators.length;i++){
  errorHTML += "<li>" + validators[i].message + "</li>";
 }
 document.getElementById("errorDisplay").style.display = "block";
 document.getElementById("errorDisplay").innerHTML = "<ul>" + errorHTML + "</ul>";
}

function privacy(){
    privacyWin = window.open("privacy.php","privacyWin","toolbars=no,address=no,left=10,top=10,status=no,width=468,height=400,scrollbars=yes,resizable=no")
}

function terms(){
    termsWin = window.open("terms.php","termsWin","toolbars=no,address=no,left=10,top=10,status=no,width=468,height=400,scrollbars=yes,resizable=no")
}

function friends(){
    friendsWin = window.open("friends.html","friendsWin","toolbars=no,address=no,left=10,top=10,status=no,width=468,height=400,scrollbars=yes,resizable=no")
}


function rules(){
    rulesWin = window.open("rules.php","rulesWin","toolbars=no,address=no,left=10,top=10,status=no,width=468,height=400,scrollbars=yes,resizable=no")
}

function highscores(){
    hsWin = window.open("leaderboard.php","leaderboard","toolbars=no,address=no,left=10,top=10,status=no,width=400,height=400,scrollbars=yes,resizable=no")
}

function getbrowserwidth() {
    	if (navigator.userAgent.indexOf("MSIE") > 0)	{
        		return(screen.width);
       	} else {
            	return(window.screen.width);
       	}
}

function getbrowserheight() {
	if (navigator.userAgent.indexOf("MSIE") > 0) {
		return(screen.height);
    } else {
		return(window.screen.height);
	}
}

var popup = new Object()

function CenterPopup(URL, popname, width, height, scrollbars) {

		// get center of browser window
        var X = getbrowserwidth()/2;
        var Y = getbrowserheight()/2;

        popup = window.open(URL, popname,
                    		'scrollbars=' + scrollbars + ',' +
                    		'width=' + width + ',' +
                    		'height=' + height + ',' +
                    		'top=' + ((Y - (height/2))) + ',' +
                    		'left=' + ((X - (width/2)))
                    		);

        popup.focus();
}