/// <reference path="jquery-1.3.2.js" />
// <reference path="jquery-1.3.2-vsdoc2.js" />

$(document).ready(function() {
    //set this div height so the content will   
    //stay aligned correctly in safari and opera
    //$("#leftContent").height(300);

    var loc = location.href.replace("http://stiefelcadev/", "").
                replace("http://stiefelcaqa/", "").
                replace("http://www.stiefel.ca/", "").
                replace("http://stiefel.ca/", "").
                replace("?LangType=3084", "").replace("?LangType=4105", "").
                replace("?&LangType=3084", "").replace("?&LangType=4105", "");
    loc = ".insidemenu a[@href*=" + loc + "]";

//    $(loc).parent(".leftContentMenu:first ").attr("style",
//        "background-position:right center;background-image: url(/images/arrow.gif);background-repeat: no-repeat;");
    $(loc).parent(".leftContentMenu:first ").css("background-image", "url(/images/arrow.gif)");
    $(loc).parent(".leftContentMenu:first ").css("background-repeat", "no-repeat");
    $(loc).parent(".leftContentMenu:first ").css("background-position", "right center");
    
    $(loc).removeClass("ekflexmenu_link").addClass("ekflexmenu_link_selected");
    //set the main div height so that the vertical 
    //lines will extend all the way down the page
    if ($("#main").height() < ($(window).height() - 19))
        $("#main").height($(window).height() - 19);
    $(window).resize(function() {
        if ($("#main").height() < ($(window).height() - 19))
            $("#main").height($(window).height() - 19);
    });

    if (document.getElementById("ctl00_hfMenu") != null) {
        $("#img" + document.getElementById("ctl00_hfMenu").value).attr("src",
        "/uploadedimages/" + document.getElementById("ctl00_hfMenu").value + ".gif");
        $("#img" + document.getElementById("ctl00_hfMenu").value).removeAttr("onmouseover");
        $("#img" + document.getElementById("ctl00_hfMenu").value).removeAttr("onmouseout");
    }

    //correct the left inner menu for opera and safari
    if ($.browser.opera || $.browser.safari ||
        ($.browser.msie && (jQuery.browser.version >= 8))) {
        $("#leftContent").find(".leftContentMenu").after("<br/>");
    }
});
    
function LoadAllImages()
{
    MM_preloadImages('/uploadedimages/Home/contact_roll.gif',
                '/images/search_roll.gif',
                '/uploadedimages/TheCompany_roll.gif', '/uploadedimages/WhatsNew_roll.gif',
                '/uploadedimages/OurProducts_roll.gif', '/uploadedimages/AboutSkin_roll.gif',
                '/uploadedimages/Careers_roll.gif', '/uploadedimages/news_roll.gif',
                '/uploadedimages/RelatedLinks_roll.gif');
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}