﻿// JScript source code



// JScript File



var padding = '10';

var paddingBottom = '10';



var currentItem = 'null';

var currentImage = 'null';



function CreateMenuItem(id, text, link, target)

{
	var textId = 'text' + id;

   var imgId = 'img' + id;

   var subId = 'sub' + id;

   var subTotalId = 'subTotal' + id;

   

   document.write("<table border='0' cellspacing='0' cellpadding='0' style='width: 150px;' ><tr>");

   document.write("<td>");

   document.write("<a href='#' onfocus='this.blur()' onmouseover=javascript:OnMouseOverItem('" + subTotalId + "','" + imgId + "') onmouseout=javascript:OnMouseOutItem('" + subTotalId + "','" + imgId + "') onclick=javascript:ToggleItem('" + subTotalId + "','" + imgId + "','" + textId + "')><img id='" + imgId + "' src='img/collapsed.jpg' width='16' height='18' border='0' /></a>");

   document.write("</td>");

   document.write("<td style='padding-left: " + padding + "px; width: 150px;'>");

   document.write("<a id='" + textId + "' class='MainMenuItem' href='" + link + "' target='" + target + "' onmouseover=javascript:OnMouseOverItem('" + subTotalId + "','" + imgId + "') onmouseout=javascript:OnMouseOutItem('" + subTotalId + "','" + imgId + "') onclick=javascript:ToggleItem('" + subTotalId + "','" + imgId + "','" + textId + "')>" + text + "</a>");

   document.write("</td>");

   document.write("</tr></table>");



   document.write("<table id='" + subTotalId + "' border='0' cellspacing='0' cellpadding='0' style='display: none;'><tr><td>");

   document.write("<table id='" + subId + "'border='0' cellspacing='0' cellpadding='0'></table>");

   document.write("</td></tr><tr><td style='height: " + paddingBottom + "px;'></td></tr></table>");

}



function CreateSubMenuItem(parent, id, text, link, target)

{

   var parentId = 'sub' + parent;

   var imgId = 'img' + id;

   var object = document.getElementById(parentId);

   

   if (navigator.appName == 'Microsoft Internet Explorer')

   {

        var TR = object.insertRow();

        var imgTD = TR.insertCell();

        var txtTD = TR.insertCell();
        

        imgTD.innerHTML = "<a href='" + link + "' target='" + target + "' onmouseover=javascript:OnMouseOverSubItem('" + imgId + "') onmouseout=javascript:OnMouseOutSubItem('" + imgId + "') ><img id='" + imgId + "' src='img/blind_1px.gif' width='16' height='18' border='0' /></a>";

        txtTD.style.padding = "0 0 0 " + padding;
 
		txtTD.innerHTML += "<div id='ll_" + id + "'><a class='SubMenuItem' href='" + link + "' target='" + target + "' onmouseover=javascript:OnMouseOverSubItem('" + imgId + "') onmouseout=javascript:OnMouseOutSubItem('" + imgId + "') onclick=javascript:OnFocusItem('" + id + "') >" + text + "</a></div>";
	}

   else

   {

        document.getElementById(parentId).innerHTML += "<tr><td><a href='" + link + "'  target='" + target + "' onmouseover=javascript:OnMouseOverSubItem('" + imgId + "') onmouseout=javascript:OnMouseOutSubItem('" + imgId + "') ><img id='" + imgId + "' src='img/blind_1px.gif' width='16' height='18' border='0' /></a></td><td style='padding-left: " + padding + "px'><div id='ll_" + id + "'><a class='SubMenuItem' href='" + link + "' target='" + target + "' onmouseover=javascript:OnMouseOverSubItem('" + imgId + "') onmouseout=javascript:OnMouseOutSubItem('" + imgId + "') onclick=javascript:OnFocusItem('" + id + "') >" + text + "</a></div></td></tr>";

   }

}

