/*
* Using the MdlaBox for Prototype. Please reference the below URL:
* http://okonet.ru/projects/modalbox/
*/

var ie6Box = {
	html:'<div id="modalContainer" class="modalContainer" ><div class="modalBannerBlock"><p class="modalBannerBlockText"><img src="/cfi/img/arrow-wrap.gif" width="7" height="12" >&nbsp;<a href="/cfi/AtoZie6.asp" target="_blank" >Upgrade for CFI Employees</a></p><p class="modalBannerBlockText1"><img src="/cfi/img/arrow-wrap.gif" width="7" height="12" >&nbsp;<a href="/cfi/downloads/details.asp?FamilyId=9AE91EBE-3385-447C-8A30-093545B2F90B&displaylang=en" target="_blank" >Upgrade your IE browser </a></p><p class="modalBotTextBlock"><img src="/cfi/img/arrow-wrap.gif" width="7" height="12" >&nbsp;<a href="#" onclick="Modalbox.hide(); return false;">Upgrade Later</a></p></div> </div>',
	
	box: Modalbox,
	
	isIE6: Prototype.Browser.IE && parseInt(navigator.userAgent.substring (navigator.userAgent.indexOf("MSIE")+5))==6,
	
	/*
	* Function to Show the Modal Window  based on whether it is IE 6 
	* and cookie set for displaying once.
	*/
	show: function() {		
			ie6Box.box.show(ie6Box.html, {title: this.title, width: 250,inactiveFade:false});
			ie6Box.disable();	
			ie6Box.setCookieOnCancel();			
	},
	
	/*
	* Wrapper to enable the Modalbox 
	*/			
	enable: function() {
		ie6Box.box.activate();
	},
	
	/*
	* Wrapper to disable the box from disapearing. 
	*/						
	disable: function() {
		ie6Box.box.deactivate();
	},
	
	/*
	* Setting Cookie  for IE 6. Session cookie. 
	*/						
	setCookieOnCancel: function() {
		ie6Box.createCookie("ie_6_check","true",0);
	},
	
	/*
	* Check if the cookie is set 
	*/						
	isIECookieSet: function() {
		return ie6Box.readCookie("ie_6_check");
	},
	
	createCookie:function (name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	},
	
	readCookie:function (name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	},
	
	eraseCookie:function (name) {
		ie6Box.createCookie(name,"",-1);
	}

};

document.observe("dom:loaded", function() {
	if (ie6Box.isIE6) {
		if (ie6Box.isIECookieSet() == null) {	
			ie6Box.show();
		}
	}
});	



