/*
Parses function calls and holds them until [window.onload] is invoked - when the HTML/Images are fully loaded.
- Prevents Javascript functions from stopping the page from loading when called before it is completed ( IE Only)
- To be included fore-most in the HTML header.
*/

window.onload = init;
var isPageLoaded = false;
var aFstr = new Array();

function init () {
	isPageLoaded = true;
	var i;
	for ( i = 0; i < aFstr.length; i++ ) {
		//trace("<br />Call: "+aFstr[i]);
		eval(aFstr[i]);
	}
}

function checkInit (fstr) {
	var j;
	fstr = fstr+"(";
	for ( j = 1; j < arguments.length; j++ ) {
		switch ( typeof(arguments[j]) ) {
			case "string":
			fstr += "'"+arguments[j]+"'";
			break;
			
			case "number":
			case "boolean":
			fstr += arguments[j];
			break;
			
			default:
			//trace("<br />No Type Found for argument: "+j);
		}
		if ( (j+1) < arguments.length ) {
			fstr += ", ";	
		}
	}
	fstr += ")";
	
	if ( isPageLoaded == true ) {
		//trace("<br />Eval: "+fstr);
		eval(fstr);
	} else {
		//trace("<br />Saved: "+fstr);
		aFstr.push(fstr);
	}
}

function trace ( str ) {
	document.getElementsByTagName("head")[0].innerHTML += "<br />"+str;
}