// ---------- amazon filter

document.onclick = function(e) {
	var url, ie;
	if (document.all) {
		url = window.event.srcElement.href;
		ie = (!window.opera) ? 1 : 0;
	}
	else if (document.getElementById && e.which == 1) {
		url = e.target.href || e.target.parentNode.href;
	}

	if (url && url.match(/amazon/)) {
		if (ie) {
			if (!window.createPopup) {
				window.event.srcElement.target = "_blank";
				return true;
			}
			url = escape(url);
			url = decodeURIComponent(url);
			url = encodeURI(url);
		}
		if (!url.match(/\/$/)) url += "/";
		url += "otsi-22";
		window.open(url);
		return false;
	}
}


// ---------- enable rollover

jQuery(function($) {
	$('#header .info li a img, .tools a img, #header .banner a img').rollover();
});


// ---------- change day/night style

today = new Date();
now = today.getTime();
today.setTime(now);
thehour = today.getHours();

if (thehour >= 18) display = "3";
else if (thehour >= 12) display = "2";
else display = "1";

var css = '<style type="text/css">';
css += '#header_inner {';
css += '	background: url(http://garden.tique.net/wp/wp-content/themes/otis_custom_2011/img/h_bg_' + display + '.jpg) 0px 40px no-repeat;';
css += '}';
css += '</style>';

document.write(css);


