
// BROWSER SELECTION
var OSName="Unknown OS";
var IE7 = false
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";

if (navigator.appVersion.indexOf("MSIE ") != -1) {
    var index = navigator.appVersion.indexOf("MSIE")
    var version = navigator.appVersion.substring(index + 5,index + 6);
    if (version >= 7) { 
        IE7 = true;
    }
}

// DROP DOWN CONTROL
function sfHover()
{

if ((OSName == "Windows") && (document.all))
{

if (document.getElementById("subnav"))
{
		
var sfEls = document.getElementById("subnav").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"), "");
}

}

}

}
}

function mcAccessible() {

if (document.getElementById("subnav"))
{

var mcEls = document.getElementById("subnav").getElementsByTagName("A");
for (var i=0; i<mcEls.length; i++) {
mcEls[i].onfocus=function() {
this.className+=(this.className.length>0? " ": "") + "sffocus"; //a:focus
this.parentNode.className+=(this.parentNode.className.length>0? " ": "") + "sfhover"; //li < a:focus
if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
this.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < a:focus
if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
this.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < ul < li < a:focus
}
}
}
mcEls[i].onblur=function() {
this.className=this.className.replace(new RegExp("( ?|^)sffocus\\b"), "");
this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
this.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
}
}
}
}
}
}

function IEextras()
{
    if ((document.all) && (OSName == "Windows")) {
        // MAX WIDTH CONTROL
        document.write("<style type=\"text/css\">\n");
        document.write("#page {width:expression(document.body.clientWidth > 1024? \"1024px\" : \"auto\");}\n");

        // SUB MENU OPACITY
        document.write("#subnavholder, #subnav li {filter: progid:DXImageTransform.Microsoft.Alpha(opacity=90);}\n");
        document.write("#subnav li li:hover, #subnav li li.sfhover {filter: progid:DXImageTransform.Microsoft.Alpha(enabled = false);}\n");

        // SUB MENU EXTRAS
        document.write("#subnavholder {width: 100%;}\n");
        document.write("#subnav a {display: block;}\n");
        document.write("#subnav li {float: left; padding: 0;}\n");
        document.write("#subnav li ul {position: absolute; left: -999em; height: auto; font-weight: normal; border-bottom: 1px solid #ffffff; border-right: 1px solid #ffffff; border-left: 1px solid #ffffff; margin: 0;}\n");
        document.write("#subnav li li {border-top: 1px solid #ffffff; padding-right: 1em;}\n");
        document.write("#subnav li ul ul {margin-top: -1.8em;}\n");
        document.write("#image h1 {clear: left;}\n");
        document.write("</style>\n");
    }
}

// MIN WIDTH CONTROL
function WindowWidth() {
    if ((document.all) && (OSName == "Windows")) {
        winSize	= document.documentElement.clientWidth;
        if (winSize <= 742){
            document.getElementById("page").style.width = "740px";
        } else if ((winSize >= 743) && (winSize <= 1024)) {
            document.getElementById("page").style.width = "auto";
        } else {
            document.getElementById("page").style.width = "1024px";
        }
    }
    if (IE7 && location.href.indexOf("pages") != -1) {
        try {
            //document.getElementById("main").style.width = "93%";
        } catch (err) {
        
        }
    }
}

function isDefined(property) {
    return (typeof property != 'undefined');
}

function RunStart()
{
sfHover();
mcAccessible();
WindowWidth();
}

// ADD JAVA FUNCTIONS
if (isDefined(window.addEventListener))
{
window.addEventListener('load', RunStart, false);
window.addEventListener('resize',WindowWidth, false); 
}

else if (isDefined(window.attachEvent))
{
window.attachEvent('onload', RunStart);
window.attachEvent('onresize',WindowWidth); 
}
