	var iTop = 115;
		
	function uniqueID(){
		var id = (new Date()).getTime();
		id += Math.random().toString().replace(/\./,"");
		return id;
	}
	function getCookie(name){
		var start = document.cookie.indexOf(name+"=");
		var len = start+name.length+1;
		if ((!start)&&(name != document.cookie.substring(0,name.length))){
			return null;
		}
		if (start == -1){
			return null;
		}
		var end = document.cookie.indexOf(";",len);
		if (end == -1){
			end = document.cookie.length;
		}
		return unescape(document.cookie.substring(len,end));
	}
	function setCookie(name, value, expires, path, domain, secure){
		document.cookie = name + "=" + escape(value) +
			( (expires) ? ";expires=" + expires.toGMTString() : "") +
			( (path) ? ";path=" + path : "") +
			( (domain) ? ";domain=" + domain : "") +
			( (secure) ? ";secure" : "");
	}
	var today = new Date();
	var dAdd = new Date(today.getTime() + (365 * 86400000));
	if (getCookie('userID') != null){
		setCookie('userID', getCookie('userID'), dAdd);
	}
	else{
		setCookie('userID', uniqueID(), dAdd);
	}
	if (getCookie('sessionID') == null){
		setCookie('sessionID', uniqueID());
	}
	function IsNumeric(sText){
		var ValidChars = "0123456789.";
		var IsNumber=true;
		var Char;
		for (i = 0; i < sText.length && IsNumber == true; i++){ 
		    Char = sText.charAt(i); 
			if (ValidChars.indexOf(Char) == -1){
		        IsNumber = false;
        	}
		}
		return IsNumber;   
	}
	function goToURL(sel){
		if (sel.options[sel.selectedIndex].value != ''){
			window.location.href = sel.options[sel.selectedIndex].value;
		}
	}
	function getNumber(sID){
		if (sID.indexOf('firstlink') != -1){			
			return sID.substr((sID.indexOf('firstlink') + 9), sID.length);			
		}
		if (sID.indexOf('divFirstLink') != -1){
			return sID.substr((sID.indexOf('divFirstLink') + 12), sID.length);			
		}
		else{
			return sID.substr((sID.indexOf('second') + 6), sID.length);
		}
	}
	function previousPipe(obj, s){
		var objSibling = obj.previousSibling;
		while (objSibling && objSibling.nodeType != 1) {
			objSibling = objSibling.previousSibling;1
		}
		setSibling(objSibling, s);
	}
	function nextPipe(obj, s){
		var objSibling = obj.nextSibling;
		while (objSibling && objSibling.nodeType != 1) {
			objSibling = objSibling.nextSibling;
		}
		setSibling(objSibling, s);
	}
	function setSibling(objSibling, s){
		if (objSibling){
			if (objSibling.id.indexOf('pipe') != -1){
				objSibling.className = s;
			}
		}
	}
	function showMenu(sID){
		var iID = getNumber(sID);
		if (activefirstlevel != -1){
			document.getElementById('firstlink' + activefirstlevel).className = 'firstOver';
			if (iID != activefirstlevel){
				document.getElementById('second' + activefirstlevel).className = 'secondlevelDiv';
				document.getElementById('first' + activefirstlevel).className = 'firstLevelSelOff';
			}
		}
		var objParent = document.getElementById('first' + iID);
		var objChild = document.getElementById('second' + iID);
		objParent.className = 'firstLevelOver';
		document.getElementById('firstlink' + iID).className = 'firstOver';
		objChild.className = 'secondlevelDivShow';
		objChild.style.left = 30;
		objChild.style.top = (document.getElementById('tblLayer2Background').offsetTop - 10);
		previousPipe(objParent, 'pipeOver');
		nextPipe(objParent, 'pipeOver');
	}
	function hideMenu(sID){		
		var iID = getNumber(sID);		
		if (iID != activefirstlevel){
			document.getElementById('first' + iID).className = 'firstLevelOff';
			document.getElementById('firstlink' + iID).className = 'first';
			document.getElementById('second' + iID).className = 'secondlevelDiv';
			previousPipe(document.getElementById('first' + iID), 'pipe');
			nextPipe(document.getElementById('first' + iID), 'pipe');
		}
		if (activefirstlevel != -1){
			document.getElementById('first' + activefirstlevel).className = 'firstLevelOver';
			document.getElementById('second' + activefirstlevel).className = 'secondlevelDivShow';
			previousPipe(document.getElementById('first' + activefirstlevel), 'pipeOver');
			nextPipe(document.getElementById('first' + activefirstlevel), 'pipeOver');
		}		
	}
	function innit(){		
		if (activefirstlevel > -1){
			showMenu('first' + activefirstlevel);
			if (activesecondlevel != -1){
				document.getElementById('second' + activefirstlevel + '-' + activesecondlevel).className = 'secondlevelSel';
			}
		}
	}
	function resetChildTop(){
		if (document.getElementById('second' + activefirstlevel)){
			document.getElementById('second' + activefirstlevel).style.top = (document.getElementById('tblLayer2Background').offsetTop - 10);
		}
	}

