var switchcontent_ajax_msg='<em>Loading Ajax content...</em>'
var switchcontent_ajax_bustcache=true
function switchcontent(className,filtertag){this.className=className
this.collapsePrev=false
this.persistType="none"
this.filter_content_tag=(typeof filtertag!="undefined")?filtertag.toLowerCase():""
this.ajaxheaders={}}
switchcontent.prototype.setStatus=function(openHTML,closeHTML){this.statusOpen=openHTML
this.statusClosed=closeHTML}
switchcontent.prototype.setColor=function(openColor,closeColor){this.colorOpen=openColor
this.colorClosed=closeColor}
switchcontent.prototype.setPersist=function(bool,days){if(bool==true){if(typeof days=="undefined")
this.persistType="session"
else{this.persistType="days"
this.persistDays=parseInt(days)}}
else
this.persistType="none"}
switchcontent.prototype.collapsePrevious=function(bool){this.collapsePrev=bool}
switchcontent.prototype.setContent=function(index,filepath){this.ajaxheaders["header"+index]=filepath}
switchcontent.prototype.sweepToggle=function(setting){if(typeof this.headers!="undefined"&&this.headers.length>0){for(var i=0;i<this.headers.length;i++){if(setting=="expand")
this.expandcontent(this.headers[i])
else if(setting=="contract")
this.contractcontent(this.headers[i])}}}
switchcontent.prototype.defaultExpanded=function(){var expandedindices=[]
for(var i=0;(!this.collapsePrev&&i<arguments.length)||(this.collapsePrev&&i==0);i++)
expandedindices[expandedindices.length]=arguments[i]
this.expandedindices=expandedindices.join(",")}
switchcontent.prototype.togglecolor=function(header,status){if(typeof this.colorOpen!="undefined")
header.style.color=status}
switchcontent.prototype.togglestatus=function(header,status){if(typeof this.statusOpen!="undefined")
header.firstChild.innerHTML=status}
switchcontent.prototype.contractcontent=function(header){var innercontent=document.getElementById(header.id.replace("-title",""))
innercontent.style.display="none"
this.togglestatus(header,this.statusClosed)
this.togglecolor(header,this.colorClosed)}
switchcontent.prototype.expandcontent=function(header){var innercontent=document.getElementById(header.id.replace("-title",""))
if(header.ajaxstatus=="waiting"){switchcontent.connect(header.ajaxfile,header)}
innercontent.style.display="block"
this.togglestatus(header,this.statusOpen)
this.togglecolor(header,this.colorOpen)}
switchcontent.prototype.toggledisplay=function(header){var innercontent=document.getElementById(header.id.replace("-title",""))
if(innercontent.style.display=="block")
this.contractcontent(header)
else{this.expandcontent(header)
if(this.collapsePrev&&typeof this.prevHeader!="undefined"&&this.prevHeader.id!=header.id)
this.contractcontent(this.prevHeader)}
if(this.collapsePrev)
this.prevHeader=header}
switchcontent.prototype.collectElementbyClass=function(classname){var classnameRE=new RegExp("(^|\\s+)"+classname+"($|\\s+)","i")
this.headers=[],this.innercontents=[]
if(this.filter_content_tag!="")
var allelements=document.getElementsByTagName(this.filter_content_tag)
else
var allelements=document.all?document.all:document.getElementsByTagName("*")
for(var i=0;i<allelements.length;i++){if(typeof allelements[i].className=="string"&&allelements[i].className.search(classnameRE)!=-1){if(document.getElementById(allelements[i].id+"-title")!=null){this.headers[this.headers.length]=document.getElementById(allelements[i].id+"-title")
this.innercontents[this.innercontents.length]=allelements[i]}}}}
switchcontent.prototype.init=function(){var instanceOf=this
this.collectElementbyClass(this.className)
if(this.headers.length==0)
return
if(this.persistType=="days"&&(parseInt(switchcontent.getCookie(this.className+"_dtrack"))!=this.persistDays))
switchcontent.setCookie(this.className+"_d","",-1)
var opencontents_ids=(this.persistType=="session"&&switchcontent.getCookie(this.className)!="")?','+switchcontent.getCookie(this.className)+',':(this.persistType=="days"&&switchcontent.getCookie(this.className+"_d")!="")?','+switchcontent.getCookie(this.className+"_d")+',':(this.expandedindices)?','+this.expandedindices+',':""
for(var i=0;i<this.headers.length;i++){if(typeof this.ajaxheaders["header"+i]!="undefined"){this.headers[i].ajaxstatus='waiting'
this.headers[i].ajaxfile=this.ajaxheaders["header"+i]}
if(typeof this.statusOpen!="undefined")
this.headers[i].innerHTML='<span class="status"></span>'+this.headers[i].innerHTML
if(opencontents_ids.indexOf(','+i+',')!=-1){this.expandcontent(this.headers[i])
if(this.collapsePrev)
this.prevHeader=this.headers[i]}
else
this.contractcontent(this.headers[i])
this.headers[i].onclick=function(){instanceOf.toggledisplay(this)}}
switchcontent.dotask(window,function(){instanceOf.rememberpluscleanup()},"unload")}
switchcontent.prototype.rememberpluscleanup=function(){var opencontents=new Array("none")
for(var i=0;i<this.innercontents.length;i++){if(this.persistType!="none"&&this.innercontents[i].style.display=="block"&&(!this.collapsePrev||(this.collapsePrev&&opencontents.length<2)))
opencontents[opencontents.length]=i
this.headers[i].onclick=null}
if(opencontents.length>1)
opencontents.shift()
if(typeof this.statusOpen!="undefined")
this.statusOpen=this.statusClosed=null
if(this.persistType=="session")
switchcontent.setCookie(this.className,opencontents.join(","))
else if(this.persistType=="days"&&typeof this.persistDays=="number"){switchcontent.setCookie(this.className+"_d",opencontents.join(","),this.persistDays)
switchcontent.setCookie(this.className+"_dtrack",this.persistDays,this.persistDays)}}
switchcontent.dotask=function(target,functionref,tasktype){var tasktype=(window.addEventListener)?tasktype:"on"+tasktype
if(target.addEventListener)
target.addEventListener(tasktype,functionref,false)
else if(target.attachEvent)
target.attachEvent(tasktype,functionref)}
switchcontent.connect=function(pageurl,header){var page_request=false
var bustcacheparameter=""
if(window.ActiveXObject){try{page_request=new ActiveXObject("Msxml2.XMLHTTP")}
catch(e){try{page_request=new ActiveXObject("Microsoft.XMLHTTP")}
catch(e){}}}
else if(window.XMLHttpRequest)
page_request=new XMLHttpRequest()
else
return false
page_request.onreadystatechange=function(){switchcontent.loadpage(page_request,header)}
if(switchcontent_ajax_bustcache)
bustcacheparameter=(pageurl.indexOf("?")!=-1)?"&"+new Date().getTime():"?"+new Date().getTime()
page_request.open('GET',pageurl+bustcacheparameter,true)
page_request.send(null)}
switchcontent.loadpage=function(page_request,header){var innercontent=document.getElementById(header.id.replace("-title",""))
innercontent.innerHTML=switchcontent_ajax_msg
if(page_request.readyState==4&&(page_request.status==200||window.location.href.indexOf("http")==-1)){innercontent.innerHTML=page_request.responseText
header.ajaxstatus="loaded"}}
switchcontent.getCookie=function(Name){var re=new RegExp(Name+"=[^;]+","i");if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return""}
switchcontent.setCookie=function(name,value,days){if(typeof days!="undefined"){var expireDate=new Date()
var expstring=expireDate.setDate(expireDate.getDate()+days)
document.cookie=name+"="+value+"; expires="+expireDate.toGMTString()}
else
document.cookie=name+"="+value}
function switchicon(className,filtertag){switchcontent.call(this,className,filtertag)}
switchicon.prototype=new switchcontent
switchicon.prototype.constructor=switchicon
switchicon.prototype.setStatus=null
switchicon.prototype.setColor=null
switchicon.prototype.setHeader=function(openHTML,closeHTML){this.openHTML=openHTML
this.closeHTML=closeHTML}
switchicon.prototype.contractcontent=function(header){var innercontent=document.getElementById(header.id.replace("-title",""))
innercontent.style.display="none"
header.innerHTML=this.closeHTML
header=null}
switchicon.prototype.expandcontent=function(header){var innercontent=document.getElementById(header.id.replace("-title",""))
if(header.ajaxstatus=="waiting"){switchcontent.connect(header.ajaxfile,header)}
innercontent.style.display="block"
header.innerHTML=this.openHTML
header=null}
document.write('<style type="text/css">'
+'.hidepiece{display:none}\n'
+'@media print{.hidepiece{display:block !important;}}\n'
+'</style>')
function virtualpaginate(config){this.piececlass=config.piececlass
var elementType=(typeof config.piececontainer=="undefined")?"div":config.piececontainer
this.pieces=virtualpaginate.collectElementbyClass(config.piececlass,elementType)
this.chunksize=(typeof config.pieces_per_page=="undefined")?1:(config.pieces_per_page>0&&config.pieces_per_page<this.pieces.length)?config.pieces_per_page:this.pieces.length
this.pagecount=Math.ceil(this.pieces.length/this.chunksize)
this.wraparound=config.wraparound||false
this.paginatediv=[],this.flatviewlinks=[],this.cpspan=[],this.selectmenu=[],this.prevlinks=[],this.nextlinks=[]
this.persist=config.persist
var persistedpage=virtualpaginate.getCookie("dd_"+this.piececlass)||0
var urlselectedpage=virtualpaginate.urlparamselect(this.piececlass)
this.currentpage=(typeof urlselectedpage=="number")?urlselectedpage:((this.persist)?persistedpage:config.defaultpage)
this.currentpage=(this.currentpage<this.pagecount)?parseInt(this.currentpage):0
this.showpage(this.currentpage)}
virtualpaginate.prototype.navigate=function(keyword){if((!this.wraparound&&keyword=="previous"&&this.currentpage==0)||(!this.wraparound&&keyword=="next"&&this.currentpage==this.pagecount-1))
return
var prevlinkindex=this.currentpage
if(keyword=="previous")
this.currentpage=(this.currentpage>0)?this.currentpage-1:(this.currentpage==0)?this.pagecount-1:0
else if(keyword=="next")
this.currentpage=(this.currentpage<this.pagecount-1)?this.currentpage+1:0
else if(keyword=="first")
this.currentpage=0
else if(keyword=="last")
this.currentpage=this.pagecount-1
else
this.currentpage=parseInt(keyword)
this.currentpage=(this.currentpage<this.pagecount)?this.currentpage:0
this.showpage(this.currentpage)
for(var p=0;p<this.paginatediv.length;p++){if(this.flatviewpresent)
this.flatviewlinks[p][prevlinkindex].className=""
if(this.selectmenupresent)
this.selectmenu[p].selectedIndex=this.currentpage
if(this.flatviewpresent)
this.flatviewlinks[p][this.currentpage].className="selected"}
if(!this.wraparound){for(var i=0;i<this.prevlinks.length;i++)
virtualpaginate.setcssclass(this.prevlinks[i],"disabled",(this.currentpage==0)?"add":"remove")
for(var i=0;i<this.nextlinks.length;i++)
virtualpaginate.setcssclass(this.nextlinks[i],"disabled",(this.currentpage==(this.pagecount-1))?"add":"remove")}}
virtualpaginate.prototype.buildpagination=function(divids,optnavtext){var divids=(typeof divids=="string")?[divids]:divids
var primarypaginatediv=divids.shift()
var paginaterawHTML=document.getElementById(primarypaginatediv).innerHTML
this.paginate_build(primarypaginatediv,0,optnavtext)
for(var i=0;i<divids.length;i++){document.getElementById(divids[i]).innerHTML=paginaterawHTML
this.paginate_build(divids[i],i+1,optnavtext)}}
virtualpaginate.collectElementbyClass=function(classname,element){if(document.querySelectorAll){var pieces=document.querySelectorAll(element+"."+classname)}
else{var pieces=[]
var alltags=document.getElementsByTagName(element)
for(var i=0;i<alltags.length;i++){if(virtualpaginate.setcssclass(alltags[i],classname,"check"))
pieces[pieces.length]=alltags[i]}}
return pieces}
virtualpaginate.setcssclass=function(el,targetclass,action){var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)","ig")
if(action=="check")
return needle.test(el.className)
else if(action=="remove")
el.className=el.className.replace(needle,"")
else if(action=="add"&&!needle.test(el.className))
el.className+=" "+targetclass}
virtualpaginate.urlparamselect=function(vpclass){var result=window.location.search.match(new RegExp(vpclass+"=(\\d+)","i"))
return(result==null)?null:parseInt(RegExp.$1)}
virtualpaginate.getCookie=function(Name){var re=new RegExp(Name+"=[^;]+","i");if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return null}
virtualpaginate.setCookie=function(name,value){document.cookie=name+"="+value}
virtualpaginate.prototype.showpage=function(pagenumber){var totalitems=this.pieces.length
var showstartindex=pagenumber*this.chunksize
var showendindex=showstartindex+this.chunksize-1
for(var i=0;i<totalitems;i++){if(i>=showstartindex&&i<=showendindex)
this.pieces[i].style.display="block"
else
this.pieces[i].style.display="none"}
if(this.persist){virtualpaginate.setCookie("dd_"+this.piececlass,this.currentpage)}
if(this.cpspan.length>0){for(var p=0;p<this.cpspan.length;p++)
this.cpspan[p].innerHTML='Page '+(this.currentpage+1)+'/'+this.pagecount}}
virtualpaginate.prototype.paginate_build=function(divid,divpos,optnavtext){var instanceOfBox=this
var paginatediv=document.getElementById(divid)
if(this.chunksize==this.pieces.length){paginatediv.style.display="none"
return}
var paginationcode=paginatediv.innerHTML
if(paginatediv.getElementsByTagName("select").length>0)
this.paginate_build_selectmenu(paginatediv.getElementsByTagName("select")[0],divpos,optnavtext)
if(paginatediv.getElementsByTagName("a").length>0)
this.paginate_build_regularlinks(paginatediv.getElementsByTagName("a"))
var allspans=paginatediv.getElementsByTagName("span")
for(var i=0;i<allspans.length;i++){if(allspans[i].className=="flatview")
this.paginate_output_flatview(allspans[i],divpos,optnavtext)
else if(allspans[i].className=="paginateinfo")
this.paginate_build_cpinfo(allspans[i],divpos)}
this.paginatediv[divpos]=paginatediv}
virtualpaginate.prototype.paginate_output_flatview=function(flatviewcontainer,divpos,anchortext){var flatviewhtml=""
var anchortext=anchortext||new Array()
for(var i=0;i<this.pagecount;i++){if(typeof anchortext[i]!="undefined")
flatviewhtml+='<a href="#flatview" rel="'+i+'">'+anchortext[i]+'</a> '
else
flatviewhtml+='<a href="#flatview" rel="'+i+'">'+(i+1)+'</a> '}
flatviewcontainer.innerHTML=flatviewhtml
this.paginate_build_flatview(flatviewcontainer,divpos,anchortext)}
virtualpaginate.prototype.paginate_build_flatview=function(flatviewcontainer,divpos,anchortext){var instanceOfBox=this
var flatviewhtml=""
this.flatviewlinks[divpos]=flatviewcontainer.getElementsByTagName("a")
for(var i=0;i<this.flatviewlinks[divpos].length;i++){this.flatviewlinks[divpos][i].onclick=function(){var prevlinkindex=instanceOfBox.currentpage
var curlinkindex=parseInt(this.getAttribute("rel"))
instanceOfBox.navigate(curlinkindex)
return false}}
this.flatviewlinks[divpos][this.currentpage].className="selected"
this.flatviewpresent=true}
virtualpaginate.prototype.paginate_build_selectmenu=function(paginatedropdown,divpos,anchortext){var instanceOfBox=this
var anchortext=anchortext||new Array()
this.selectmenupresent=1
for(var i=0;i<this.pagecount;i++){if(typeof anchortext[i]!="undefined")
paginatedropdown.options[i]=new Option(anchortext[i],i)
else
paginatedropdown.options[i]=new Option("Page "+(i+1)+" of "+this.pagecount,i)}
paginatedropdown.selectedIndex=this.currentpage
setTimeout(function(){paginatedropdown.selectedIndex=instanceOfBox.currentpage},500)
paginatedropdown.onchange=function(){instanceOfBox.navigate(this.selectedIndex)}
this.selectmenu[divpos]=paginatedropdown
this.selectmenu[divpos].selectedIndex=this.currentpage}
virtualpaginate.prototype.paginate_build_regularlinks=function(paginatelinks){var instanceOfBox=this
for(var i=0;i<paginatelinks.length;i++){var currentpagerel=paginatelinks[i].getAttribute("rel")
if(/^(previous)|(next)|(first)|(last)$/.test(currentpagerel)){paginatelinks[i].onclick=function(){instanceOfBox.navigate(this.getAttribute("rel"))
return false}}
if(currentpagerel=="previous"||paginatelinks[i].href.indexOf("previous")!=-1){if(!this.wraparound&&this.currentpage==0)
virtualpaginate.setcssclass(paginatelinks[i],"disabled","add")
this.prevlinks.push(paginatelinks[i])}
else if(currentpagerel=="next"||paginatelinks[i].href.indexOf("next")!=-1){if(!this.wraparound&&this.currentpage==this.pagecount-1)
virtualpaginate.setcssclass(paginatelinks[i],"disabled","add")
this.nextlinks.push(paginatelinks[i])}}}
virtualpaginate.prototype.paginate_build_cpinfo=function(cpspan,divpos){this.cpspan[divpos]=cpspan
cpspan.innerHTML='Page '+(this.currentpage+1)+'/'+this.pagecount}
function switchExpand(obj){divs=document.getElementsByTagName("div");for(i in divs){if(divs[i].id!=obj){if(divs[i].className=="ExpandElement"){divs[i].style.display="none";}}}
el=document.getElementById(obj);if(el.style.display!="block"){el.style.display="block";}else{el.style.display="none";}}
function ddtabcontent(tabinterfaceid){this.tabinterfaceid=tabinterfaceid
this.tabs=document.getElementById(tabinterfaceid).getElementsByTagName("a")
this.enabletabpersistence=true
this.hottabspositions=[]
this.currentTabIndex=0
this.subcontentids=[]
this.revcontentids=[]
this.selectedClassTarget="link"}
ddtabcontent.getCookie=function(Name){var re=new RegExp(Name+"=[^;]+","i");if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return""}
ddtabcontent.setCookie=function(name,value){document.cookie=name+"="+value+";path=/"}
ddtabcontent.prototype={expandit:function(tabid_or_position){this.cancelautorun()
var tabref=""
try{if(typeof tabid_or_position=="string"&&document.getElementById(tabid_or_position).getAttribute("rel"))
tabref=document.getElementById(tabid_or_position)
else if(parseInt(tabid_or_position)!=NaN&&this.tabs[tabid_or_position].getAttribute("rel"))
tabref=this.tabs[tabid_or_position]}
catch(err){alert("Invalid Tab ID or position entered!")}
if(tabref!="")
this.expandtab(tabref)},cycleit:function(dir,autorun){if(dir=="next"){var currentTabIndex=(this.currentTabIndex<this.hottabspositions.length-1)?this.currentTabIndex+1:0}
else if(dir=="prev"){var currentTabIndex=(this.currentTabIndex>0)?this.currentTabIndex-1:this.hottabspositions.length-1}
if(typeof autorun=="undefined")
this.cancelautorun()
this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]])},setpersist:function(bool){this.enabletabpersistence=bool},setselectedClassTarget:function(objstr){this.selectedClassTarget=objstr||"link"},getselectedClassTarget:function(tabref){return(this.selectedClassTarget==("linkparent".toLowerCase()))?tabref.parentNode:tabref},urlparamselect:function(tabinterfaceid){var result=window.location.search.match(new RegExp(tabinterfaceid+"=(\\d+)","i"))
return(result==null)?null:parseInt(RegExp.$1)},expandtab:function(tabref){var subcontentid=tabref.getAttribute("rel")
var associatedrevids=(tabref.getAttribute("rev"))?","+tabref.getAttribute("rev").replace(/\s+/,"")+",":""
this.expandsubcontent(subcontentid)
this.expandrevcontent(associatedrevids)
for(var i=0;i<this.tabs.length;i++){this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("rel")==subcontentid)?"selected":""}
if(this.enabletabpersistence)
ddtabcontent.setCookie(this.tabinterfaceid,tabref.tabposition)
this.setcurrenttabindex(tabref.tabposition)},expandsubcontent:function(subcontentid){for(var i=0;i<this.subcontentids.length;i++){var subcontent=document.getElementById(this.subcontentids[i])
subcontent.style.display=(subcontent.id==subcontentid)?"block":"none"}},expandrevcontent:function(associatedrevids){var allrevids=this.revcontentids
for(var i=0;i<allrevids.length;i++){document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)?"block":"none"}},setcurrenttabindex:function(tabposition){for(var i=0;i<this.hottabspositions.length;i++){if(tabposition==this.hottabspositions[i]){this.currentTabIndex=i
break}}},autorun:function(){this.cycleit('next',true)},cancelautorun:function(){if(typeof this.autoruntimer!="undefined")
clearInterval(this.autoruntimer)},init:function(automodeperiod){var persistedtab=ddtabcontent.getCookie(this.tabinterfaceid)
var selectedtab=-1
var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid)
this.automodeperiod=automodeperiod||0
for(var i=0;i<this.tabs.length;i++){this.tabs[i].tabposition=i
if(this.tabs[i].getAttribute("rel")){var tabinstance=this
this.hottabspositions[this.hottabspositions.length]=i
this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel")
this.tabs[i].onclick=function(){tabinstance.expandtab(this)
tabinstance.cancelautorun()
return false}
if(this.tabs[i].getAttribute("rev")){this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))}
if(selectedtabfromurl==i||this.enabletabpersistence&&selectedtab==-1&&parseInt(persistedtab)==i||!this.enabletabpersistence&&selectedtab==-1&&this.getselectedClassTarget(this.tabs[i]).className=="selected"){selectedtab=i}}}
if(selectedtab!=-1)
this.expandtab(this.tabs[selectedtab])
else
this.expandtab(this.tabs[this.hottabspositions[0]])
if(parseInt(this.automodeperiod)>500&&this.hottabspositions.length>1){this.autoruntimer=setInterval(function(){tabinstance.autorun()},this.automodeperiod)}}}
var dropdowncontent={disableanchorlink:true,hidedivmouseout:[true,200],ajaxloadingmsg:"Loading content. Please wait...",ajaxbustcache:true,getposOffset:function(what,offsettype){return(what.offsetParent)?what[offsettype]+this.getposOffset(what.offsetParent,offsettype):what[offsettype]},isContained:function(m,e){var e=window.event||e
var c=e.relatedTarget||((e.type=="mouseover")?e.fromElement:e.toElement)
while(c&&c!=m)try{c=c.parentNode}catch(e){c=m}
if(c==m)
return true
else
return false},show:function(anchorobj,subobj,e){if(!this.isContained(anchorobj,e)||(e&&e.type=="click")){var e=window.event||e
if(e.type=="click"&&subobj.style.visibility=="visible"){subobj.style.visibility="hidden"
return}
var horizontaloffset=(subobj.dropposition[0]=="left")?-(subobj.offsetWidth-anchorobj.offsetWidth):0
var verticaloffset=(subobj.dropposition[1]=="top")?-subobj.offsetHeight:anchorobj.offsetHeight
subobj.style.left=this.getposOffset(anchorobj,"offsetLeft")+horizontaloffset+"px"
subobj.style.top=this.getposOffset(anchorobj,"offsetTop")+verticaloffset+"px"
subobj.style.clip=(subobj.dropposition[1]=="top")?"rect(auto auto auto 0)":"rect(0 auto 0 0)"
subobj.style.visibility="visible"
subobj.startTime=new Date().getTime()
subobj.contentheight=parseInt(subobj.offsetHeight)
if(typeof window["hidetimer_"+subobj.id]!="undefined")
clearTimeout(window["hidetimer_"+subobj.id])
this.slideengine(subobj,(subobj.dropposition[1]=="top")?"up":"down")}},curveincrement:function(percent){return(1-Math.cos(percent*Math.PI))/2},slideengine:function(obj,direction){var elapsed=new Date().getTime()-obj.startTime
if(elapsed<obj.glidetime){var distancepercent=(direction=="down")?this.curveincrement(elapsed/obj.glidetime):1-this.curveincrement(elapsed/obj.glidetime)
var currentclip=(distancepercent*obj.contentheight)+"px"
obj.style.clip=(direction=="down")?"rect(0 auto "+currentclip+" 0)":"rect("+currentclip+" auto auto 0)"
window["glidetimer_"+obj.id]=setTimeout(function(){dropdowncontent.slideengine(obj,direction)},10)}
else{obj.style.clip="rect(0 auto auto 0)"}},hide:function(activeobj,subobj,e){if(!dropdowncontent.isContained(activeobj,e)){window["hidetimer_"+subobj.id]=setTimeout(function(){subobj.style.visibility="hidden"
subobj.style.left=subobj.style.top=0
clearTimeout(window["glidetimer_"+subobj.id])},dropdowncontent.hidedivmouseout[1])}},hidediv:function(subobjid){document.getElementById(subobjid).style.visibility="hidden"},ajaxconnect:function(pageurl,divId){var page_request=false
var bustcacheparameter=""
if(window.XMLHttpRequest)
page_request=new XMLHttpRequest()
else if(window.ActiveXObject){try{page_request=new ActiveXObject("Msxml2.XMLHTTP")}
catch(e){try{page_request=new ActiveXObject("Microsoft.XMLHTTP")}
catch(e){}}}
else
return false
document.getElementById(divId).innerHTML=this.ajaxloadingmsg
page_request.onreadystatechange=function(){dropdowncontent.loadpage(page_request,divId)}
if(this.ajaxbustcache)
bustcacheparameter=(pageurl.indexOf("?")!=-1)?"&"+new Date().getTime():"?"+new Date().getTime()
page_request.open('GET',pageurl+bustcacheparameter,true)
page_request.send(null)},loadpage:function(page_request,divId){if(page_request.readyState==4&&(page_request.status==200||window.location.href.indexOf("http")==-1)){document.getElementById(divId).innerHTML=page_request.responseText}},init:function(anchorid,pos,glidetime,revealbehavior){var anchorobj=document.getElementById(anchorid)
if(anchorobj)
var subobj=document.getElementById(anchorobj.getAttribute("rel"))
if(!anchorobj||!subobj)
return
var subobjsource=anchorobj.getAttribute("rev")
if(subobjsource!=null&&subobjsource!="")
this.ajaxconnect(subobjsource,anchorobj.getAttribute("rel"))
subobj.dropposition=pos.split("-")
subobj.glidetime=glidetime||1000
subobj.style.left=subobj.style.top=0
if(typeof revealbehavior=="undefined"||revealbehavior=="mouseover"){anchorobj.onmouseover=function(e){dropdowncontent.show(this,subobj,e)}
anchorobj.onmouseout=function(e){dropdowncontent.hide(subobj,subobj,e)}
if(this.disableanchorlink)anchorobj.onclick=function(){return false}}
else
anchorobj.onclick=function(e){dropdowncontent.show(this,subobj,e);return false}
if(this.hidedivmouseout[0]==true)
subobj.onmouseout=function(e){dropdowncontent.hide(this,subobj,e)}}}
var loadingImage='/loading.gif';var closeButton='/close.gif';function getPageScroll(){var yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;}else if(document.body){yScroll=document.body.scrollTop;}
arrayPageScroll=new Array('',yScroll)
return arrayPageScroll;}
function getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;}
function pause(numberMillis){var now=new Date();var exitTime=now.getTime()+numberMillis;while(true){now=new Date();if(now.getTime()>exitTime)
return;}}
function getKey(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;}
key=String.fromCharCode(keycode).toLowerCase();if(key=='x'){hideLightbox();}}
function listenKey(){document.onkeypress=getKey;}
function showLightbox(objLink){var objOverlay=document.getElementById('overlay');var objLightbox=document.getElementById('lightbox');var objCaption=document.getElementById('lightboxCaption');var objImage=document.getElementById('lightboxImage');var objLoadingImage=document.getElementById('loadingImage');var objLightboxDetails=document.getElementById('lightboxDetails');var arrayPageSize=getPageSize();var arrayPageScroll=getPageScroll();if(objLoadingImage){objLoadingImage.style.top=(arrayPageScroll[1]+((arrayPageSize[3]-35-objLoadingImage.height)/2)+'px');objLoadingImage.style.left=(((arrayPageSize[0]-20-objLoadingImage.width)/2)+'px');objLoadingImage.style.display='block';}
objOverlay.style.height=(arrayPageSize[1]+'px');objOverlay.style.display='block';imgPreload=new Image();imgPreload.onload=function(){objImage.src=objLink.href;var lightboxTop=arrayPageScroll[1]+((arrayPageSize[3]-35-imgPreload.height)/2);var lightboxLeft=((arrayPageSize[0]-20-imgPreload.width)/2);objLightbox.style.top=(lightboxTop<0)?"0px":lightboxTop+"px";objLightbox.style.left=(lightboxLeft<0)?"0px":lightboxLeft+"px";objLightboxDetails.style.width=imgPreload.width+'px';if(objLink.getAttribute('title')){objCaption.style.display='block';objCaption.innerHTML=objLink.getAttribute('title');}else{objCaption.style.display='none';}
if(navigator.appVersion.indexOf("MSIE")!=-1){pause(250);}
if(objLoadingImage){objLoadingImage.style.display='none';}
objLightbox.style.display='block';arrayPageSize=getPageSize();objOverlay.style.height=(arrayPageSize[1]+'px');listenKey();return false;}
imgPreload.src=objLink.href;}
function hideLightbox(){objOverlay=document.getElementById('overlay');objLightbox=document.getElementById('lightbox');objOverlay.style.display='none';objLightbox.style.display='none';document.onkeypress='';}
function initLightbox(){if(!document.getElementsByTagName){return;}
var anchors=document.getElementsByTagName("a");for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute("href")&&(anchor.getAttribute("rel")=="lightbox")){anchor.onclick=function(){showLightbox(this);return false;}}}
var objBody=document.getElementsByTagName("body").item(0);var objOverlay=document.createElement("div");objOverlay.setAttribute('id','overlay');objOverlay.onclick=function(){hideLightbox();return false;}
objOverlay.style.display='none';objOverlay.style.position='absolute';objOverlay.style.top='0';objOverlay.style.left='0';objOverlay.style.zIndex='90';objOverlay.style.width='100%';objBody.insertBefore(objOverlay,objBody.firstChild);var arrayPageSize=getPageSize();var arrayPageScroll=getPageScroll();var imgPreloader=new Image();imgPreloader.onload=function(){var objLoadingImageLink=document.createElement("a");objLoadingImageLink.setAttribute('href','#');objLoadingImageLink.onclick=function(){hideLightbox();return false;}
objOverlay.appendChild(objLoadingImageLink);var objLoadingImage=document.createElement("img");objLoadingImage.src=loadingImage;objLoadingImage.setAttribute('id','loadingImage');objLoadingImage.style.position='absolute';objLoadingImage.style.zIndex='150';objLoadingImageLink.appendChild(objLoadingImage);imgPreloader.onload=function(){};return false;}
imgPreloader.src=loadingImage;var objLightbox=document.createElement("div");objLightbox.setAttribute('id','lightbox');objLightbox.style.display='none';objLightbox.style.position='absolute';objLightbox.style.zIndex='100';objBody.insertBefore(objLightbox,objOverlay.nextSibling);var objLink=document.createElement("a");objLink.setAttribute('href','#');objLink.setAttribute('title','Click to close');objLink.onclick=function(){hideLightbox();return false;}
objLightbox.appendChild(objLink);var imgPreloadCloseButton=new Image();imgPreloadCloseButton.onload=function(){var objCloseButton=document.createElement("img");objCloseButton.src=closeButton;objCloseButton.setAttribute('id','closeButton');objCloseButton.style.position='absolute';objCloseButton.style.zIndex='200';objLink.appendChild(objCloseButton);return false;}
imgPreloadCloseButton.src=closeButton;var objImage=document.createElement("img");objImage.setAttribute('id','lightboxImage');objLink.appendChild(objImage);var objLightboxDetails=document.createElement("div");objLightboxDetails.setAttribute('id','lightboxDetails');objLightbox.appendChild(objLightboxDetails);var objCaption=document.createElement("div");objCaption.setAttribute('id','lightboxCaption');objCaption.style.display='none';objLightboxDetails.appendChild(objCaption);var objKeyboardMsg=document.createElement("div");objKeyboardMsg.setAttribute('id','keyboardMsg');objKeyboardMsg.innerHTML='press <kbd>x</kbd> to close';objLightboxDetails.appendChild(objKeyboardMsg);}
function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}}
addLoadEvent(initLightbox);
