﻿// JScript File

function warn(url)
{
    //alert("hi");
    if(confirm("You are leaving the Tree Top Website and going to a third party site. This site may have a privacy policy different from Tree Top and may provide less security than the Tree Top site. Tree Top and its affiliates are not responsible for the products, services, and content on the third party website. Do you want to go to the third party site?"))
    {
        
        window.open(url, "_self");

        return false;
        
    }
    
}

 function warn(url,target)
{
    //alert("hi");
    if(confirm("You are leaving the Tree Top Website and going to a third party site. This site may have a privacy policy different from Tree Top and may provide less security than the Tree Top site. Tree Top and its affiliates are not responsible for the products, services, and content on the third party website. Do you want to go to the third party site?"))
    {
        
        window.open(url, target);

        return false;
        
    }
    
}

function roll_over(img_name, img_src)
{
    var ele = document.getElementById(img_name);
    ele.src = img_src;
   
}

	
var getElementsByClassName = function (className, tag, elm){
	if (document.getElementsByClassName) {
		getElementsByClassName = function (className, tag, elm) {
			elm = elm || document;
			var elements = elm.getElementsByClassName(className),
				nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
				returnElements = [],
				current;
			for(var i=0, il=elements.length; i<il; i+=1){
				current = elements[i];
				if(!nodeName || nodeName.test(current.nodeName)) {
					returnElements.push(current);
				}
			}
			return returnElements;
		};
	}
	else if (document.evaluate) {
		getElementsByClassName = function (className, tag, elm) {
			tag = tag || "*";
			elm = elm || document;
			var classes = className.split(" "),
				classesToCheck = "",
				xhtmlNamespace = "http://www.w3.org/1999/xhtml",
				namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
				returnElements = [],
				elements,
				node;
			for(var j=0, jl=classes.length; j<jl; j+=1){
				classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
			}
			try	{
				elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
			}
			catch (e) {
				elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
			}
			while ((node = elements.iterateNext())) {
				returnElements.push(node);
			}
			return returnElements;
		};
	}
	else {
		getElementsByClassName = function (className, tag, elm) {
			tag = tag || "*";
			elm = elm || document;
			var classes = className.split(" "),
				classesToCheck = [],
				elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
				current,
				returnElements = [],
				match;
			for(var k=0, kl=classes.length; k<kl; k+=1){
				classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
			}
			for(var l=0, ll=elements.length; l<ll; l+=1){
				current = elements[l];
				match = false;
				for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
					match = classesToCheck[m].test(current.className);
					if (!match) {
						break;
					}
				}
				if (match) {
					returnElements.push(current);
				}
			}
			return returnElements;
		};
	}
	return getElementsByClassName(className, tag, elm);
};

function SetActiveMenu()
{
    
    try
    {
    var menuDiv = getElementsByClassName('left_nav');
       var locHref =  new String(location.href.toString());
    
       
    var menuUL = menuDiv[0].getElementsByTagName('ul')[1];
    var  liList = menuUL.getElementsByTagName('li')
    
    for (var i =0; i < liList.length; i++)
    {
        var atag = liList[i].getElementsByTagName('a');
        var hrefstring = new String(atag[0].href)
       
        
        if ( hrefstring.toLowerCase() == locHref.toLowerCase())
        {
        
            var imgTag1 = atag[0].getElementsByTagName('img')[0];
            var imgTag2 = atag[0].getElementsByTagName('img')[1]; 
            
            imgTag1.style.display = 'none';
            imgTag2.style.display = '';
        }
    }
    }
    catch(e)
    {
    //alert(e);
    }
    
}