<!--

//fs
var dw_fontSizerDX = {
    sizeUnit:    "%",
    defaultSize: 75,
    maxSize:     115,
    minSize:     65,
    adjustList: [], // set method populates

    setDefaults: function(unit, dflt, mn, mx, sels) {
        this.sizeUnit = unit;       this.defaultSize = dflt;
        this.maxSize = mx;          this.minSize = mn;
        if (sels) this.set(dflt, mn, mx, sels);
    },

    set: function (dflt, mn, mx, sels) { 
        var ln = this.adjustList.length;        
        for (var i=0; sels[i]; i++) {
            this.adjustList[ln+i] = [];
            this.adjustList[ln+i]["sel"]  = sels[i];
            this.adjustList[ln+i]["dflt"] = dflt;
            this.adjustList[ln+i]["min"]   = mn || this.minSize;
            this.adjustList[ln+i]["max"]   = mx || this.maxSize;
            // hold ratio of this selector's default size to this.defaultSize for calcs in adjust fn 
            this.adjustList[ln+i]["ratio"] = this.adjustList[ln+i]["dflt"] / this.defaultSize;
        }
    },

    init: function() {
        if ( !document.getElementById || !document.getElementsByTagName ) return;
        var size, sizerEl, i;
        size = window.location.search? window.location.search.slice(1): getCookie("fontSize");
        size = !isNaN( parseFloat(size) )? parseFloat(size): this.defaultSize;
        // in case default unit changed or size passed in url out of range
        if ( size > this.maxSize || size < this.minSize ) size = this.defaultSize;
        this.curSize = this.defaultSize;  // create curSize property to use in calculations 
        sizerEl = document.getElementById('sizer');
        if (sizerEl) sizerEl.style.display = "block";
        // if neither set nor setDefaults populates adjustList, apply sizes to body and td's
        if (this.adjustList.length == 0) {
            this.setDefaults( this.sizeUnit, this.defaultSize, this.minSize, this.maxSize, ['body', 'td'] );
        }
        if ( size != this.defaultSize ) this.adjust( size - this.defaultSize );
    },

    adjust: function(n) {
		
        if ( !this.curSize ) return; // set in init
        var alist, size, list, i, j;
        // check against max/minSize
        if ( n > 0 ) {
            if ( this.curSize + n > this.maxSize ) n = this.maxSize - this.curSize;
        } else if ( n < 0 ) {
            if ( this.curSize + n < this.minSize ) n = this.minSize - this.curSize;
        }
        if ( n == 0 ) return;
        this.curSize += n;
        // loop through adjustList, calculating size, checking max/min
        alist = this.adjustList;
        for (i=0; alist[i]; i++) {
            size = this.curSize * alist[i]['ratio']; // maintain proportion 
            size = Math.max(alist[i]['min'], size); size = Math.min(alist[i]['max'], size);
            list = dw_getElementsBySelector( alist[i]['sel'] );
            for (j=0; list[j]; j++) 
            { 
				list[j].style.fontSize = size + this.sizeUnit; 
				//alert(  size + this.sizeUnit); 
			}
        }
        setCookie( "fontSize", this.curSize, 180, "/" );
    },

    reset: function() {
        var alist = this.adjustList, list, i, j;
        for (i=0; alist[i]; i++) {
            list = dw_getElementsBySelector( alist[i]['sel'] );
            for (j=0; list[j]; j++) { 
                // Reset adjustList elements to their default sizes
                //list[j].style.fontSize = alist[i]['dflt'] + this.sizeUnit;
                list[j].style.fontSize = '';  // restores original font size
            } 
        }
        this.curSize = this.defaultSize;
        deleteCookie("fontSize", "/");
    }

}

//s

function init() 
{

	
	dw_fontSizerDX.setDefaults( "%", 75, 65, 115, ['body'] );
	dw_fontSizerDX.init();
	return;
}

function openWindow(url,name,attributes) 
{
    var windowHandle = '';
	windowHandle = window.open(url,name,attributes);
}

function OpenCloseFolder( nContentId, strImageName )
	{
		var oImage = document.getElementById( strImageName );
		var oDiv = document.getElementById( nContentId );
		var strImage = "";
		
		oDiv.style.display  = (oDiv.style.display == "block") ? "none" : "block" ;
		strImage = (oDiv.style.display == "block") ? "folder_open.gif" : "folder_closed.gif";
		oImage.src = "/files/" + strImage;
	}



var HelpWindow = null;
function openHelpWindow(strHelp)
{
	var strQuery = unescape(strHelp)
	
	if (HelpWindow == null)
	{	
			HelpWindow = window.open("/formHelp.asp?help=" +escape(strQuery) , "helpWindow", "width=350, height=250, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=yes");
	}
	else
	{
		HelpWindow.location.href = "/formHelp.asp?help=" +escape(strQuery )
		HelpWindow.focus();
	}	
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}


