﻿var bustcachevar=1,loadstatustext="<img src='images/loadingsmall.gif' /> Requesting content...",enabletabpersistence=1,loadedobjects="",defaultcontentarray={},bustcacheparameter="";function ajaxpage(c,b,e){var a=false;if(window.XMLHttpRequest)a=new XMLHttpRequest;else if(window.ActiveXObject)try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(g){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(h){}}else return false;var f=e.parentNode.parentNode.getElementsByTagName("li");for(var d=0;d<f.length;d++)f[d].className="";e.parentNode.className="selected";if(c.indexOf("#default")!=-1){document.getElementById(b).innerHTML=defaultcontentarray[b];return}document.getElementById(b).innerHTML=loadstatustext;a.onreadystatechange=function(){loadpage(a,b)};if(bustcachevar)bustcacheparameter=c.indexOf("?")!=-1?"&"+(new Date).getTime():"?"+(new Date).getTime();a.open("GET",c+bustcacheparameter,true);a.send(null)}function loadpage(a,b){if(a.readyState==4&&(a.status==200||window.location.href.indexOf("http")==-1))document.getElementById(b).innerHTML=a.responseText}function loadobjs(c){if(c!=null&&c!=""){var e=c.split(/\s*,\s*/);for(var d=0;d<e.length;d++){var b=e[d],a="";if(loadedobjects.indexOf(b)==-1)if(b.indexOf(".js")!=-1){a=document.createElement("script");a.setAttribute("type","text/javascript");a.setAttribute("src",b)}else if(b.indexOf(".css")!=-1){a=document.createElement("link");a.setAttribute("rel","stylesheet");a.setAttribute("type","text/css");a.setAttribute("href",b)}if(a!=""){document.getElementsByTagName("head").item(0).appendChild(a);loadedobjects+=b+" "}}}}function expandtab(b,c){var a=document.getElementById(b).getElementsByTagName("a")[c];if(a.getAttribute("rel")){ajaxpage(a.getAttribute("href"),a.getAttribute("rel"),a);loadobjs(a.getAttribute("rev"))}}function savedefaultcontent(a){if(typeof defaultcontentarray[a]=="undefined")defaultcontentarray[a]=document.getElementById(a).innerHTML}function startajaxtabs(){for(var d=0;d<arguments.length;d++){var g=document.getElementById(arguments[d]),c=g.getElementsByTagName("li"),e=enabletabpersistence==1?parseInt(getCookie(arguments[d])):"",h=e<c.length?true:false;for(var b=0;b<c.length;b++){var a=c[b].getElementsByTagName("a")[0];a.index=b;if(a.getAttribute("rel")){var f=a.getAttribute("href").replace(/^http:\/\/[^\/]+\//i,"http://"+window.location.hostname+"/");a.setAttribute("href",f);savedefaultcontent(a.getAttribute("rel"));a.onclick=function(){ajaxpage(this.getAttribute("href"),this.getAttribute("rel"),this);loadobjs(this.getAttribute("rev"));saveselectedtabindex(this.parentNode.parentNode.id,this.index);return false};if(enabletabpersistence==1&&e<c.length&&b==e||enabletabpersistence==0&&c[b].className=="selected"){ajaxpage(a.getAttribute("href"),a.getAttribute("rel"),a);loadobjs(a.getAttribute("rev"))}}}}}function saveselectedtabindex(b,a){if(enabletabpersistence==1)setCookie(b,a)}function getCookie(b){var a=new RegExp(b+"=[^;]+","i");if(document.cookie.match(a))return document.cookie.match(a)[0].split("=")[1];return ""}function setCookie(b,a){document.cookie=b+"="+a}