// JavaScript Document

var rotimer;

function starttimer(imgt) {
	//var funct = 'imgset(itype)';
	rotimer = setTimeout('imgset("'+imgt+'")',9500);
}

var counter= 2;

function imgset(imgt) {
	var image1 = document.getElementById('rotimg');
	if (counter <=4) {
		image1.src = './rotate/' + imgt + counter + '.jpg';
		counter++;
		}
	else {
		counter = 1;
		image1.src = './rotate/' + imgt + counter + '.jpg';
		counter++;
	}
	var funct = 'imgset("'+imgt+'")';
	rotimer = setTimeout(funct,5000);
}

function killtimer() {
	clearTimeout(rotimer);	
}

var quot = 0;

function quottimer() {
	var quotes = setTimeout("quotate()",11000);
	
}


function quotate() {
  	new Effect.Opacity('quote', {duration:0.5, from:1.0, to:0.0});
	options = {
		asynchronus:true,
		onComplete:function() {	new Effect.Opacity('quote', {duration:0.6, from:0.0, to:1.0})}
	}
	var tm=setTimeout("new Ajax.Updater('quote','quotate.php',options)",600);
	quot++;
	quottimer();
	}
	

	
var tert = '';
var killtm = '';
	
function flyout(divid) {
	stoptmr();	
	if (tert != '' && tert != divid) {
		document.getElementById(tert).style.display = 'none';
		tert = '';		
		}
	else if (tert == divid) {
		
		return;
	}
	tert =  divid;
	var options = {duration: 0.15,onFinish:function() {tert =  divid;}};
	new Effect.BlindRight(divid,options);
}

function clrtimer() {
	killtm = setTimeout('flyin()', 1000);
	}
	
function stoptmr(){
	clearTimeout(killtm);
	}
	
function flyin() {
	stoptmr();
	var options = {duration: 0.15,onFinish: function() {stoptmr();}};
	new Effect.BlindLeft(tert,options);
	tert = '';
	 }
	 
var currdiv = '';
var plimg = './images/plus.gif';
var minimg = './images/minus.gif';

function showdiv(divid) {
	var thediv = $(divid);
	if (currdiv != '' && currdiv != divid) {
		$(currdiv).style.display = 'none';
		$(divid + 'act').src = plimg;
		$(currdiv + 'act').src = plimg;
		currdiv = divid;
		//document.getElementById(plim).src = './images/plus.gif';
		}
	if (thediv.style.display != 'block') {
		currdiv = divid;
		thediv.style.display='block';
		$(divid + 'act').src = minimg;
		}
	else {
		thediv.style.display = 'none';
		$(divid + 'act').src = plimg;
		currdiv = '';
		}
	}

var def_img = '';
var curr_img = '';

function swap_rt(newimg) {
	//var rtimg = document.getElementById('rotimg');
	if (def_img == '') {
		def_img = $('rotimg').src;
		}
	if (curr_img != newimg) { 
		$('rotimg').src = newimg;
		curr_img = newimg;
	}
	else {
		$('rotimg').src = def_img;
		curr_img = def_img;
		}
		
}
