/* The Fan Carpet Motherfunctions  */
/*                                 */
/* (c) The Javascript Factory      */
/*     All rights reserved         */

sfHover = function() {
    var sfEls = document.getElementById("navbar").getElementsByTagName("LI");
    for (var i = 0; i < sfEls.length; i++) {
        sfEls[i].onmouseover = function() {
            this.className += " sfhover";
        }
        sfEls[i].onmouseout = function() {
            this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}

if (window.attachEvent) window.attachEvent("onload", sfHover);

doLogout = function() {
    $.post("/login/login.ashx", { Action: "Logout" }, function() {
        window.location.href = window.location.href;
    });
}

searchFromEnter = function(_event, sender) {
    var firefox = _event.which ? true : false;
    var charCode = firefox ? _event.which : event.keyCode;

    if (charCode == 13) {
        window.location.href = "/search.aspx?search=" + encodeURI(sender.value);

        if (firefox) {
            _event.stopPropagation();
            _event.preventDefault();
        }
        else {
            event.cancelBubble = true;
            event.returnValue = false;
        }
    }
}

search = function(text) {
    window.location.href = "/search.aspx?search=" + encodeURI(text);
}

flashTracking = function(page, film){
	//alert ("PAGE: " + page + " FILM: " + film);
    if(pageTracker._trackEvent){	   
	    pageTracker._trackEvent(page, film);		
    }
}

    // load flash movie
loadFlash = function(id, swf, width, height, vars) {
    //var width = $("#" + id).width();
    var params = {};
    var attributes = {};
    params.menu = "false";
    params.quality = "high";
    params.wmode = "transparent";
    params.bgcolor = "#000000";
    params.allowFullScreen = "true";
    params.base = ".";
    // using a slash '/' here breaks ie6
    params.salign = "tl";
    params.scale = "default";
    attributes.allowFullScreen = "true";
    attributes.id = id;
    attributes.name = id;
    swfobject.embedSWF(swf, id, width, height, "9.0.0", false, vars, params, attributes);
}
