1//** Tab Content script- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com) 2//** Last updated: June 29th, 06 3 4var enabletabpersistence=1 //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 savetabcontentids(ulid, relattribute){// save ids of tab content divs 23if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet 24tabcontentIDs[ulid]=new Array() 25tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute 26} 27 28function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie 29if (enabletabpersistence==1) //if persistence feature turned on 30setCookie(ulid, selectedtabid) 31} 32 33function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content 34var ullist=document.getElementById(ulid).getElementsByTagName("li") 35for (var i=0; i<ullist.length; i++){ 36if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){ 37return ullist[i].getElementsByTagName("a")[0] 38break 39} 40} 41} 42 43function initializetabcontent(){ 44for (var i=0; i<arguments.length; i++){ //loop through passed UL ids 45if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off 46setCookie(arguments[i], "") 47var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any 48var ulobj=document.getElementById(arguments[i]) 49var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL 50for (var x=0; x<ulist.length; x++){ //loop through each LI element 51var ulistlink=ulist[x].getElementsByTagName("a")[0] 52if (ulistlink.getAttribute("rel")){ 53savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs 54ulistlink.onclick=function(){ 55expandcontent(this) 56return false 57} 58if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default 59expandcontent(ulistlink) //auto load currenly selected tab content 60} 61} //end inner for loop 62if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value 63var culistlink=getullistlinkbyId(arguments[i], clickedontab) 64if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value 65expandcontent(culistlink) //auto load currenly selected tab content 66else //else if no match found between tabcontent id and rel attribute value (cookie mis-association) 67expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead 68} 69} //end outer for loop 70} 71 72 73function getCookie(Name){ 74var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair 75if (document.cookie.match(re)) //if cookie found 76return document.cookie.match(re)[0].split("=")[1] //return its value 77return "" 78} 79 80function setCookie(name, value){ 81document.cookie = name+"="+value //cookie value is domain wide (path=/) 82}
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.