
/**
 *
 * Include a javascript file at runtime
 *
 **/
function include_js(js_file_name){

	if($("script[src='"+GBL_BASE_URL+js_file_name+"']").size() == 0) {

        $('head').append(
            "<script type='text/javascript' src='"+GBL_BASE_URL+js_file_name+"'></script>"
        );
    }		 
}
		

function is_browser_ie6(){
	//Can't just run one test, as they will not necessarily return accurate version number
	//Start with the navigator useragent 
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ 
		var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
		if (ieversion<7){
			//Double check it
			if($.browser.msie&&($.browser.version == "6.0")){		
				return true;					
			}
		}
	}		 
	return false;
}
		

/**
 * Create a console function so that firebug console logging will not fail when a non console browser is used
 **/
if (! ("console" in window) || !("firebug" in console)) {
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group"
                 , "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
    window.console = {};
    for (var i = 0; i <names.length; ++i) window.console[names[i]] = function() {};
}

		
$(function(){

	if(is_browser_ie6()){		
		//run the png fixes
		if(typeof jQuery.supersleight != 'function'){
		$.getScript('http://taoschamber.org/javascript/library/jquery/plugins/jquery.supersleightPngFix.js', function(){
				run_supersleight();	
		});
		} else {
			run_supersleight();
		}
	}
});

function run_supersleight(){
	var config = {shim:'images/pixel.gif'};
	 $('.seasonLeft').supersleight(config);
	 $('.seasonRight').supersleight(config);
	 $('#buttonBar').supersleight(config);
	 $('#w').supersleight(config);
	 $('#e').supersleight(config);
	 $('#s').supersleight(config);
	 $('#se').supersleight(config);
	 $('#sw').supersleight(config);
	 //$('div.horMenu').supersleight(config);
	 $('h5 img').supersleight(config);
}
