var jspr, navManager, resizeManager;

$(function() {
    //initialize the debugger
    Debug.init();

    //create a new JSPR site
    jspr = new JsprSite();
	
	//check if this is a mobile platform
	var mobileParam = Utils.getQueryParam('mobile');
	if((Environment.clientType() === Environment.MOBILE && mobileParam !== 'false') || mobileParam === 'true'){
		//if so, load the mobile files
		loadScript(typeof MobileHome === 'function' ? 'js/edge/InitMobileSite.js' : 'js/min/edge-mobile.min.js');
	} else {
		//otherwise, load the full version of the site
		loadScript(typeof HomePage === 'function' ? 'js/edge/InitFullSite.js' : 'js/min/edge.min.js');
	}
	
	function loadScript(src){
		var script = document.createElement('script');
		script.type = 'text/javascript';
		script.src = src;
		$('body').prepend(script);
	}
});

//add indexOf to the Array object if this browser doesn't support it
if (!Array.prototype.indexOf){
	Array.prototype.indexOf = function(elt /*, from*/){
		var len = this.length;
		var from = Number(arguments[1]) || 0;
		from = (from < 0) ? Math.ceil(from) : Math.floor(from);
		if (from < 0) from += len;
		for (; from < len; from++) {
			if (from in this && this[from] === elt) return from;
		}
		return -1;
	};
}

