/*

	Pacific Power Global Javascript
	ISITE Design

*/

// prototype with jquery. $ = prototype, $j = jquery.
// can still use $ for jQuery within the jQuery document ready function
var $j = jQuery.noConflict();

// prevent ie6 flicker
try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}

// sIFR 3
if(typeof sIFR != "undefined") {
	var gillsans = { src: './_resources/flash/GillSans_sIFR3.swf' };
	sIFR.activate(gillsans);
	
	sIFR.replace(gillsans, {
		selector: 'h1',
		css: '.sIFR-root { background-color: transparent; color: #000000; }',
		wmode: 'transparent',
		repaintOnResize: true
	});
}

// Dom loaded / jQuery
jQuery(function($) {

	// set up for JS enhanced
	$("html").addClass("js");

	// ie6 special cases
	if($.browser.msie && parseInt($.browser.version) < 7){
	
		// fix elements over selects z-index issue
		// load script without ajax to avoid ActiveX requirement
		function loadScript(src, callback) {
			var script = document.createElement("script");		
			if(script.attachEvent) {
				script.attachEvent("onreadystatechange",
				function() { loadScript.callbackIE(callback); });
			}
			script.src = src;
			document.getElementsByTagName("head")[0].appendChild(script);
		}
		loadScript.callbackIE = function(callback) {
			var target = window.event.srcElement;
			if(target.readyState == "loaded")
			callback.call(target);
		};		
		callback = function() { $("#nav ul, .custom-select-list-wrapper").bgiframe(); };
		
		loadScript("_resources/js/jquery.bgiframe.min.js", callback);
	
	}// if ie6
	
	// infographic action
	$("div.infographic li").hover(
		function() { $("div.description",this).slideDown(120); },
		function() { $("div.description",this).slideUp(120); }
	);
	
});// document ready
