//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
//	This script is the intellectual property of:
//	ALPHA51 INC.
//	
//	Copyright © 2000 ALPHA51 INC. All rights reserved.
//
//	Written by: Wayne Helman
//
//'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

var ns = (document.layers)? true:false
var ie = (document.all)? true:false
var dom = (document.getElementById)? true:false
var ns6 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));

var moDir = '/images/';

function getStyle() {

	if (ns) {
		this.divLen = eval(document.buffer).clip.height;
		this.bodyH = window.innerHeight;
		}
	else {
		if (dom) {
			if (navigator.userAgent.indexOf('MSIE',0) == -1) {
				this.divLen = eval("document.getElementById('buffer').offsetHeight");
				this.bodyH = window.innerHeight;
				}
			else {
				this.divLen = eval("document.getElementById('buffer').clientHeight");
				this.bodyH = document.body.offsetHeight;
				}
			}
		else {
			if (ie) {
				this.divLen = eval(document.all.buffer).clientHeight;
				this.bodyH = document.body.offsetHeight;
				
				}
			}
		}
	}

function swap(img1,ref1,sts1) {
	document.images[img1].src = moDir + ref1 + ".gif";
	s(sts1);
	}
	
function s(txt) {
	if(txt != "") status = txt;
	else status = "Ajax Knights Minor Hockey Association";
	}

function popMisc(url,wd,ht) {
	var miscwin = window.open(url,'misc','height='+ht+',width='+wd+',toolbar=0,directories=0,menubar=0,status=0,resizable=1,location=0,scrollbars=1,copyhistory=0');
	}
function popUpPd(url,wd,ht) {
	var topX, leftY;
	topX =  (window.screen.height-ht)/2;
	leftY = (window.screen.width-wd)/2;
	win = window.open(url,'temp','height='+ht+',width='+wd+',toolbar=0,directories=0,menubar=0,status=0,resizable=1,location=0,scrollbars=0,copyhistory=0,screenX='+topX+',screenY='+leftY+',top='+topX+',left='+leftY);
	}

function isblank(s) {
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}

function verify(f) {
    var msg;
    var empty_fields = "";
    var errors = "";

    for(var i = 0; i < f.length; i++) {
        var e = f.elements[i];
        if (((e.type == "text") || (e.type == "textarea")) && !e.optional) {
            // first check if the field is empty
            if ((e.value == null) || (e.value == "") || isblank(e.value)) {
				tempName = e.name;
				str = tempName.replace("_"," ")
				empty_fields += "\n          " + str;
                continue;
            }
			if (e.name == "Email") { 
				if (e.value.indexOf ('@',0) == -1 || e.value.indexOf ('.',0) == -1){      
					errors += "- Please format your email address correctly.";      
				} 
			}
        }
    }


    if (!empty_fields && !errors) return true;

    msg  = "______________________________________________________\n\n"
    msg += "The form was NOT submitted due to the following error(s).\n";
    msg += "Please correct the error(s) and re-submit.\n";
    msg += "______________________________________________________\n\n"

    if (empty_fields) {
        msg += "- The following required field(s) are empty:" 
                + empty_fields + "\n";
        if (errors) msg += "\n";
    }
    msg += errors;
    alert(msg);
    return false;
}


DOM = (document.getElementById) ? true : false;
NS4 = (document.layers) ? true : false;
IE = (document.all) ? true : false;
IE4 = IE && !DOM;
Mac = (navigator.appVersion.indexOf("Mac") != -1);
IE4M = IE4 && Mac;
NS6 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));

function pU(menu,evnt) {
	if(AreLoaded == true) popUpNav(menu,evnt)
	}
function pD(menu) {
	if(AreLoaded == true) popDown(menu)
	}
function preloadImages() {
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function getLocation(url,ext) {
	if(ext=='true') {
		window.open(url,'_newWin');
		}
	else {
		location.href = url;
		}
	}