// ---------- menu control

function mopen(xx,yy) {
	var source = "/wp/wp-content/themes/otis_custom_2010/img/menu_" + xx + ".jpg";
	document.getElementById(xx).style.backgroundImage = 'url("' + source + '")'; 
	document.getElementById(yy).style.visibility = "visible";
}
function mclose(xx,yy) {
	document.getElementById(xx).style.backgroundImage = 'url("/wp/wp-content/themes/otis_custom_2010/img/blank.gif")'; 
	document.getElementById(yy).style.visibility = "hidden";
}

// ---------- 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 && url.match(/[^x21-x7E]/)) {
			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;
	}
}

