function toggle(id){
    ul = "ul_" + id;
    img = "img_" + id;
    ulElement = document.getElementById(ul);
    imgElement = document.getElementById(img);
    if (ulElement){
            if (ulElement.className == 'closed'){
                    ulElement.className = "open";
                    imgElement.src = "opened.gif";
                    }else{
                    ulElement.className = "closed";
                    imgElement.src = "closed.gif";
                    }
            }
    }
	

function ToggleMenu(objectID) {
	var object1 = document.getElementById(objectID);
	var object2 = document.getElement
	
	if (object1.className == 'sub_menu_close')
	{
		object1.className = "sub_menu_open";
		
	}
	else
	{
			object1.className = "sub_menu_close";
			
	}
}

function CloseSubMenu(id_1,id_2) {
	
	var SubMenu1 = "sub_" + id_1;
	var SubMenu2 = "sub_" + id_2;
	
	var ObjectId1 = document.getElementById(id_1);
	var SubObjectId1 = document.getElementById(SubMenu1);
	
	var ObjectId2 = document.getElementById(id_2);
	var SubObjectId2 = document.getElementById(SubMenu2);
	
		
	ObjectId1.className = "menu"
	SubObjectId1.className = "sub_menu_close";
	
	ObjectId2.className = "menu"
	SubObjectId2.className = "sub_menu_close";
}


function ToggleMenu3(objectToActive, objectToClose) {
	
	var SubMenu = "sub_" + objectToActive;
	var SubMenuClose = "sub_" + objectToClose;
	
	var object1 = document.getElementById(objectToActive);
	var object2 = document.getElementById(SubMenu);
	
	var ObjectClose = document.getElementById(objectToClose);
	var SubObjectClose = document.getElementById(SubMenuClose);
	
		
	if (object2.className == 'sub_menu_close')
	{
		object2.className = "sub_menu_open";
		object1.className = "menu_selected";
	}
	else
	{
			
			object2.className = "sub_menu_close";
			object1.className = "menu";
	}
	
	ObjectClose.className = "menu"
	SubObjectClose.className = "sub_menu_close";
}

/*** swap image***/
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 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_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

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];}
}

/*** dynamic data ***/

function cascadedstyle(el, cssproperty, csspropertyNS){
if (el.currentStyle)
return el.currentStyle[cssproperty]
else if (window.getComputedStyle){
var elstyle=window.getComputedStyle(el, "")
return elstyle.getPropertyValue(csspropertyNS)
}
}

var previoustab=""

function expandcontent(cid){
if (document.getElementById){
//highlighttab(aobject)
//detectSourceindex(aobject)
if (previoustab!="")
document.getElementById(previoustab).style.display="none"
document.getElementById(cid).style.display="block"
previoustab=cid

obj = document.getElementById("larry_link");
if (cid == "larry_track")
{
	obj.style.display="none";
}
else
{
	obj.style.display="block";
}

//if (aobject.blur)
//aobject.blur()
//return false
}
//else
//return true
}

function ShowLarry(id,current_id){
obj = document.getElementById(id)
obj.style.display="block";
}

function highlighttab(aobject){
if (typeof tabobjlinks=="undefined")
collecttablinks()
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].style.backgroundColor=initTabcolor
var themecolor=aobject.getAttribute("theme")? aobject.getAttribute("theme") : initTabpostcolor
aobject.style.backgroundColor=document.getElementById("tabcontentcontainer").style.backgroundColor=themecolor
}

function collecttablinks(){
var tabobj=document.getElementById("tablist")
tabobjlinks=tabobj.getElementsByTagName("A")
}

function detectSourceindex(aobject){
for (i=0; i<tabobjlinks.length; i++){
if (aobject==tabobjlinks[i]){
tabsourceindex=i //source index of tab bar relative to other tabs
break
}
}
}

function do_onload(){
var cookiename=(typeof persisttype!="undefined" && persisttype=="sitewide")? "dynamic_content" : window.location.pathname
var cookiecheck=window.get_cookie && get_cookie(cookiename).indexOf("|")!=-1
collecttablinks()
initTabcolor=cascadedstyle(tabobjlinks[1], "backgroundColor", "background-color")
initTabpostcolor=cascadedstyle(tabobjlinks[0], "backgroundColor", "background-color")
if (typeof enablepersistence!="undefined" && enablepersistence && cookiecheck){
var cookieparse=get_cookie(cookiename).split("|")
var whichtab=cookieparse[0]
var tabcontentid=cookieparse[1]
expandcontent(tabcontentid, tabobjlinks[whichtab])
}
else
expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
}


/***** open window******/

function OpenInfoWin(theURL,NewName, features){
	myWindow = window.open(theURL, NewName, features);
	myWindow.document.write("<TITLE>" + NewName + "</TITLE>");
	myWindow.document.write("<img src=" + theURL + " border='0'/>");
	myWindow.document.close() 
}

function OpenInfoSnackWin(theURL,NewName, features){
	myWindow = window.open(theURL, NewName, features);
	myWindow.document.write("<TITLE> TRACK SNACKS :: " + NewName + "</TITLE>");
	myWindow.document.write("<img src=" + theURL + " border='0'/>");
	myWindow.document.close() 
}


function OpenScdWin(theURL,NewName, features){
	myWindow = window.open(theURL, NewName, features);
	myWindow.document.close();
}