/*
function CreateLinkItem(id, text, url)
{
	var imgId = 'img' + id;
	var linkId = 'link' + id;

   document.write("<table border='0' cellspacing='0' cellpadding='0' style='width: 150px;' ><tr>");
   document.write("<td>");
   document.write("<img id='" + imgId + "' src='collapsed.jpg' width='16' height='18' border='0' />");
   document.write("</td>");
   document.write("<td style='padding-left: " + padding + "px; width: 150px;'>");
   document.write("<a id='" + linkId + "' class='LinkItem' href='#' target='content' onclick=javascript:OnClick('" + linkId + "','" + url + "') onmouseover=javascript:OnMouseOverLinkItem('" + imgId + "') onmouseout=javascript:OnMouseOutLinkItem('" + imgId + "') >" + text + "</a>");
   document.write("</td>");
   document.write("</tr></table>");
}
*/

function CreateLinkItem(id, text, url)
{
	var imgId = 'img' + id;
	var linkId = 'link' + id;

   document.write("<table border='0' cellspacing='0' cellpadding='0' style='width: 150px;' ><tr>");
   document.write("<td>");
   document.write("<img id='" + imgId + "' src='img/collapsed.jpg' width='16' height='18' border='0' />");
   document.write("</td>");
   document.write("<td style='padding-left: " + padding + "px; width: 150px;'>");
    document.write("<a id='" + linkId + "' class='LinkItem' href='#' target='content' onclick=javascript:OnClick('" + linkId + "','" + url + "') onmouseover=javascript:OnMouseOverLinkItem('" + imgId + "') onmouseout=javascript:OnMouseOutLinkItem('" + imgId + "') >" + text + "</a>");
	document.write("</td>");
   document.write("</tr></table>");

}


function ToggleItem(selectedItem, image, textItem)
{
	var text = document.getElementById(textItem);
    var item = document.getElementById(selectedItem);
    var img = document.getElementById(image);
	
    if (currentItem != 'null' && currentItem != selectedItem)
    {
		document.getElementById(currentItem).style.display = 'none';
		document.getElementById(currentImage).src = 'img/collapsed.jpg';
    }

    if (item.style.display == 'none')
    {
        item.style.display = 'inline';
        img.src = 'img/expanded_active.jpg';
		currentItem = selectedItem;
		currentImage = image;
    }
    else
    {
        item.style.display = 'none';
		/* text.style.color = '#333333'; */
        img.src = 'img/collapsed_active.jpg';
		currentItem = 'null';
		currentImage = 'null';
    }
}



function OnMouseOverItem(subMenuVisible, item)

{

    if (document.getElementById(subMenuVisible).style.display == 'none')

    {

        document.getElementById(item).src = 'img/collapsed_active.jpg';

    }

    else

    {

        document.getElementById(item).src = 'img/expanded_active.jpg';

    }

}



function OnMouseOutItem(subMenuVisible, item)

{

    if (document.getElementById(subMenuVisible).style.display == 'none')

    {

        document.getElementById(item).src = 'img/collapsed.jpg';

    }

    else

    {

        document.getElementById(item).src = 'img/expanded.jpg';

    }

}



function OnMouseOverSubItem(item)

{

    document.getElementById(item).src = 'img/blind_1px.gif';

}



function OnMouseOutSubItem(item)

{
	if (item != null)
		document.getElementById(item).src = 'img/blind_1px.gif';

}



function OnMouseOverLinkItem(item)

{

	if (item != null)
		document.getElementById(item).src = 'img/collapsed_active.jpg';

}



function OnMouseOutLinkItem(item)

{
	if (item != null)
		document.getElementById(item).src = 'img/collapsed.jpg';

}



function OnClick(linkItem, url)
{
    if (currentItem != 'null' && currentItem != linkItem)
    {
	document.getElementById(currentItem).style.display = 'none';
	document.getElementById(currentImage).src = 'img/collapsed.jpg';
    }

    document.getElementById(linkItem).href = url;	
}

function OnFocusItem(id)
{
}

