﻿// event worker object constructor
function EventWorker(){
    this.addHandler = EventWorker.addHandler;
}

function IE6nav() {

	//based on http://alistapart.com/articles/horizdropdowns
	//this makes the nav work on IE6

	if (document.all && document.getElementById) {
		navRoot = document.getElementById("nav");
		if (navRoot != null)
		{
			for( i=0; i<navRoot.childNodes.length; i++ ) {
				node = navRoot.childNodes[i];
				if( node.nodeName == 'LI' ) {
					node.onmouseover = function() { if (this.className.indexOf('single') != -1) { this.className+=' singleover'; } else { this.className+=' over'; } };
					node.onmouseout = function() { if (this.className.indexOf('single') != -1) { this.className = this.className.replace(' singleover', ''); } else { this.className = this.className.replace(' over', ''); } };
				} //end if li
			} //end for
		} // end if
	} //end if dom
 
} //end function

// event worker static method
EventWorker.addHandler =
     function (eventRef, func) {
        var eventHandlers = eval(eventRef);
        if (typeof eventHandlers == 'function') { // not first handler
            eval(eventRef + " = function(event) {eventHandlers(event); func(event);}");  
        } else { // first handler
            eval(eventRef + " = func;");
        }
     }
     
     
     
    /* function for finding the center position of the browser*/
    function getScreenCenterY() {   
    var y = 0;   
      
    y = getScrollOffset()+(getInnerHeight()/2);   
      
    return(y);   
    }   
  
    function getScreenCenterX() {   
    return(document.body.clientWidth/2);   
    }   
      
    function getInnerHeight() {   
    var y;   
    if (self.innerHeight) // all except Explorer   
    {   
    y = self.innerHeight;   
    }   
    else if (document.documentElement && document.documentElement.clientHeight)   
    // Explorer 6 Strict Mode   
    {   
    y = document.documentElement.clientHeight;   
    }   
    else if (document.body) // other Explorers   
    {   
    y = document.body.clientHeight;   
    }   
    return(y);   
    }   
  
    function getScrollOffset() 
    {   
        var y;   
        if (self.pageYOffset) // all except Explorer   
        {   
        y = self.pageYOffset;   
        }   
        else if (document.documentElement && document.documentElement.scrollTop)   
        // Explorer 6 Strict   
        {   
        y = document.documentElement.scrollTop;   
        }   
        else if (document.body) // all other Explorers   
        {   
        y = document.body.scrollTop;   
        }   
        return(y);   
    }  
//The below ie6 function is in pngfix.js file 
    function calcPosition(adCampaignObject, objWidth, objHeight, borderColor)
    {
        //posY = getScreenCenterY() - (objHeight / 2);
        posY = 155; 
        
        if(posY <0)
        {
            posY = 0;
        }

        //posX = getScreenCenterX() - (objWidth / 2);
        posX = 0;
        if(posX <0)
        {
            posX = 0;
        }  
        adCampaignObj = document.getElementById(adCampaignObject);
        //adCampaignObj.style.cssText = "visibility:visible;position:absolute;top:" + posY + "px; left:" + posX + "px; width:"+ objWidth + "px; height:" + objHeight +"px; border:solid 1px "+ borderColor + "; background:#FFF; z-index: 201;";
       // adCampaignObj.style.cssText = "position:relative;top:" + posY + "px; right:" + posX + "px;visibility:visible;width:" + objWidth + "px;border: solid 1px #" + borderColor + ";background:#FFF;z-index: 201; float:right; margin:-1288px 49px 0 0px;";
        if (document.all && document.getElementById) 
        {
            var arVersion = navigator.appVersion.split("MSIE")
            var version = parseFloat(arVersion[1])
           

            if ((version >= 5.5) && (version <= 6.0) ) 
            {    
                adCampaignObj.style.cssText = "position:absolute;top:" + posY + "px; right:" + posX + "px;visibility:visible;width:" + objWidth + "px;border: solid 1px #" + borderColor + ";background:#FFF;z-index: 201; float:right; margin:-60px 163px 0px 0px;";
            }
            else
            {
                if (version == 7.0) 
                {
                    adCampaignObj.style.cssText = "position:absolute;top:" + posY + "px; right:" + posX + "px;visibility:visible;width:" + objWidth + "px;border: solid 1px #" + borderColor + ";background:#FFF;z-index: 201; float:right; margin:-60px 167px 0px 0px;";
                }
                else 
                {
                   //adCampaignObj.style.cssText = "position:absolute;top:" + posY + "px; right:" + posX + "px;visibility:visible;width:" + objWidth + "px;border: solid 1px #" + borderColor + ";background:#FFF;z-index: 201; float:right; margin:-0px 169px 0px 0px;";
                }
            }
           

        }
        else {
           adCampaignObj.style.cssText = "position:absolute;top:" + posY + "px; right:" + posX + "px;visibility:visible;width:" + objWidth + "px;border: solid 1px #" + borderColor + ";background:#FFF;z-index: 201; float:right; margin:-60px 169px 0px 0px;";

        }
         


    }
    
 