var scroller;
function initindex() {
	if (document.getElementById) {
		function over() {
			this.style.backgroundColor='#eeeeee';
		}
		function out() {
			this.style.backgroundColor='white';
		}
		function click(e) {
			if (document.all) e = window.event;
			var target = e.target?e.target:e.srcElement;
			if (target.nodeName != 'A') {
				var a = this.getElementsByTagName("a");
				if (a.length) {
					var target;
					if (target = a[0].getAttribute("target")) {
						window.open(a[0].getAttribute("href"), target);
					} else {
						document.location.href=a[0].getAttribute("href");
					}
				} else {
					alert ("Error: No A tag exists in this divlnk");
				}
			}
		}
		var tl = document.getElementById("content");
		var eles = tl.getElementsByTagName("div");
		var x;
		for (x = 0; x < eles.length; x ++) {
			if (eles[x].className == 'outline') {
				eles[x].onmouseover = over;
				eles[x].onmouseout = out;
				eles[x].onclick = click;
			}
		}
		scroller = document.getElementById('scroller')
		if (scroller) {
			var innertext = document.createElement('div');
			innertext.style.position="absolute";
			innertext.style.left="455px";
			innertext.style.whiteSpace="nowrap";
			scroller.textelement = innertext;
			scroller.messages = new Array();
			scroller.current = 0;
			var div = scroller.getElementsByTagName('div');
			for (x = 0; x < div.length; x ++) {
				scroller.messages[scroller.messages.length]= div[x].innerHTML;
			}
			scroller.max = x - 1;
			scroller.innerHTML = '';
			innertext.innerHTML = scroller.messages[0];
			scroller.appendChild(innertext);
			var date = new Date();
			scroller.position = date.getTime() + 7280;
			scroller.scrollfunction = function() {
				var date = new Date();
				var newpos = ((scroller.position - date.getTime()) >> 4);
				scroller.textelement.style.left = ((scroller.position - date.getTime()) >> 4) + 'px';
				if (newpos < 0 - scroller.textelement.offsetWidth) {
					scroller.position = date.getTime() + 7280;
					scroller.current ++;
					if (scroller.current > scroller.max) {
						scroller.current = 0;
					}
					scroller.textelement.innerHTML=scroller.messages[scroller.current];
				}
			}
			setInterval(scroller.scrollfunction, 10);
		}
	}
}
function fo(e,t) {
	if (e.value == t) {
		e.value = '';
		e.className = 'tih';
	}
}
function bl(e,t) {
	if ((e.value == t) || (e.value == '')) {
		e.className = 'tih fade';
		e.value = t;
	}
}
var taa=false;
function taao(s) {
	this.e = document.getElementById('advs');
	this.h = false;
	this.s = s;
	this.o = false;
}
taao.prototype.step = function() {
	var c = new Date().getTime();
	var p = (c - this.d) / 100;
	if (p > 1.56) {
		p = 1.56;
	}
	p = Math.sin(p);
	this.p = Math.round(this.f + this.r * p);
	this.e.style.height = this.p + 'px';
	if (this.p == this.t) {
		clearInterval(this.h);
		this.h = false;
	}
}
function ias(s) {
	if (document.getElementById) {
		taa = new taao(s);
		if (s == 0) {
			taa.e.style.height='0px';
		}
	}
}
function ta(ele) {
	if (document.getElementById) {
		if (taa.o == false) {
			taa.o = taa.e.childNodes[0].offsetHeight + 5;
			taa.f = taa.s * taa.o;
		} else {
			taa.f = taa.p;
		}
		if (taa.h) {
			clearInterval(taa.h);
		}
		taa.s = 1 - taa.s;
		taa.t = taa.s * taa.o;
		taa.r = taa.t - taa.f;
		if (taa.r > 0) {
			ele.className = 'vis';
		} else {
			ele.className = '';
		}
		taa.d = new Date().getTime();
		taa.p = taa.f;
		taa.h = setInterval(function() {
			taa.step();
		}, 20);
		return false;
	}
}
function anim() {
	this.timeout=false;
	this.initted=false;
	this.start(['frame1.jpg','bookoffer.jpg','frame2.jpg','bookoffer.jpg'],[5,10,5,10],['','/bookoffer.dyn','','/bookoffer.dyn']);
}
anim.prototype={
step:function(){
	var obj=this;
	this.image++;
	if(this.image>=this.images.length){
		this.image=0;
	}
	this.next=this.frame;
	this.frame=1-this.frame;
	this.frames[this.frame].css('z-index',33);
	this.frames[this.next].css('z-index',32);
	this.frames[this.frame].empty().append(this.images[this.image]);
	this.frames[this.frame].toggleClass('linked',this.images[this.image]._a==''?false:true);
	this.frames[this.frame].fadeIn(2000,function() { obj.frames[obj.next].hide(); });
	this.timeout=setTimeout(function(){ obj.step(); },this.images[this.image]._t*1000);
},
stop:function(){
	if(this.timeout) {
		clearTimeout(this.timeout);
		this.timeout=false;
		this.frames[this.next].hide();
		this.frames[this.frame].hide();
	}
},
click:function() {
	if (this.images[this.image]._a) {
		document.location.href=this.images[this.image]._a;
	}
},
start:function(i,t,a){
	var x,ct,obj=this;
	this.i=i;
	if (!this.initted) {
		this.initted=true;
		this.frames=[];
		this.frames[0]=$('<div/>');
		this.frames[1]=$('<div/>');
		var l=$('#anim');
		$.each(this.frames,function(j) {
			this.addClass('frame');
			this.appendTo(l);
			this.bind('click',function() {
				obj.click();
			});
		});
	}
	this.images=[];
	for(x=0,ct=i.length;x<ct;x++){
		this.images[x]=new Image();
		this.images[x].src='/headers/'+i[x];
		this.images[x]._a=a[x];
		this.images[x]._t=t[x];
	}
	this.image=0;
	this.frame=1;
	this.next=0;
	this.frames[1].css('z-index',33);
	this.frames[0].css('z-index',32);
	this.frames[1].empty().append(this.images[0]);
	this.frames[1].toggleClass('linked',this.images[0]._a==''?false:true);
	this.frames[1].show();
	this.frames[0].hide();
	if(this.images.length>1) {
		this.timeout=setTimeout(function(){ obj.step(); },this.images[0]._t*1000);
	}
}
}
