
var ddaccordion={
contentclassname:{},
expandone:function(headerclass,selected){
this.toggleone(headerclass,selected,"expand")},
collapseone:function(headerclass,selected){
this.toggleone(headerclass,selected,"collapse")},
expandall:function(headerclass){
var $headers=$('.'+headerclass)
$('.'+this.contentclassname[headerclass]+':hidden').each(function(){
$headers.eq(parseInt($(this).attr('contentindex'))).click()})},
collapseall:function(headerclass){
var $headers=$('.'+headerclass)
$('.'+this.contentclassname[headerclass]+':visible').each(function(){
$headers.eq(parseInt($(this).attr('contentindex'))).click()})},
toggleone:function(headerclass,selected,optstate){
var $targetHeader=$('.'+headerclass).eq(selected)
var $subcontent=$('.'+this.contentclassname[headerclass]).eq(selected)
if(typeof optstate=="undefined"||optstate=="expand"&&$subcontent.is(":hidden")||optstate=="collapse"&&$subcontent.is(":visible"))
$targetHeader.click()},
expandit:function($targetHeader,$targetContent,config){
$targetContent.slideDown(config.animatespeed)
this.transformHeader($targetHeader,config,"expand")},
collapseit:function($targetHeader,$targetContent,config){
$targetContent.slideUp(config.animatespeed)
this.transformHeader($targetHeader,config,"collapse")},
transformHeader:function($targetHeader,config,state){
$targetHeader.addClass((state=="expand")?config.cssclass.expand:config.cssclass.collapse)
.removeClass((state=="expand")?config.cssclass.collapse:config.cssclass.expand)
if(config.htmlsetting.location=='src'){
$targetHeader=($targetHeader.is("img"))?$targetHeader:$targetHeader.find('img').eq(0)
$targetHeader.attr('src',(state=="expand")?config.htmlsetting.expand:config.htmlsetting.collapse)}
else if(config.htmlsetting.location=="prefix")
$targetHeader.find('.accordprefix').html((state=="expand")?config.htmlsetting.expand:config.htmlsetting.collapse)
else if(config.htmlsetting.location=="suffix")
$targetHeader.find('.accordsuffix').html((state=="expand")?config.htmlsetting.expand:config.htmlsetting.collapse)},
getCookie:function(Name){
var re=new RegExp(Name+"=[^;]+","i")
if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return null},
setCookie:function(name,value){
document.ignore=name+"="+value},
init:function(config){
document.write('<style type="text/css">\n')
document.write('.'+config.contentclass+'{display: none}\n')
document.write('<\/style>')
$(document).ready(function(){
ddaccordion.contentclassname[config.headerclass]=config.contentclass
config.cssclass={collapse:config.toggleclass[0],expand:config.toggleclass[1]}
config.htmlsetting={location:config.togglehtml[0],collapse:config.togglehtml[1],expand:config.togglehtml[2]}
var lastexpanded={}
var expandedindices=(config.persiststate)?ddaccordion.getCookie(config.headerclass):config.defaultexpanded
expandedindices=(typeof expandedindices=='string')?expandedindices.replace(/c/ig,'').split(','):config.defaultexpanded
var $subcontents=$('.'+config["contentclass"])
if(config["collapseprev"]&&expandedindices.length>1)
expandedindices=[expandedindices.pop()]
$('.'+config["headerclass"]).each(function(index){
if(/(prefix)|(suffix)/i.test(config.htmlsetting.location)&&$(this).html()!=""){
$('<span class="accordprefix"></span>').prependTo(this)
$('<span class="accordsuffix"></span>').appendTo(this)}
$(this).attr('headerindex',index+'h')
$subcontents.eq(index).attr('contentindex',index+'c')
var $subcontent=$subcontents.eq(index)
if(jQuery.inArray(index,expandedindices)!=-1){
if(config.animatedefault==false)
$subcontent.show()
ddaccordion.expandit($(this),$subcontent,config)
lastexpanded={$header:$(this),$content:$subcontent}}
else{
$subcontent.hide()
ddaccordion.transformHeader($(this),config,"collapse")}})
$('.'+config["headerclass"]).click(function(){
var $subcontent=$subcontents.eq(parseInt($(this).attr('headerindex')))
if($subcontent.css('display')=="none"){
ddaccordion.expandit($(this),$subcontent,config)
if(config["collapseprev"]&&lastexpanded.$header&&$(this).get(0)!=lastexpanded.$header.get(0)){
ddaccordion.collapseit(lastexpanded.$header,lastexpanded.$content,config)}
lastexpanded={$header:$(this),$content:$subcontent}}
else{
ddaccordion.collapseit($(this),$subcontent,config)}
return false})
$(window).bind('unload',function(){
$('.'+config["headerclass"]).unbind('click')
var expandedindices=[]
$('.'+config["contentclass"]+":visible").each(function(index){
expandedindices.push($(this).attr('contentindex'))})
if(config.persiststate==true){
expandedindices=(expandedindices.length==0)?'-1c':expandedindices
ddaccordion.setCookie(config.headerclass,expandedindices)}})})}}
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.ignore=name+"="+value+"; expires="+expireDate.toGMTString()}
else
document.ignore=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}
function addEvent(object,type,handler){
if(object.addEventListener){
object.addEventListener(type,handler,false);}else if(object.attachEvent){
object.attachEvent(['on',type].join(''),handler);}else{
object[['on',type].join('')]=handler;}}
function WindowSize(){
this.w=0;
this.h=0;
return this.update();}
WindowSize.prototype.update=function(){
var d=document;
this.w=(window.innerWidth)?window.innerWidth:(d.documentElement&&d.documentElement.clientWidth)?d.documentElement.clientWidth:d.body.clientWidth;
this.h=(window.innerHeight)?window.innerHeight:(d.documentElement&&d.documentElement.clientHeight)?d.documentElement.clientHeight:d.body.clientHeight;
return this;};
function PageSize(){
this.win=new WindowSize();
this.w=0;
this.h=0;
return this.update();}
PageSize.prototype.update=function(){
var d=document;
this.w=(window.innerWidth&&window.scrollMaxX)?window.innerWidth+window.scrollMaxX:(d.body.scrollWidth>d.body.offsetWidth)?d.body.scrollWidth:d.body.offsetWidt;
this.h=(window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:(d.body.scrollHeight>d.body.offsetHeight)?d.body.scrollHeight:d.body.offsetHeight;
this.win.update();
if(this.w<this.win.w)this.w=this.win.w;
if(this.h<this.win.h)this.h=this.win.h;
return this;};
function PagePos(){
this.x=0;
this.y=0;
return this.update();}
PagePos.prototype.update=function(){
var d=document;
this.x=(window.pageXOffset)?window.pageXOffset:(d.documentElement&&d.documentElement.scrollLeft)?d.documentElement.scrollLeft:(d.body)?d.body.scrollLeft:0;
this.y=(window.pageYOffset)?window.pageYOffset:(d.documentElement&&d.documentElement.scrollTop)?d.documentElement.scrollTop:(d.body)?d.body.scrollTop:0;
return this;};
function UserAgent(){
var ua=navigator.userAgent;
this.isWinIE=this.isMacIE=false;
this.isGecko=ua.match(/Gecko\//);
this.isSafari=ua.match(/AppleWebKit/);
this.isOpera=window.opera;
if(document.all&&!this.isGecko&&!this.isSafari&&!this.isOpera){
this.isWinIE=ua.match(/Win/);
this.isMacIE=ua.match(/Mac/);
this.isNewIE=(ua.match(/MSIE 5\.5/)||ua.match(/MSIE 6\.0/));}
return this;}
function LightBox(option){
var self=this;
self._imgs=new Array();
self._wrap=null;
self._box=null;
self._open=-1;
self._page=new PageSize();
self._pos=new PagePos();
self._ua=new UserAgent();
self._expandable=false;
self._expanded=false;
self._expand=option.expandimg;
self._shrink=option.shrinkimg;
return self._init(option);}
LightBox.prototype={
_init:function(option){
var self=this;
var d=document;
if(!d.getElementsByTagName)return;
var links=d.getElementsByTagName("a");
for(var i=0;i<links.length;i++){
var anchor=links[i];
var num=self._imgs.length;
if(!anchor.getAttribute("href")||anchor.getAttribute("rel")!="lightbox")continue;
self._imgs[num]={src:anchor.getAttribute("href"),w:-1,h:-1,title:'',cls:anchor.className};
if(anchor.getAttribute("title"))
self._imgs[num].title=anchor.getAttribute("title");
else if(anchor.firstChild&&anchor.firstChild.getAttribute&&anchor.firstChild.getAttribute("title"))
self._imgs[num].title=anchor.firstChild.getAttribute("title");
anchor.onclick=self._genOpener(num);}
var body=d.getElementsByTagName("body")[0];
self._wrap=self._createWrapOn(body,option.loadingimg);
self._box=self._createBoxOn(body,option);
return self;},
_genOpener:function(num){
var self=this;
return function(){self._show(num);return false;}},
_createWrapOn:function(obj,imagePath){
var self=this;
if(!obj)return null;
var wrap=document.createElement('div');
wrap.id='overlay';
with(wrap.style){
display='none';
position='fixed';
top='0px';
left='0px';
zIndex='50';
width='100%';
height='100%';}
if(self._ua.isWinIE)wrap.style.position='absolute';
addEvent(wrap,"click",function(){self._close();});
obj.appendChild(wrap);
var imag=new Image;
imag.onload=function(){
var spin=document.createElement('img');
spin.id='loadingImage';
spin.src=imag.src;
spin.style.position='relative';
self._set_cursor(spin);
addEvent(spin,'click',function(){self._close();});
wrap.appendChild(spin);
imag.onload=function(){};};
if(imagePath!='')imag.src=imagePath;
return wrap;},
_createBoxOn:function(obj,option){
var self=this;
if(!obj)return null;
var box=document.createElement('div');
box.id='lightbox';
with(box.style){
display='none';
position='absolute';
zIndex='60';}
obj.appendChild(box);
var img=document.createElement('img');
img.id='lightboxImage';
self._set_cursor(img);
addEvent(img,'click',function(){self._close();});
addEvent(img,'mouseover',function(){self._show_action();});
addEvent(img,'mouseout',function(){self._hide_action();});
box.appendChild(img);
var zoom=document.createElement('img');
zoom.id='actionImage';
with(zoom.style){
display='none';
position='absolute';
top='15px';
left='15px';
zIndex='70';}
self._set_cursor(zoom);
zoom.src=self._expand;
addEvent(zoom,'mouseover',function(){self._show_action();});
addEvent(zoom,'click',function(){self._zoom();});
box.appendChild(zoom);
addEvent(window,'resize',function(){self._set_size(true);});
if(option.closeimg){
var btn=document.createElement('img');
btn.id='closeButton';
with(btn.style){
display='inline';
position='absolute';
right='10px';
top='10px';
zIndex='80';}
btn.src=option.closeimg;
self._set_cursor(btn);
addEvent(btn,'click',function(){self._close();});
box.appendChild(btn);}
var caption=document.createElement('span');
caption.id='lightboxCaption';
with(caption.style){
display='none';
position='absolute';
zIndex='80';}
box.appendChild(caption);
if(!option.effectpos)option.effectpos={x:0,y:0};
else{
if(option.effectpos.x=='')option.effectpos.x=0;
if(option.effectpos.y=='')option.effectpos.y=0;}
var effect=new Image;
effect.onload=function(){
var effectImg=document.createElement('img');
effectImg.id='effectImage';
effectImg.src=effect.src;
if(option.effectclass)effectImg.className=option.effectclass;
with(effectImg.style){
position='absolute';
display='none';
left=[option.effectpos.x,'px'].join('');;
top=[option.effectpos.y,'px'].join('');
zIndex='90';}
self._set_cursor(effectImg);
addEvent(effectImg,'click',function(){effectImg.style.display='none';});
box.appendChild(effectImg);};
if(option.effectimg!='')effect.src=option.effectimg;
return box;},
_set_photo_size:function(){
var self=this;
if(self._open==-1)return;
var imag=self._box.firstChild;
var targ={w:self._page.win.w-30,h:self._page.win.h-30};
var orig={w:self._imgs[self._open].w,h:self._imgs[self._open].h};
var ratio=1.0;
if((orig.w>=targ.w||orig.h>=targ.h)&&orig.h&&orig.w)
ratio=((targ.w/ orig.w)<(targ.h/ orig.h))?targ.w/ orig.w: targ.h/ orig.h;
imag.width=Math.floor(orig.w*ratio);
imag.height=Math.floor(orig.h*ratio);
self._expandable=(ratio<1.0)?true:false;
if(self._ua.isWinIE)self._box.style.display="block";
self._box.style.top=[self._pos.y+(self._page.win.h-imag.height-30)/2,'px'].join('');
self._box.style.left=[((self._page.win.w-imag.width-30)/2),'px'].join('');
self._show_caption(true);},
_set_size:function(onResize){
var self=this;
if(self._open==-1)return;
self._page.update();
self._pos.update();
var spin=self._wrap.firstChild;
if(spin){
var top=(self._page.win.h-spin.height)/2;
if(self._wrap.style.position=='absolute')top+=self._pos.y;
spin.style.top=[top,'px'].join('');
spin.style.left=[(self._page.win.w-spin.width-30)/2,'px'].join('');}
if(self._ua.isWinIE){
self._wrap.style.width=[self._page.win.w,'px'].join('');
self._wrap.style.height=[self._page.h,'px'].join('');}
if(onResize)self._set_photo_size();},
_show_action:function(){
var self=this;
if(self._open==-1||!self._expandable)return;
var obj=document.getElementById('actionImage');
if(!obj)return;
obj.src=(self._expanded)?self._shrink:self._expand;
obj.style.display='inline';},
_hide_action:function(){
var self=this;
var obj=document.getElementById('actionImage');
if(obj)obj.style.display='none';},
_zoom:function(){
var self=this;
if(self._expanded){
self._set_photo_size();
self._expanded=false;}else if(self._open>-1){
var imag=self._box.firstChild;
self._box.style.top=[self._pos.y,'px'].join('');
self._box.style.left='0px';
imag.width=self._imgs[self._open].w;
imag.height=self._imgs[self._open].h;
self._show_caption(false);
self._expanded=true;}
self._show_action();},
_show_caption:function(enable){
var self=this;
var caption=document.getElementById('lightboxCaption');
if(!caption)return;
if(caption.innerHTML.length==0||!enable){
caption.style.display='none';}else{
var imag=self._box.firstChild;
with(caption.style){
top=[imag.height+10,'px'].join('');
left='0px';
width=[imag.width+20,'px'].join('');
height='1.2em';
display='block';}}},
_show:function(num){
var self=this;
var imag=new Image;
if(num<0||num>=self._imgs.length)return;
var loading=document.getElementById('loadingImage');
var caption=document.getElementById('lightboxCaption');
var effect=document.getElementById('effectImage');
self._open=num;
self._set_size(false);
self._wrap.style.display="block";
if(loading)loading.style.display='inline';
imag.onload=function(){
if(self._imgs[self._open].w==-1){
self._imgs[self._open].w=imag.width;
self._imgs[self._open].h=imag.height;}
if(effect){
effect.style.display=(!effect.className||self._imgs[self._open].cls==effect.className)?'block':'none';}
if(caption)caption.innerHTML=self._imgs[self._open].title;
self._set_photo_size();
self._hide_action();
self._box.style.display="block";
self._box.firstChild.src=imag.src;
self._box.firstChild.setAttribute('title',self._imgs[self._open].title);
if(loading)loading.style.display='none';};
self._expandable=false;
self._expanded=false;
imag.src=self._imgs[self._open].src;},
_set_cursor:function(obj){
var self=this;
if(self._ua.isWinIE&&!self._ua.isNewIE)return;
obj.style.cursor='pointer';},
_close:function(){
var self=this;
self._open=-1;
self._hide_action();
self._wrap.style.display="none";
self._box.style.display="none";}};
addEvent(window,"load",function(){
var lightbox=new LightBox({
loadingimg:'lightbox/loading.gif',
expandimg:'lightbox/expand.gif',
shrinkimg:'lightbox/shrink.gif',
effectimg:'images/logyell2.gif',
effectpos:{x:20,y:20},
effectclass:'effectable',
closeimg:'lightbox/close.gif'});});
document.getElementsByClassName=function(className){
var children=document.getElementsByTagName('*')||document.all;
var elements=new Array();
for(var i=0;i<children.length;i++){
var child=children[i];
var classNames=child.className.split(' ');
for(var j=0;j<classNames.length;j++){
if(classNames[j]==className){
elements.push(child);
break;}}}
return elements;}
var Reflection={
defaultHeight:0.5,
defaultOpacity:0.5,
add:function(image,options){
Reflection.remove(image);
doptions={"height":Reflection.defaultHeight,"opacity":Reflection.defaultOpacity}
if(options){
for(var i in doptions){
if(!options[i]){
options[i]=doptions[i];}}}else{
options=doptions;}
try{
var d=document.createElement('div');
var p=image;
var classes=p.className.split(' ');
var newClasses='';
for(j=0;j<classes.length;j++){
if(classes[j]!="reflect"){
if(newClasses){
newClasses+=' '}
newClasses+=classes[j];}}
var reflectionHeight=Math.floor(p.height*options['height']);
var divHeight=Math.floor(p.height*(1+options['height']));
var reflectionWidth=p.width;
if(document.all&&!window.opera){
if(p.parentElement.tagName=='A'){
var d=document.createElement('a');
d.href=p.parentElement.href;}
d.className=newClasses;
p.className='reflected';
d.style.cssText=p.style.cssText;
p.style.cssText='vertical-align: bottom';
var reflection=document.createElement('img');
reflection.src=p.src;
reflection.style.width=reflectionWidth+'px';
reflection.style.marginBottom="-"+(p.height-reflectionHeight)+'px';
reflection.style.filter='flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+(options['opacity']*100)+', style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy='+(options['height']*100)+')';
d.style.width=reflectionWidth+'px';
d.style.height=divHeight+'px';
p.parentNode.replaceChild(d,p);
d.appendChild(p);
d.appendChild(reflection);}else{
var canvas=document.createElement('canvas');
if(canvas.getContext){
d.className=newClasses;
p.className='reflected';
d.style.cssText=p.style.cssText;
p.style.cssText='vertical-align: bottom';
var context=canvas.getContext("2d");
canvas.style.height=reflectionHeight+'px';
canvas.style.width=reflectionWidth+'px';
canvas.height=reflectionHeight;
canvas.width=reflectionWidth;
d.style.width=reflectionWidth+'px';
d.style.height=divHeight+'px';
p.parentNode.replaceChild(d,p);
d.appendChild(p);
d.appendChild(canvas);
context.save();
context.translate(0,image.height-1);
context.scale(1,-1);
context.drawImage(image,0,0,reflectionWidth,image.height);
context.restore();
context.globalCompositeOperation="destination-out";
var gradient=context.createLinearGradient(0,0,0,reflectionHeight);
gradient.addColorStop(1,"rgba(255, 255, 255, 1.0)");
gradient.addColorStop(0,"rgba(255, 255, 255, "+(1-options['opacity'])+")");
context.fillStyle=gradient;
if(navigator.appVersion.indexOf('WebKit')!=-1){
context.fill();}else{
context.fillRect(0,0,reflectionWidth,reflectionHeight*2);}}}}catch(e){}},
remove:function(image){
if(image.className=="reflected"){
image.className=image.parentNode.className;
image.parentNode.parentNode.replaceChild(image,image.parentNode);}}}
function addReflections(){
var rimages=document.getElementsByClassName('reflect');
for(i=0;i<rimages.length;i++){
var rheight=null;
var ropacity=null;
var classes=rimages[i].className.split(' ');
for(j=0;j<classes.length;j++){
if(classes[j].indexOf("rheight")==0){
var rheight=classes[j].substring(7)/100;}else if(classes[j].indexOf("ropacity")==0){
var ropacity=classes[j].substring(8)/100;}}
Reflection.add(rimages[i],{height:rheight,opacity:ropacity});}}
var previousOnload=window.onload;
window.onload=function(){if(previousOnload)previousOnload();addReflections();}
﻿
function dblclick(){window.scrollTo(0,0)}
if(document.layers){document.captureEvents(Event.ondblclick);}
document.ondblclick=dblclick;
function bookmarksite(title,url){
if(window.sidebar)
window.sidebar.addPanel(title,url,"");
else if(window.opera&&window.print){
var elem=document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();}
else if(document.all)
window.external.AddFavorite(url,title);}
var tgs=new Array('div','td','tr','span');
var szs=new Array('10px','12px','14px','15px','16px','18px','20px');
var startSz=2;
function ts(trgt,inc){
if(!document.getElementById)return
var d=document,cEl=null,sz=startSz,i,j,cTags;
sz+=inc;
if(sz<0)sz=0;
if(sz>6)sz=6;
startSz=sz;
if(!(cEl=d.getElementById(trgt)))cEl=d.getElementsByTagName(trgt)[0];
cEl.style.fontSize=szs[sz];
for(i=0;i<tgs.length;i++){
cTags=cEl.getElementsByTagName(tgs[i]);
for(j=0;j<cTags.length;j++)cTags[j].style.fontSize=szs[sz];}}
function resizeBrowser(w,h){window.resizeTo(w,h)}
var scrolltotop={
setting:{startline:300,scrollto:0,scrollduration:1000,fadeduration:[500,100]},
controlHTML:'<img src="script/up9.gif" style="width:32px; height:32px" />',
controlattrs:{offsetx:5,offsety:5},
anchorkeyword:'#top',
state:{isvisible:false,shouldvisible:false},
scrollup:function(){
if(!this.cssfixedsupport)
this.$control.css({opacity:0})
var dest=isNaN(this.setting.scrollto)?this.setting.scrollto:parseInt(this.setting.scrollto)
if(typeof dest=="string"&&jQuery('#'+dest).length==1)
dest=jQuery('#'+dest).offset().top
else
dest=0
this.$body.animate({scrollTop:dest},this.setting.scrollduration);},
keepfixed:function(){
var $window=jQuery(window)
var controlx=$window.scrollLeft()+$window.width()-this.$control.width()-this.controlattrs.offsetx
var controly=$window.scrollTop()+$window.height()-this.$control.height()-this.controlattrs.offsety
this.$control.css({left:controlx+'px',top:controly+'px'})},
togglecontrol:function(){
var scrolltop=jQuery(window).scrollTop()
if(!this.cssfixedsupport)
this.keepfixed()
this.state.shouldvisible=(scrolltop>=this.setting.startline)?true:false
if(this.state.shouldvisible&&!this.state.isvisible){
this.$control.stop().animate({opacity:1},this.setting.fadeduration[0])
this.state.isvisible=true}
else if(this.state.shouldvisible==false&&this.state.isvisible){
this.$control.stop().animate({opacity:0},this.setting.fadeduration[1])
this.state.isvisible=false}},
init:function(){
jQuery(document).ready(function($){
var mainobj=scrolltotop
var iebrws=document.all
mainobj.cssfixedsupport=!iebrws||iebrws&&document.compatMode=="CSS1Compat"&&window.XMLHttpRequest
mainobj.$body=(window.opera)?(document.compatMode=="CSS1Compat"?$('html'):$('body')):$('html,body')
mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
.css({position:mainobj.cssfixedsupport?'fixed':'absolute',bottom:mainobj.controlattrs.offsety,right:mainobj.controlattrs.offsetx,opacity:0,cursor:'pointer'})
.attr({title:'Scroll Back to Top'})
.click(function(){mainobj.scrollup();return false})
.appendTo('body')
if(document.all&&!window.XMLHttpRequest&&mainobj.$control.text()!='')
mainobj.$control.css({width:mainobj.$control.width()})
mainobj.togglecontrol()
$('a[href="'+mainobj.anchorkeyword+'"]').click(function(){
mainobj.scrollup()
return false})
$(window).bind('scroll resize',function(e){
mainobj.togglecontrol()})})}}
scrolltotop.init()
