// JavaScript Document
<!--
	function Clear (thisform)
	{
		if (thisform.value=="Enter Zip Code"){
			thisform.value="";
		}
		
	}
	
	
	
	function Watch()
	{
		this.tickA	= 0;
		this.tickB	= 0;
		
		this.start	= function() {with(this) {tickA = new Date().getMilliseconds();} return this.tickA;}
		this.stop 	= function() {with(this) {tickB = new Date().getMilliseconds();} return this.tickB;}
		this.show	= function() {alert((this.tickB - this.tickA) + 'ms');}
		this.total	= function() {return (tickB-tickA);}
	}

    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_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 MM2_swapImgRestore() { //v3.0
      var i,x,a=document.MM2_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    
    function MM_findObj(n, d) { //v5; better support for NN4
		if((window.cache=window.cache||new Cache()).exists(n)) {return cache.get(n);}
        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];
        if(!x && d.getElementById) x=d.getElementById(n);for(i=0;!x&&i<d.anchors.length;i++) 
        {a=d.anchors[i];if(a) x=(a.name&&a.name==n||a==n)?a:((a.id&&a.id==n)?a:null);} for(i=0;!x&&i<d.links.length;i++) 
        {a=d.links[i];if(a) x=(a.name&&a.name==n||a==n)?a:((a.id&&a.id==n)?a:null);} for(i=0;!x&&i<d.images.length;i++) 
        {a=d.images[i];if(a) x=(a.name&&a.name==n||a==n)?a:((a.id&&a.id==n)?a:null);} for(i=0;!x&&d.layers&&i<d.layers.length;i++)
        {a=d.layers[i];if(a) x=(a.name&&a.name==n||a==n)?a:((a.id&&a.id==n)?a:null);} for(i=0;!x&&d.layers&&i<d.layers.length;i++)
        x=MM_findObj(n,d.layers[i].document); cache.set(n,x);                 
        return x;
    }        

	function MM2_findObj(n, d) { //v4.0
	  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=MM2_findObj(n,d.layers[i].document);
	  if(!x && document.getElementById) x=document.getElementById(n); return x;
	}
    
    function MM_showHideLayers() { //v6.0
      var i,p,v,obj,args=MM_showHideLayers.arguments;
      for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
        if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
        obj.visibility=v; }
    }
    
    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 MM2_swapImage() { //v3.0
      var i,j=0,x,a=MM2_swapImage.arguments; document.MM2_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM2_findObj(a[i]))!=null){document.MM2_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
	    
    function sprintf()
    {
        if (!arguments || arguments.length < 1 || !RegExp) return;
        
        var str = arguments[0], args = (arguments.length>1&&arguments[1].length&&arguments[1].sort)?arguments[1]:arguments;
        var re  = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/;
        var a   = b = [], numSubstitutions = 0, numMatches = 0;    
        while (a = re.exec(str))
        {
            var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4];
            var pPrecision = a[5], pType = a[6], rightPart = a[7];
    
            numMatches++;
            if (pType == '%')
                subst = '%';
            
            else
            {            
                numSubstitutions++;            
                if (numSubstitutions >= args.length)
                    alert('Error! Not enough function arguments (' + (args.length - 1) + ', excluding the string)\nfor the number of substitution parameters in string (' + numSubstitutions + ' so far).');
                
                var param           = args[numSubstitutions];
                
                var pad             = '';       var justifyRight    = true;
                var minLength       = -1;       var precision       = -1;
                var subst           = param;
                                    
                     if (pPad && pPad.substr(0,1) == "'")   pad             = leftpart.substr(1,1);
                else if (pPad)                              pad             = pPad;
                     if (pJustify && pJustify === "-")      justifyRight    = false;
                     if (pMinLength)                        minLength       = parseInt(pMinLength);
                     if (pPrecision && pType == 'f')        precision       = parseInt(pPrecision.substring(1));
                     
                     if (pType == 'b') subst = parseInt(param).toString(2);
                else if (pType == 'c') subst = String.fromCharCode(parseInt(param));
                else if (pType == 'd') subst = parseInt(param) ? parseInt(param) : 0;
                else if (pType == 'u') subst = Math.abs(param);
                else if (pType == 'f') subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision): parseFloat(param);
                else if (pType == 'o') subst = parseInt(param).toString(8);
                else if (pType == 's') subst = param;
                else if (pType == 'x') subst = ('' + parseInt(param).toString(16)).toLowerCase();
                else if (pType == 'X') subst = ('' + parseInt(param).toString(16)).toUpperCase();
            }
            str = leftpart + subst + rightPart;
        }
        return str;
    }
    
    function findOnPage(object, container)
    {
        var pageObj         = arguments[0] || null;
        var containerObj    = arguments[1] || window.document.body;
        var func1           = function(obj) {with(this) {left+=obj.x;x+=obj.x;top+=obj.y;y+=obj.y} return this;}
        var func2           = function() {with(this) return 'x:'+x+', y:'+y;}
        var func3           = function(obj) {with(this) {return (x==obj.x&&y==obj.y);}}
        var build           = function(x,y) {return {left:x,x:x,top:y,y:y,append:func1,toString:func2,compare:func3}}
        var isString        = function(obj) {return (obj&&obj.indexOf&&obj.split&&obj.substring);}                
        var find            = function(id,container)
        {
            if(arguments.length == 1 || !container) find.extra = {layers:new Array()};
            container = arguments[1] || document; var list = "anchors,applets,links,forms,images,layers", colls = list.split(","), result = null;
            if(document.all) result = document.all[id]; else if(document.getElementById) result = document.getElementById(id);
            for(var i = 0; !result && i < colls.length; i++) for(var j = 0; !result && container[colls[i]] && j <container[colls[i]].length; j++)
            {var val = container[colls[i]][j]; result = (val&& ((val.name && val.name == id) || (val.id && val.id== id))) ? val : null;}
            if(!result && container.layers) for(var i = 0;!result && i < container.layers.length;i++) {result = find(id,container.layers[i].document);
            if(result) find.extra.layers[find.extra.layers.length] = container.layers[i]; } cache.set(id,result);
            return result;
        }
        find.extra = new Object();            
        
        if(isString(pageObj))
            pageObj = find(pageObj);
        
        if(pageObj == null) 
            return build(0,0);
        
        if(document.layers)
        {
            var results = build(pageObj.x,pageObj.y);
            var layers  = find.extra.layers;
            
            if(layers && layers.length > 0) 
                for(var i = 0; i < layers.length; i++)
                    results.append(findOnPage(layers[i]));
            
            return results;
        }
        
        var t = 0; var l = 0; var o = pageObj;
        while(o != containerObj && o != null && typeof(o) != 'undefined')
        {
            t   += parseInt(o.offsetTop);
            l   += parseInt(o.offsetLeft);
            o    = o.offsetParent;
        }
        
        return build(l,t);
    }

    function doOnLoad(func)
    {
        if(typeof(func)=='string')
            window.onLoad.evals[window.onLoad.evals.length] = 
            window.onload.evals[window.onload.evals.length] = func;
        
        else
            window.onLoad.funcs[window.onLoad.funcs.length] =
            window.onload.funcs[window.onload.funcs.length] = func;
    }

    window.onload = window.onLoad = function()
    {
        for(var i=0; i < onload.evals.length; i++)
            eval(onload.evals[i]);
        
        for(var i=0; i < onload.funcs.length; i++)
            onload.funcs[i]();
    }
    window.onload.funcs = window.onLoad.funcs = new Array();
    window.onload.evals = window.onLoad.evals = new Array();
    
    function Cache()
    {
        // This object stores all the cached values. It is highly
        // recommended that the get/set methods supplied in this
        // class be used rather than directly modifying the Cache
        // object itself.
        this.hash   = new Object();
        
        // This method attempts to grab a value from the cache
        // if this value doesn't exist the supplied new value
        // will be set with the specified key.
        this.getSet = function(key, newValue)
        {
            var results = this.hash[key] || newValue;
            
            if(results == newValue)
                this.hash[key] = newValue;
            
            return results;
        }
        
        // This is a simple wrapper that may later contain additional
        // logic in regards to retrieving cached values. The defaultValue
        // is entirely optional but unlike getSet() it does not store
        // the defaultValue in the cache if the supplied key doesn't
        // exist.
        this.get = function(key, defaultValue)
        {
            defaultValue    = arguments[1] || null;
            var results     = this.hash[key] || defaultValue;
            
            return results;
        }
        
        // This wrapper sets values in the cache. If a previous value
        // existed in the cache with the same name it will be returned
        this.set = function(key, value)
        {
            var results     = this.hash[key] || null;
            this.hash[key]  = value;
            
            return results;
        }
		
		// This function merely returns true if the supplied key value
		// exists in the internal hash object.
		this.exists = function(key)
			{return (this.hash[key] && true);}
            
            
        // This function builds and returns an array of keys based on the
        // the enumerable items within the internal cache hash table
        this.keys = function()
        {
           var results  = new Array();
           for(key in this.hash)
               results[results.length] = key;
           
           return results;
        }
        
        // This function builds and returns an array of values based on the
        // the enumerable items' values within the internal cache hash table
        this.values = function()
        {
           var results  = new Array();
           for(key in this.hash)
               results[results.length] = this.hash[key];
           
           return results;
        }
    }
	

	//rollover by img name and src
	function roll(_img,_fileName,_layer)
	{
	    MM_swapImage(_img,'',_fileName);
	}

	//show layer
	function showLayer( _layerId )
	{
	    MM_showHideLayers(_layerId,'','show');
	}
	
	//hide a layer
	function hideLayer( _layerId )
	{
	    MM_showHideLayers(_layerId,'','hide');
	}	

	function reAlign()
	{
	    var subTempIndex = 0;
	    
	    //realign main menus
	    for (t = 0; t < allMenus.length; t ++)
	    {
	        mid = allMenus[t].id;
	        if (mid.indexOf('Menu') == -1)
	        {
	            lname = 'menu' + t;
	            aname = 'rnav' + t;
	            align_layers(aname, lname, -7, 7);
	        }
	    }
	    
	    //realign sub menus
	    for (r = 0; r < allMenus.length; r ++)
	    {
	        mid = allMenus[r].id;
	        if (mid.indexOf('menu') == -1)
	        {
	            lname = 'subMenu' + subTempIndex;
	            aname = 'rlink' + subTempIndex;            
	            align_layers(aname, lname, -4, -1);
	            subTempIndex += 1;
	        }
	    }
	}



    Cache.prototype = new Object();
    window.cache    = new Cache();
	
	function clearSearch() {
		if (searchform.words.value == 'keyword or item #') {
			searchform.words.value = '';
		}
	}	
	
//pop-up window code
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',noresizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

//-->
