﻿  /* *********************** Notices for the sidde panel ********** */
 
  var timeout = 7000;	// time to keep one notice up
  var transition = 2000;// time for the fade
  var pause = 100;		// time to hold blank notice
  var noOfQuotes = 4;	// the number of quote div to cycle through

/* internals */

  var homeUrl;
  var currentUrl;
  
  var firstLinkConnections = [];
  var count = 1;
  var timer;
  var old;
  
  function go (i){
  	dojo.fadeOut({node: "quote"+i,duration: transition}).play();
  }
  
  function divOut() {
	old = count;
  	if (count==noOfQuotes) {
  		count=1;
  	} else {
  		count +=1;
  	}
	dojo.fadeOut({node: "quote"+old,duration: transition}).play();
  	timer = setTimeout(divIn, pause+ transition);
  }

  function divIn() {
  	i = old;
  	var oldNode = dojo.byId("quote"+old);
  	var newNode = dojo.byId("quote"+count);


  	oldNode.style.display = "none"
  	newNode.style.display = "block"
	dojo.fadeIn({node: "quote"+count,duration: transition}).play();
	timer = setTimeout(divOut, timeout + transition);
  }

  function timerOff() {
  	clearTimeout(timer);
  }

  function timerOn() {
  	timer = setTimeout(divOut, timeout);
  }

  function addMouseEvents(nodeName) {
  	var eventNode = dojo.byId(nodeName);
	firstLinkConnections[0] = dojo.connect(eventNode, 'onmouseover', null, timerOff);
	firstLinkConnections[1] = dojo.connect(eventNode, 'onmouseout', null, timerOn);
  }

	function goto(page) {
		location.href=page;

	}
	
 dojo.addOnLoad(function(){ 
	old = noOfQuotes;
	count = 1;
  	addMouseEvents("clientQuotes");
  	var newNode = dojo.byId("quote"+count);

  	newNode.style.display = "block"
/*	for (i=1; i<= maxDivs; i++) {
		nodes[i] = dojo.byId("animDiv"+i);
		if (i ==1) nodes[1].style.display = "block";		
		else dojo.fadeOut({node: "animDiv"+i,duration: 100}).play();
	}
*/
	timer = setTimeout(divOut, timeout);
	})

	function showVision () {
	 var node = dojo.byId("vision");
	 node.style.display = "block";
 	}
 	
 	function hideVision () {
	 var node = dojo.byId("vision");
	 node.style.display = "none";
 	}
 	
/*
* sendto 
*  - function e-mail hiding. stops email address harvesters collecting e-mails by hiding
*     the address in this java code.
*  - param's 
*     name       - name to left of @
*     domain name - domain name address from @ to first .
*     dot        - the final bit of email address bit after first dot
*     comment    - this is the text displayed on the web page
*     class name  - if required set to the class name to use for the link
*     extension  - main to extension ie subject and body must be the complete string to append to the mailto
*                    eg ?Subject='Support Request'&amp;Body='drear Joe,'
*
*	eg sendto('fred','lasa','co.uk','e-mail support', 'links', '?Subject="Support Request"&amp;Body="dear Joe,"');
*         will send an e-mail to fred@lasa.co.uk
*/
function sendto (name, domainname, dot, comment, classname, extension)
{
	address = name+"@"+domainname+"."+dot+extension;	
	document.write("<a href=");
	document.write("\"mail"+"to"+":"+address+"\" ");
	document.write("title=\"mail to "+address+"\" "); 
	if (classname !== "")
	   {document.write(" class=\""+classname+"\"");}
	document.write(">"+comment+"</a>");
}
 	