1//** Tab Content script- ?Dynamic Drive DHTML code library (http://www.dynamicdrive.com) 2//** Last updated: Nov 8th, 06 3 4var enabletabpersistence=0 //enable tab persistence via session only cookies, so selected tab is remembered? 5 6////NO NEED TO EDIT BELOW//////////////////////// 7var tabcontentIDs=new Object() 8 9function expandcontent(linkobj){ 10var ulid=linkobj.parentNode.parentNode.id //id of UL element 11var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents 12for (var i=0; i<ullist.length; i++){ 13ullist[i].className="" //deselect all tabs 14if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents) 15document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents 16} 17linkobj.parentNode.className="selected" //highlight currently clicked on tab 18document.getElementById(linkobj.getAttribute("rel")).style.display="block" //expand corresponding tab content 19saveselectedtabcontentid(ulid, linkobj.getAttribute("rel")) 20} 21 22function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content) 23var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber] 24if (thetab.getAttribute("rel")) 25expandcontent(thetab) 26} 27 28function savetabcontentids(ulid, relattribute){// save ids of tab content divs 29if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet 30tabcontentIDs[ulid]=new Array() 31tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute 32} 33 34function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie 35if (enabletabpersistence==1) //if persistence feature turned on 36setCookie(ulid, selectedtabid) 37} 38 39function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content 40var ullist=document.getElementById(ulid).getElementsByTagName("li") 41for (var i=0; i<ullist.length; i++){ 42if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){ 43return ullist[i].getElementsByTagName("a")[0] 44break 45} 46} 47} 48 49function initializetabcontent(){ 50for (var i=0; i<arguments.length; i++){ //loop through passed UL ids 51if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off 52setCookie(arguments[i], "") 53var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any 54var ulobj=document.getElementById(arguments[i]) 55var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL 56for (var x=0; x<ulist.length; x++){ //loop through each LI element 57var ulistlink=ulist[x].getElementsByTagName("a")[0] 58if (ulistlink.getAttribute("rel")){ 59savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs 60ulistlink.onclick=function(){ 61expandcontent(this) 62return false 63} 64if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default 65expandcontent(ulistlink) //auto load currenly selected tab content 66} 67} //end inner for loop 68if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value 69var culistlink=getullistlinkbyId(arguments[i], clickedontab) 70if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value 71expandcontent(culistlink) //auto load currenly selected tab content 72else //else if no match found between tabcontent id and rel attribute value (cookie mis-association) 73expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead 74} 75} //end outer for loop 76} 77 78 79function getCookie(Name){ 80var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair 81if (document.cookie.match(re)) //if cookie found 82return document.cookie.match(re)[0].split("=")[1] //return its value 83return "" 84} 85 86function setCookie(name, value){ 87document.cookie = name+"="+value //cookie value is domain wide (path=/) 88}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.