window.onload = function() {
	// loads images into cache one page load
	loadImages();
	

	

}

//image preloader
function loadImages() {
	// image array
	arImageSrc = new Array (
	
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_stores.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_the_brand.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_register.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_ilori_report.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_events.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_press_room.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_press_release.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_stores_up.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_stores_over.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_the_brand_over.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_the_brand_up.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_register_over.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_register_up.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_ilori_report_over.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_ilori_report_up.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_events_over.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_events_up.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_press_release_over.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/nav/nav_press_release_up.png",
		
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/login/submit_over.png",
		"/wcsstore/CustomB2CStorefrontAssetStoreIL/images/light.png"

		
    )
	// image list array
    arImageList = new Array ();
	// caches the images
    for (counter in arImageSrc) {
        arImageList[counter] = new Image();
        arImageList[counter].src = arImageSrc[counter];
    }
}

//image rollovers
//pass the image tag name and image name
function imgIn(imgName, imgSrc) {
	document[imgName].src=imgSrc;
}
function imgOut(imgName, imgSrc) {
	document[imgName].src=imgSrc;
}


// TOGGLE
function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}

// toggling function
function toggle(obj, myimgid, imageName) {
	//checks browser version
	if (imageName != '') {
		var imgEle = document.getElementById("report_img");
		imgEle.innerHTML = imageName;
	}
	if (window.XMLHttpRequest) {
	
		
		// IE7 firefox
		var el = $(obj);
		
		if(!el) {return false}
		
		el.style.display = (el.style.display != 'none' ? 'none' : '' );
		 
		var myimg = document.getElementById(myimgid);
		
		if(el.style.display=='none') {
			myimg.style.backgroundImage="url('/wcsstore/CustomB2CStorefrontAssetStoreIL/images/ilori_report/flourish_leaves_up.png')";
		}
		if(el.style.display==''){
			myimg.style.backgroundImage="url('/wcsstore/CustomB2CStorefrontAssetStoreIL/images/ilori_report/flourish_leaves_over.png')";
		}

	}
	else
	{
		
		// IE6
		var el = $(obj);
		el.className = (el.className != 'rpt_desc_off' ? 'rpt_desc_off' : 'rpt_desc' );
	}
}


// Close Reports
function closeReports() {
	
	var pTags = document.getElementsByTagName("p");
	var h2Tags = document.getElementsByTagName("h2");

	//closes content on load
	if (document.getElementsByTagName) {
		
		//checks browser version
		if (window.XMLHttpRequest) {

			// IE7, firefox
			for (var i=0; i<pTags.length; i++) {
				if (pTags[i].className == "rpt_desc") {
					pTags[i].style.display='none';
				}
			}
			
			for (var i=0; i<h2Tags.length; i++) {
				if (h2Tags[i].className == "rpt") {
					h2Tags[i].style.backgroundImage="url('/wcsstore/CustomB2CStorefrontAssetStoreIL/images/ilori_report/flourish_leaves_up.png')";
				}
			}

		} else {
			
			// IE6, older browsers
			for (var i=0; i<pTags.length; i++) {
				if (pTags[i].className=="rpt_desc") {
					pTags[i].className="rpt_desc_off";
				}
			}
		}	
	}
}

function setCookie( name, value, expires, path, domain, secure ) 
{
	var today = new Date();
	today.setTime( today.getTime() );

	if ( expires ) expires = expires * 1000 * 60 * 60 * 24;
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}


function getCookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}	

function deleteCookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function printPage()
{
	var url = document.URL;
	if (url.indexOf('|') > 0 || url.indexOf('%7C') > 0) 
		{url += "|Print=On"}
	else
		{if (url.indexOf('?')>0) {url += "&Print=On"} else {url += "?&Print=On"}};
	printWindow=window.open(url);
	if (window.focus) {printWindow.focus()}
	return false;
}