


/***********************************************


* Switch Menu script- by Martial B of http://getElementById.com/


* Modified by Dynamic Drive for format & NS4/IE4 compatibility


* Visit http://www.dynamicdrive.com/ for full source code


***********************************************/




/*
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)

var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only





if (document.getElementById){ //DynamicDrive.com change


document.write('<style type="text/css">\n')


document.write('.submenu{display: none;}\n')


document.write('</style>\n')


}





function SwitchMenu(obj){


   if(document.getElementById){


   var el = document.getElementById(obj);


   var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change


      if(el.style.display != "block"){ //DynamicDrive.com change


         for (var i=0; i<ar.length; i++){


            if (ar[i].className=="submenu") //DynamicDrive.com change


            ar[i].style.display = "none";


         }


         el.style.display = "block";


      }else{


         el.style.display = "none";


      }


   }


}





function get_cookie(Name) {


var search = Name + "="


var returnvalue = "";


if (document.cookie.length > 0) {


offset = document.cookie.indexOf(search)


if (offset != -1) {


offset += search.length


end = document.cookie.indexOf(";", offset);


if (end == -1) end = document.cookie.length;


returnvalue=unescape(document.cookie.substring(offset, end))


}


}


return returnvalue;


}





function onloadfunction(){


if (persistmenu=="yes"){


var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname


var cookievalue=get_cookie(cookiename)


if (cookievalue!="")


document.getElementById(cookievalue).style.display="block"


}


}





function savemenustate(){


var inc=1, blockid=""


while (document.getElementById("sub"+inc)){


if (document.getElementById("sub"+inc).style.display=="block"){


blockid="sub"+inc


break


}


inc++


}


var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname


var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid


document.cookie=cookiename+"="+cookievalue


}





if (window.addEventListener)


window.addEventListener("load", onloadfunction, false)


else if (window.attachEvent)


window.attachEvent("onload", onloadfunction)


else if (document.getElementById)


window.onload=onloadfunction





if (persistmenu=="yes" && document.getElementById)


window.onunload=savemenustate

var check_n = 0;
var old_data = "--";

function refresh_cb(new_data) {
    if (new_data != old_data) {
        document.getElementById("wall").innerHTML = new_data;
        setTimeout("refresh()", 1000);
        old_data = new_data;
    } else {
        setTimeout("refresh()", 2500);
    }
    document.getElementById("status").innerHTML = "Checked #" + check_n++;
}

function refresh() {
    document.getElementById("status").innerHTML = "Checking..";
    x_refresh(refresh_cb);
}

function add_cb() {
    // we don't care..
}

function addWall() {
    var line;
    var handle;
    handle = document.getElementById("handle").value;
    line = document.getElementById("line").value;
    if (line == "")
        return;
    sajax_request_type = "POST";
    x_add_line("[" + handle + "] " + line, add_cb);
    document.getElementById("line").value = "";
}
*/

//** Tab Content script- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Last updated: Nov 8th, 06



var enabletabpersistence=0 //enable tab persistence via session only cookies, so selected tab is remembered?

////NO NEED TO EDIT BELOW////////////////////////
var tabcontentIDs=new Object()

function expandcontent(linkobj){
var ulid=linkobj.parentNode.parentNode.id //id of UL element
var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents
for (var i=0; i<ullist.length; i++){
ullist[i].className=""  //deselect all tabs
if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)
document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents
}
linkobj.parentNode.className="selected"  //highlight currently clicked on tab
document.getElementById(linkobj.getAttribute("rel")).style.display="block" //expand corresponding tab content
saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))
}

function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content)
var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
if (thetab.getAttribute("rel"))
expandcontent(thetab)
}

function savetabcontentids(ulid, relattribute){// save ids of tab content divs
if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet
tabcontentIDs[ulid]=new Array()
tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute
}

function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie
if (enabletabpersistence==1) //if persistence feature turned on
setCookie(ulid, selectedtabid)
}

function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content
var ullist=document.getElementById(ulid).getElementsByTagName("li")
for (var i=0; i<ullist.length; i++){
if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){
return ullist[i].getElementsByTagName("a")[0]
break
}
}
}

function initializetabcontent(){
for (var i=0; i<arguments.length; i++){ //loop through passed UL ids
if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off
setCookie(arguments[i], "")
var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any
var ulobj=document.getElementById(arguments[i])
var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL
for (var x=0; x<ulist.length; x++){ //loop through each LI element
var ulistlink=ulist[x].getElementsByTagName("a")[0]
if (ulistlink.getAttribute("rel")){
savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs
ulistlink.onclick=function(){
expandcontent(this)
return false
}
if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default
expandcontent(ulistlink) //auto load currenly selected tab content
}
} //end inner for loop
if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value
var culistlink=getullistlinkbyId(arguments[i], clickedontab)
if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value
expandcontent(culistlink) //auto load currenly selected tab content
else //else if no match found between tabcontent id and rel attribute value (cookie mis-association)
expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead
}
} //end outer for loop
}


function getCookie(Name){
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 ""
}

function setCookie(name, value){
document.cookie = name+"="+value //cookie value is domain wide (path=/)
}