/**
 * List functions allow exanding/collapsing long lists on mouse click. To use them we have to prefix all expandable
 * items with LIST_PREFIX-realID. All list titles (where user would click the mouse) need to have the id={LIST_PREFIX}-realID-title.
 * Define LIST_PREFIX, and call initLists() in your code to enable this feature.
 */
//define images for expanded and collapsed states
var strImageExpanded = "<img alt=\"Click to collapse\" hspace=\"1\" border=\"0\" src=\"/images/minus.gif\"/>"
var strImageCollapsed = "<img alt=\"Click to expand\" hspace=\"1\" border=\"0\" src=\"/images/plus.gif\"/>"
/**
 * The Lists have to be wrapped in a div having id starting with globally defined variable: LIST_PREFIX
 */
function initLists()
{
	if (!LIST_PREFIX) return;
	changeLists(LIST_PREFIX, null);
}
/**
 * Depending on action parameter, this function locates all elements prefixed with idPrefix and 
 * its' title ( element with id {idPrefix}-title ).
 * If action is null (called on init) it defines variable expanded on divs, and attaches image and onclick event on title.
 *
 * @param idPrefix - prefix of the div id containing the list (  is the name of the title
 * @param action - string containing "expand", "collapse" or null.
 * 
 */
function changeLists(idPrefix, action)
{
	if (!idPrefix) return;
	var allDivElements = document.getElementsByTagName("div");
	if (allDivElements == null) allDivElements = document.all;
	if (!allDivElements) return;
	//attach onmouse event and collapse as default
	for (var i=0; i<allDivElements.length; i++)
	{
		var id= allDivElements[i].id;
		if (id.indexOf(idPrefix) == 0)
		{
			//find the title element and add image to it
			var objTitle = document.getElementById(id+"-title");
			if (objTitle)
			{
				if (!action)
				{
					//define boolean variable expanded on divs
					allDivElements[i].expanded = true;
					objTitle.onclick=function() { toggleDiv(this); };
					objTitle.style.cursor = "pointer";
					collapseDiv(allDivElements[i], objTitle);
				}
				else if (action == "expand")
				{
					expandDiv(allDivElements[i], objTitle, true);
				}
				else if (action == "collapse")
				{
					collapseDiv(allDivElements[i], objTitle);
				}
			}
		}
	}
}
function toggleDiv(objTitle)
{
	var titleID = objTitle.id;
	//be on the "safe" side
	if (titleID.indexOf("title") < 6) return;
	var objDiv = document.getElementById(titleID.substring(0, titleID.length - 6));
	if (!objDiv) return;
	if (objDiv.expanded == true)
		collapseDiv(objDiv, objTitle);
	else
		expandDiv(objDiv, objTitle);
}
function expandDiv(objDiv, objTitle, bSkipCollapseAll)
{
	//collapse all lists first
	if (!bSkipCollapseAll)
		collapseAll();
	if (objDiv.expanded == true) return;
	//make the list visible
	objDiv.style.display = "block";
	objDiv.expanded = true;
	//change title image to expanded
	objTitle.innerHTML = strImageExpanded + " " + objTitle.innerHTML.substring(objTitle.innerHTML.indexOf("> ") + 2);
}
function collapseDiv(objDiv, objTitle)
{
	if (objDiv.expanded == false) return;
	//make items visible
	objDiv.style.display = "none";
	objDiv.expanded = false;
	//change image on the title
	if (objTitle.innerHTML.toLowerCase().indexOf("<img ") == -1)
		//just add the image
		objTitle.innerHTML = strImageCollapsed + " " + objTitle.innerHTML;
	else
		//change title image to collapsed
		objTitle.innerHTML = strImageCollapsed +" " + objTitle.innerHTML.substring(objTitle.innerHTML.indexOf("> ") + 2);
}
function collapseAll()
{
	changeLists(LIST_PREFIX, "collapse");
}
function expandAll()
{
	changeLists(LIST_PREFIX, "expand");
}
/**
 * End expandable/collapsable list functions
 */
 
 var persisteduls=new Object()
var ddtreemenu=new Object()

//ddtreemenu.closefolder="images/closed.gif" //set image path to "closed" folder image
//ddtreemenu.openfolder="images/open.gif" //set image path to "open" folder image

//////////No need to edit beyond here///////////////////////////

ddtreemenu.createTree=function(treeid, enablepersist, persistdays){
var ultags=document.getElementById(treeid).getElementsByTagName("ul")
if (typeof persisteduls[treeid]=="undefined")
persisteduls[treeid]=(enablepersist==true && ddtreemenu.getCookie(treeid)!="")? ddtreemenu.getCookie(treeid).split(",") : ""
for (var i=0; i<ultags.length; i++)
ddtreemenu.buildSubTree(treeid, ultags[i], i)
if (enablepersist==true){ //if enable persist feature
var durationdays=(typeof persistdays=="undefined")? 1 : parseInt(persistdays)
ddtreemenu.dotask(window, function(){ddtreemenu.rememberstate(treeid, durationdays)}, "unload") //save opened UL indexes on body unload
}
}

