// browser sniffing, courtesy of DHTML Guru [www.htmlguru.com/dhtml]
function browserCheck() {
    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.minor < 4.04));
    this.ns4 = (this.ns && (this.major >= 4));
    this.ie   = (agent.indexOf("msie") != -1);
    this.ie3  = (this.ie && (this.major == 2));
    this.ie4  = (this.ie && (this.major >= 4));
    this.op3 = (agent.indexOf("opera") != -1);
    this.win   = (agent.indexOf("win")!=-1);
    this.mac   = (agent.indexOf("mac")!=-1);
    this.unix  = (agent.indexOf("x11")!=-1);
}

var browser = new browserCheck();

// DOM Equalization statements //

var docObj = (browser.ns4) ? "document" : "document.all";
var styleRef = (browser.ns4) ? "" : ".style";
var nestRef = (browser.ns4) ? ".document" : "";
var VISIBLE = (browser.ns4) ? "show" : "visible";
var HIDDEN = (browser.ns4) ? "hide" : "hidden";
var clipWidthSwitch = (browser.ns4) ? ".clip.right" : ".posWidth";
var clipHeightSwitch = (browser.ns4) ? ".clip.bottom" : ".posHeight";
var widthSwitch = (browser.ns4) ? ".clip.width" : ".pixelWidth";
var heightSwitch = (browser.ns4) ? ".clip.bottom" : ".pixelHeight";

var viewportWidth, viewportHeight = 0;

// end equalization statements

function onerror() {
    document.location.href = "javascript:";
}


//pre-load images
function loadImgs(){
	splashImg = new Image();
	splashImg.onload = loadCheck;
	splashImg.src = "images/impulse.jpg";
}
// end pre-load

var count = 0;
function loadCheck(){
 	count++
	if (count==1){
		getDisplay();
		setLayers();
	}	
}

function displayStatus(){

}

function getDisplay(){
	viewportWidth = (browser.ns4) ? innerWidth : document.body.clientWidth;
	viewportHeight = (browser.ns4) ? innerHeight : document.body.clientHeight;
}

var centerObjOnX = 0;
var centerX = 0;
var centerObjOnY = 0;
var centerY = 0;
function getCenter(obj){
	centerX = viewportWidth/2;
	centerY = viewportHeight/2;
	objWidth = eval(obj+widthSwitch);
	objHeight = eval(obj+heightSwitch);
	centerObjOnX = parseInt(centerX - (objWidth / 2));
	centerObjOnY = parseInt(centerY - (objHeight /2));
	if(centerObjOnX<=0){ centerObjOnX = 0}
	if(centerObjOnY<=0){ centerObjOnY = 0}	
}

function setLayers(){	
	splash = eval(docObj+'["splashDiv"]'+styleRef);
	getCenter('splash')
	splash.top = centerObjOnY;
	splash.left = centerObjOnX;
	splash.visibility = VISIBLE;


}
