﻿_PFX = 'ctl00_C_';
var lastScroller = 0;

Go_OnClick =
	function() {
	    document.search.submit();
	}

Hover =
    function(el) {
        if (el.src.lastIndexOf("_out.") > -1) {
            el.src = el.src.replace("_out.", "_active.");
        } else {
            el.src = el.src.replace("_active.", "_out.");
        }
    }

FeaturedLink_OnMouseOut =
	function(e, divID) {
        var elDiv = YAHOO.util.Dom.get(divID);
        if (YAHOO.util.Dom.getStyle(elDiv, 'position') == 'absolute') YAHOO.util.Dom.setStyle(elDiv, 'display', 'none');
	}

FeaturedLink_OnMouseOver =
	function(e, divID) {
	    var elDiv = YAHOO.util.Dom.get(divID);

	    if (YAHOO.util.Dom.getStyle(elDiv, 'position') == 'absolute') {
	        YAHOO.util.Dom.setStyle(elDiv, 'height', '1px');
	        YAHOO.util.Dom.setStyle(elDiv, 'z-index', '1');
	        YAHOO.util.Dom.setStyle(elDiv, 'display', 'block');
	        var newX = YAHOO.util.Dom.getX(e) + parseInt(e.offsetWidth / 2) - parseInt(elDiv.offsetWidth / 2) - 1;
	        var newY = YAHOO.util.Dom.getY(e) - elDiv.offsetHeight;
	        YAHOO.util.Dom.setX(elDiv, newX);
	        YAHOO.util.Dom.setY(elDiv, newY);
	        newY -= 161; // this is the approximate height of the div
	        var anim = new YAHOO.util.Anim(elDiv, { top: { to: newY }, height: { to: 162} }, 0.3);
	        anim.animate();
	    }
	}

SetTextSize =
	function(setting) {
	    if (setting == null) setting = 0;
	    var elClass = YAHOO.util.Dom.get('Content');
	    var elSize = YAHOO.util.Dom.get('TextSize');
	    var elImg = elSize.getElementsByTagName('img');

	    if (setting == 0) {
	        YAHOO.util.Dom.removeClass(elClass, 'BIG');
	        YAHOO.util.Cookie.set('textSize', 0);
	        elImg[0].src = elImg[0].src.replace(/enabled/, 'disabled');
	        elImg[1].src = elImg[1].src.replace(/disabled/, 'enabled');
	    }
	    if (setting == 1) {
	        var alreadyBig = YAHOO.util.Dom.hasClass(elClass, 'BIG');
	        if (!(alreadyBig)) YAHOO.util.Dom.addClass(elClass, 'BIG');
	        YAHOO.util.Cookie.set('textSize', 1);
	        elImg[0].src = elImg[0].src.replace(/disabled/, 'enabled');
	        elImg[1].src = elImg[1].src.replace(/enabled/, 'disabled');
	    }
	}

	Window_OnLoad =
	function() {
	    if (YAHOO.util.Dom.get('TextSize')) {
	        SetTextSize(YAHOO.util.Cookie.get('textSize'));
	    }

	    var content = document.getElementById("Content")
	    if (!document.all && content) {
	        // Make style adjustments for various browsers
	        content.style.width = "97%";
	        content.style.height = "97%";
	        document.getElementById("SubMenuTable").style.marginTop = "0px";
	    }

	    // Activate main menu link for current page
	    if (location.href.indexOf("aboutus") > -1) { document.getElementById("imgAbout").src = "C/a/about_active.jpg"; }
	    if (location.href.indexOf("rating") > -1) { document.getElementById("imgRating").src = "C/a/rating_active.jpg"; }
	    if (location.href.indexOf("applications") > -1) { document.getElementById("imgApplications").src = "C/a/applications_active.jpg"; }
	    if (location.href.indexOf("risk") > -1) { document.getElementById("imgRisk").src = "C/a/risk_active.jpg"; }
	}

toggleListItem =
    function(currListItem) {
        var elHead = document.getElementById(currListItem + "img");
        var elBody = document.getElementById(currListItem);

        if (elBody.style.display == 'block') {
            YAHOO.util.Dom.setStyle(elBody, 'display', 'none');
            elHead.src = 'App_Content/media/plus_icon_enabled.gif';
        }
        else {
            YAHOO.util.Dom.setStyle(elBody, 'display', 'block');
            elHead.src = 'App_Content/media/minus_icon_enabled.gif';
        }
    }
        
YAHOO.util.Event.addListener(window, 'load', Window_OnLoad);