ddtreemenu.buildSubTree=function(treeid, ulelement, index){
ulelement.parentNode.className="submenu"
if (typeof persisteduls[treeid]=="object"){ //if cookie exists (persisteduls[treeid] is an array versus "" string)
if (ddtreemenu.searcharray(persisteduls[treeid], index)){
ulelement.setAttribute("rel", "open")
ulelement.style.display="block"
ulelement.parentNode.style.backgroundImage="url("+ddtreemenu.openfolder+")"
}
else
ulelement.setAttribute("rel", "closed")
} //end cookie persist code
else if (ulelement.getAttribute("rel")==null || ulelement.getAttribute("rel")==false) //if no cookie and UL has NO rel attribute explicted added by user
ulelement.setAttribute("rel", "closed")
else if (ulelement.getAttribute("rel")=="open") //else if no cookie and this UL has an explicit rel value of "open"
ddtreemenu.expandSubTree(treeid, ulelement) //expand this UL plus all parent ULs (so the most inner UL is revealed!)
ulelement.parentNode.onclick=function(e){
var submenu=this.getElementsByTagName("ul")[0]
if (submenu.getAttribute("rel")=="closed"){
submenu.style.display="block"
submenu.setAttribute("rel", "open")
ulelement.parentNode.style.backgroundImage="url("+ddtreemenu.openfolder+")"
}
else if (submenu.getAttribute("rel")=="open"){
submenu.style.display="none"
submenu.setAttribute("rel", "closed")
ulelement.parentNode.style.backgroundImage="url("+ddtreemenu.closefolder+")"
}
ddtreemenu.preventpropagate(e)
}
ulelement.onclick=function(e){
ddtreemenu.preventpropagate(e)
}
}

ddtreemenu.expandSubTree=function(treeid, ulelement){ //expand a UL element and any of its parent ULs
var rootnode=document.getElementById(treeid)
var currentnode=ulelement
currentnode.style.display="block"
currentnode.parentNode.style.backgroundImage="url("+ddtreemenu.openfolder+")"
while (currentnode!=rootnode){
if (currentnode.tagName=="UL"){ //if parent node is a UL, expand it too
currentnode.style.display="block"
currentnode.setAttribute("rel", "open") //indicate it's open
currentnode.parentNode.style.backgroundImage="url("+ddtreemenu.openfolder+")"
}
currentnode=currentnode.parentNode
}
}

ddtreemenu.flatten=function(treeid, action){ //expand or contract all UL elements
var ultags=document.getElementById(treeid).getElementsByTagName("ul")
for (var i=0; i<ultags.length; i++){
ultags[i].style.display=(action=="expand")? "block" : "none"
var relvalue=(action=="expand")? "open" : "closed"
ultags[i].setAttribute("rel", relvalue)
ultags[i].parentNode.style.backgroundImage=(action=="expand")? "url("+ddtreemenu.openfolder+")" : "url("+ddtreemenu.closefolder+")"
}
}

ddtreemenu.rememberstate=function(treeid, durationdays){ //store index of opened ULs relative to other ULs in Tree into cookie
var ultags=document.getElementById(treeid).getElementsByTagName("ul")
var openuls=new Array()
for (var i=0; i<ultags.length; i++){
if (ultags[i].getAttribute("rel")=="open")
openuls[openuls.length]=i //save the index of the opened UL (relative to the entire list of ULs) as an array element
}
if (openuls.length==0) //if there are no opened ULs to save/persist
openuls[0]="none open" //set array value to string to simply indicate all ULs should persist with state being closed
ddtreemenu.setCookie(treeid, openuls.join(","), durationdays) //populate cookie with value treeid=1,2,3 etc (where 1,2... are the indexes of the opened ULs)
}

////A few utility functions below//////////////////////

ddtreemenu.getCookie=function(Name){ //get cookie value
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}

ddtreemenu.setCookie=function(name, value, days){ //set cookei value
var expireDate = new Date()
//set "expstring" to either future or past date, to set or delete cookie, respectively
var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days))
document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
}

ddtreemenu.searcharray=function(thearray, value){ //searches an array for the entered value. If found, delete value from array
var isfound=false
for (var i=0; i<thearray.length; i++){
if (thearray[i]==value){
isfound=true
thearray.shift() //delete this element from array for efficiency sake
break
}
}
return isfound
}

ddtreemenu.preventpropagate=function(e){ //prevent action from bubbling upwards
if (typeof e!="undefined")
e.stopPropagation()
else
event.cancelBubble=true
}

ddtreemenu.dotask=function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
}

function display(id)
{
	var el = document.getElementById(id);
	if(el.style.display == "none")
	{
		el.style.display = "block";
	} else
	{
		el.style.display = "none";
	}
}
