/* * *
	BACKGROUND IMAGE CACHE
* * */
Try.these(function(){
	document.execCommand("BackgroundImageCache", false, true);
});

/* * *
	CREATE BOOKMARK LINK
* * */
function CreateBookmarkLink() {
	title = "CDL de Garibaldi"; 
	url = "http://www.cdlgaribaldi.com.br";
	
	if(document.all)
		window.external.AddFavorite(url, title);
	else if(window.sidebar)
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print)
		return true;
	else
		alert('Seu navegador não possui suporte a favoritos');
}
 
/* * *
	CONTENT LOADED
* * */
function ContentLoaded (w, fn) {
	var d = w.document,
		u = w.navigator.userAgent.toLowerCase();

	function init(e) {
		if (!arguments.callee.done) {
			arguments.callee.done = true;
			fn(e);
		}
	}

	// konqueror/safari
	if (/khtml|webkit/.test(u)) {

		(function () {
			if (/complete|loaded/.test(d.readyState)) {
				init('poll');
			} else {
				setTimeout(arguments.callee, 10);
			}
		})();

	// internet explorer all versions
	} else if (/msie/.test(u) && !w.opera) {

		(function () {
			try {
				d.documentElement.doScroll('left');
			} catch (e) {
				setTimeout(arguments.callee, 10);
				return;
			}
			init('poll');
		})();
		d.attachEvent('onreadystatechange',
			function (e) {
				if (d.readyState == 'complete') {
					d.detachEvent('on'+e.type, arguments.callee);
					init(e.type);
				}
			}
		);

	// browsers having native DOMContentLoaded
	} else if (d.addEventListener &&
		(/gecko/.test(u) && parseFloat(u.split('rv:')[1]) >= 1.8) ||
		(/opera/.test(u) && parseFloat(u.split('opera ')[1]) > 9)) {

		d.addEventListener('DOMContentLoaded',
			function (e) {
				this.removeEventListener(e.type, arguments.callee, false);
				init(e.type);
			}, false
		);

	// fallback to last resort
	} else {

		// from Simon Willison
		var oldonload = w.onload;
		w.onload = function (e) {
			if (typeof oldonload == 'function') {
				oldonload(e || w.event);
			}
			init((e || w.event).type);
		};

	}
}

/* * * 
	IE HOVER
* * */
var IEHover = {
	onId:function(load, id){
		IEHover._on(function(){
			return [$(id)];
		}, load);
	},
	onTagName:function(load, tagName, self){
		IEHover._on(function(){
			return $(self || document).getElementsByTagName(tagName);
		}, load);
	},
	_on:function(getFunc, load){
		var func = function(){
			$A(getFunc()).each(function(element){
				Event.observe(element, 'mouseover', IEHover.over.bind(element));
				Event.observe(element, 'mouseout', IEHover.out.bind(element));
			});
		}
		
		if(load)
			ContentLoaded(window, func);
		else
			func();
	},
	
	over:function(){
		Element.addClassName(this, IEHover.hoverClass(this));
	},
	
	out:function(){
		Element.removeClassName(this, IEHover.hoverClass(this));
	},
	
	hoverClass:function(element){
		if(!element.className || element.className == 'hover')
			return 'hover';
		else
			return element.className.split(/\s+/)[0]+'Hover';
	}
}


/*-----------------------------------------------------------------------------------------------*/

IEHover.onTagName(true, 'li', 'top');