﻿// Global Functions
//<![CDATA[
    function ShowHeader() {
        new Effect.BlindDown("MainHeader_Blind",{duration:0.5});
        setTimeout(function() {;
            new Effect.Appear('MainHeader_FadeIn',{duration:0.25});    
            setTimeout(function() {;
                new Effect.Appear('MainContent',{duration:0.15});    
                setTimeout(function() {;
                    ShowFooter();
                }, 300);
            }, 300);
        }, 600);
    }
    function ShowFooter() {
        new Effect.Appear('MainFooter',{duration:0.25});    
    }
    function ShowTestIntro() {
        setTimeout(function() {;
            new Effect.Appear('MainContent',{duration:0.15});    
        }, 600);
    }
    //]]>


//    THIS WAS RETIRED SINCE IT WAS HYPOTHESIZED THAT SAFARI
//    WAS RETURNING window.clientInformation != null
//    function GetHttpRequestObject(){
//        if(window.clientInformation != null){
//            return new ActiveXObject("Msxml2.XMLHTTP");
//        }else{
//            return new XMLHttpRequest();
//        }
//    }

    function GetHttpRequestObject(){
        var browserVersion = GetBrowserVersion();
        if((browserVersion == 'ie7') || (browserVersion == 'ie')){
            return new ActiveXObject("Msxml2.XMLHTTP");
        } else {
            return new XMLHttpRequest();
        }
    }
    
            
    function processError(xmlhttp) {
        alert("There was an error with the status code \r\n" + xmlhttp.responseText);
    }

    
    function GetBrowserVersion() {
        var ua = navigator.userAgent.toLowerCase();
        if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
            return 'opera';
        } else if (ua.indexOf('msie 7')!=-1) { // IE7
            return 'ie7';
        } else if (ua.indexOf('msie') !=-1) { // IE
            return 'ie';
        } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
            return 'safari';
        } else if (ua.indexOf('gecko') != -1) { // Gecko
            return 'gecko';
        } else {
            return false;
        }
    }
    
    function getQueryStringParam(name){
        var regexS = "[\\?&]"+name+"=([^&#]*)";
        var regex = new RegExp( regexS );
        var tmpURL = window.location.href;
        var results = regex.exec( tmpURL );
        if( results == null )
            return "";
        else
            return results[1];
    }
    
    function CheckForEnter(e, textField){
		//the purpose of this function is to allow the enter key to 
		//point to the correct button to click.
		var objBox = document.getElementById(textField);
		var key;

		if(window.event) {
			key = window.event.keyCode;     //IE
		} else {
			key = e.which;     //firefox
		}    
		if (key == 13) {
			CheckRegKey();
			//event.keyCode = 0;
		}
	}
	
	function placeIt_Std(){
        //DISPLAYS THE ERROR DIV CENTERED ON THE PAGE
        obj = document.getElementById("errorDiv");
        obj.style.top = "350px";
	    window.scroll(0,0);
	}
	
	function placeIt_Higher(){
        //DISPLAYS THE ERROR DIV CENTERED ON THE PAGE
        obj = document.getElementById("errorDiv");
        obj.style.top = "100px";
	    window.scroll(0,0);
	}