var SAFARI_STYLESHEET_REFERENCE = MEDIA_URL + "css/styles-safari.css";
var MACOS_STYLESHEET_REFERENCE = MEDIA_URL + "css/styles-macos.css";
/********************************************************************/
/* START: browser detection                                         */
var Info = new function() {
	var userAgent = navigator.userAgent.toLowerCase();
	var b = {};
	b.isIE      = userAgent.indexOf("msie") != -1;
	b.isIE7     = b.isIE && (typeof window.XMLHttpRequest != "undefined");
	b.isIEpre7  = b.isIE && !b.isIE7;
	b.isSafari  = userAgent.indexOf("safari") != - 1;
	b.isMozilla = userAgent.indexOf("gecko") != -1 && b.isSafari == false;
	b.isFirefox = b.isMozilla == true && userAgent.indexOf("firefox") != -1;
	b.isOpera   = typeof window.opera != "undefined";
	this.browser = b;
	this.os = {
		isLinux: (navigator.platform.indexOf("Linux") == 0),
		isMac:   (navigator.platform.indexOf("Mac") == 0),
		isWin:   (navigator.platform.indexOf("Win") == 0)
	}
}
/* END: browser detection                                           */
/********************************************************************/
/********************************************************************/
/* START: serve special styles                                      */
if (Info.os.isMac)         document.write ("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + MACOS_STYLESHEET_REFERENCE + "\" />");
if (Info.browser.isSafari) document.write ("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + SAFARI_STYLESHEET_REFERENCE + "\" />");
/* END: serve special styles                                        */
/********************************************************************/
/********************************************************************/
/* START: Fix Flickering Background Images                          */
if (window.createPopup && document.compatMode && document.compatMode=="CSS1Compat" && !window.XMLHttpRequest) {
	try{
		document.execCommand("BackgroundImageCache", false, true);
	} catch(e) {}
}
/* END: Fix Flickering Background Images                            */
/********************************************************************/
/* START: addDOMLoadEvent                                           */
function addDOMLoadEvent(func) { if (!window.__load_events) { var init = function () { if (arguments.callee.done) return; arguments.callee.done = true; if (window.__load_timer) { clearInterval(window.__load_timer); window.__load_timer = null; } for (var i=0;i < window.__load_events.length;i++) { window.__load_events[i](); } window.__load_events = null; }; if (document.addEventListener) { document.addEventListener("DOMContentLoaded", init, false); } /*@cc_on @*//*@if (@_win32) document.write("<script id=__ie_onload defer src=//:><\/script>"); document.getElementById("__ie_onload").onreadystatechange = function() { if (this.readyState == "complete") init(); }; /*@end @*/ if (/WebKit/i.test(navigator.userAgent)) { window.__load_timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) { init(); } }, 10); } window.onload = init; window.__load_events = []; } window.__load_events.push(func); }
/* END: addDOMLoadEvent                                             */
/********************************************************************/
/********************************************************************/
/* START: document ready                                            */
$(document).ready(function() {
    // hide submenus + set events
    $("div#nav div.categories-portlet ul li")
        .hover(function() {
            $(this).siblings("li").children("ul").hide();
            $(this).children("ul").show();
        }, function() {
            $(this).children("ul").hide();
            $(this).siblings("li[class*=current]").children("ul").show();
        });
    // hide submit buttons
    $("form#search input[type=submit]").hide();
    // image loupe
    $(".main-image .loupe").hide()
    $(".main-image").hover(
        function() { $(this).children(".loupe").fadeIn() },
        function() { $(this).children(".loupe").fadeOut() });
});

/* END: document ready                                              */
/********************************************************************/

 
