/****** contact ******/
//feel free to copy & paste *this script* as much as you want.
var exists;
var allStretch;
//the main function, call to the effect object
function init(){
	var divs = document.getElementsByClassName("stretcher");
	allStretch = new fx.MultiFadeSize(divs, {duration: 600});

	items = document.getElementsByClassName("display");
	for (i = 0; i < items.length; i++){
		var h3 = items[i];
		div = h3.nextSibling;
		h3.title = h3.className.replace("display ", "");

		if (window.location.href.indexOf(h3.title) < 0) {
			allStretch.hide(div, 'height');
			if (exists != true) exists = false;
		}
		else exists = true;

		h3.onclick = function(){
			allStretch.showThisHideOpen(this.nextSibling, 100, 'height');
		}
	}
	if (exists == false) $('content').childNodes[1].fs.toggle('height');
}

/****** target ******/
function externallinks() { 
 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") == "new") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externallinks;


/****** no frame ******/
if (top.location != self.location)top.location=self.location;

/****** links ******/

function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
	if (object != "[object]"){ 
		setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
		return;
	}
	clearTimeout(nereidFadeTimers[object.sourceIndex]);
	diff = destOp-object.filters.alpha.opacity;
	direction = 1;
	if (object.filters.alpha.opacity > destOp){
		direction = -1;
	}
	delta=Math.min(direction*diff,delta);
	object.filters.alpha.opacity+=direction*delta;
	if (object.filters.alpha.opacity != destOp){
		nereidFadeObjects[object.sourceIndex]=object;
		nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
	}
}

function clearEvents(o_){o_.onselectstart=o_.ondragstart=o_.oncontextmenu=function(){return false;};}

function initBtn(o_,_color3,_color4,_color5,_color1,_color2){
	o_.counter=0;o_.timer=null;o_.end=true;o_.out=true;
	if (o_.active==null) o_.active=true;else eval("o_.active="+o_.active.toLowerCase());
	if (o_.grouped==null) o_.grouped=false;else eval("o_.grouped="+o_.grouped);
	if (o_.color3==null) o_.color3=_color3;
	if (o_.color4==null) o_.color4=_color4;
	if (o_.color5==null) o_.color5=_color5;
	if (o_.color1==null) o_.color1=_color1;
	if (o_.color2==null) o_.color2=_color2;
	o_.beActive=function(){this.active=true;this.style.backgroundColor=this.color3;this.style.color=this.color2;};
	o_.deActive=function(){this.active=false;this.style.backgroundColor=this.color4;this.style.color=this.color1;};
	if (o_.active) o_.beActive();else o_.deActive();
	o_.doSick=function(){
		if (this.end) return;
		this.style.backgroundColor=(this.counter%2==0) ? this.color3 : this.color5;
		this.counter++;
		if (this.counter==10){
			this.end=true;
			if (!this.out){this.style.backgroundColor=this.color4;this.style.color=this.color1;}
			this.doClick();
			this.counter=0;
		}
		this.timer=window.setTimeout(this.uniqueID+".doSick()",28);
	}
	o_.doOver=function(){
		if (!this.active) return;
		this.style.backgroundColor=this.color4;this.style.color=this.color1;
	}
	o_.doUp=function(){
		if (!this.active) return;
		if (this.timer!=null) window.clearTimeout(this.timer);
		this.end=false;this.counter=0;this.out=false;
		this.timer=window.setTimeout(this.uniqueID+".doSick()",28);
	}
	o_.doOut=function(){
		if (!this.active) return;
		this.style.backgroundColor=this.color3;this.style.color=this.color2;
		this.out=true;
	}
	o_.doDown=function(){
		if (!this.active) return;
		this.style.backgroundColor=this.color5;
	}
	o_.doClick=function(){
		if (this.href!=null){
			var st_=this.getAttribute("target");
			if (st_==null){
				var col_=window.document.getElementsByTagName("base");
				if (col_.length>0) st_=col_[0].target;
				if (st_==null) st_="_self";
			}
			window.open(this.href,st_);
		}
		if (this.grouped==true && this.id!=null){
			var col_=window.document.getElementsByName(this.id);
			for (var m_=0;m_<col_.length;m_++){
				var e_=col_[m_];
				e_.active=(e_!=this);
				if (e_.active) e_.beActive();else e_.deActive();
			}
		}
		if (this.action!=null) eval(this.action);
		if (this.out && this.active){this.style.backgroundColor=this.color3;this.style.color=this.color2;}
	}
	o_.sick=function(){this.end=true;this.counter=0;this.doClick();}
	o_.onclick=null;
	o_.onmouseover=o_.doOver;
	o_.onmousedown=o_.doDown;
	o_.onmouseup=o_.doUp;
	o_.onmouseout=o_.doOut;
	o_.doOut();
	if (!o_.active) o_.deActive();
}


