
//****** here's the brains of the AUTOMATIC ROLLOVERS: finds links with class="rollover"
//****** and sets the events to the proper function; part II, "roll()", does the image swap
function setRollovers() {

	if (document.layers) return 0; // keep nasty NS4.7 out
	
	c = document.links.length;
	
	for (i = 0; i < c; i++) {

		if (document.links[i].className == 'rollover') {
			document.links[i].onmouseover = function(){ roll(this) };
			document.links[i].onmouseout = function(){ roll(this) };
		}
		
	}

} // end 

//****** PART II: automatic rollover function: set the path, and the "over" name for the files
//****** add this code to your links:  class="rollover"
function roll(el) {
	
	//--------------------------------//
	//****** user-set variables ******//
	//--------------------------------//
	
	//****** set your site extension; i.e. '.ca', '.com', etc. (or port number)		
	var siteExt = ':8080';	
	
	//****** set how the rollover images are named (**must follow the convention of "name.gif" / "name_over.gif",
	//****** where the rollover image starts with the same name as the original (don't have to use "_over", or gif's)**)
	var overName = '_over';
	
	//****** image extension	
	var ext = '.gif';
	
	//-----------------------------------//
	//****** end of user variables ******//
	//-----------------------------------//
		

	
	var elchild = el.childNodes;
	var imgPath = elchild[0].src;
	var sitePath = imgPath.substring(0, imgPath.indexOf(siteExt) + siteExt.length + 1);	
	var imgSrc = imgPath.substring(sitePath.length, imgPath.indexOf(ext));
	
	imgPath = sitePath; 
	imgPath += (imgSrc.indexOf(overName) == -1) ? imgSrc + overName : imgSrc.substring(0, imgSrc.length - overName.length); 
	imgPath += ext;

	elchild[0].src = imgPath;

} // end




//****** tricky guy animation stuff ******

//*** set variables
var coords, stretch, grow, thing, thing2, bgInfo;
var c = 1, s = 1, ready = true;

//*** set animation speed in milliseconds
var delay = 80;


//****** set up animation parameters for location (coords) and height (stretch) change
function setUp(el1,el2,isReg) {

	if (document.layers) return 0; // keep nasty NS4.7 out, and, unfortunately, IE (can't handle the CSS)	
	
	thing = (document.getElementById ? document.getElementById(el1) : document.all.el1).style;
	thing2 = (document.getElementById ? document.getElementById(el2) : document.all.el2).style;
	
	if (!isReg) { // intro animation
	
		coords = new Array(-40,-35,-20,-10,0,10,20,30,40,60,90,120,140,160,170,175,180,183,185,187,190,200,220,240,260,280,300,310,320,340,360,370,375,378,380,377,370,355,340,330,325,320,318,316,315);
		stretch = new Array(30,33,39,45,55,65,73,78,81,83,84);
		
		//*** overlap value, where the second animation starts before the first is over, in number of steps
		grow= 11;
		
		//*** starting height
		thing2.height = '30px';
		
	}
	else { // set up for page animations
	
		//*** remove background for stupid IE
		if (document.all) {
			document.all.bg.style.background = 'none';
			bgInfo = 'url(imgs/site/trickyguy_content_bg.gif) center 0px no-repeat fixed';
		}
		
		coords = new Array(-40,-40,-20,-10,0,10,20,30,36,41,43,44);
		stretch = new Array(45,55,65,85,140,190,260,310,378,390,397,400);
		
		//*** overlap value 
		grow = 3;
		
		//*** starting height
		thing2.height = '45px';
		
	}
	
	//*** start element at first "coords" value
	thing.top = coords[0] + 'px';
	thing.visibility = 'visible';
	
	//*** start animating!
	if (document.all) {
		// IE can't do CSS animation - very well, so let's skip it
		thing.top = coords[coords.length - 1] + 'px';
		thing2.height = stretch[stretch.length - 1] + 'px';
		if (isReg) {
			//fixed_delayout();
			document.getElementById('con').style.display = 'block';
			document.all.bg.style.background = bgInfo; 
			document.all.bg.style.marginLeft = '10px';
		}
	}
	else animate();
	

} // end



function animate() {
	
	//*** element is moved to each position in the "coords" array
	thing.top = coords[c] + 'px';
	
	//*** advance array index
	c++;
	
	if (c < coords.length) { //*** keep calling animate() until last array value
	
		//*** start second animation (can overlap first animation by the "grow" value)
		if (c > coords.length - grow && ready) openWide();		

		setTimeout('animate()', delay);
	}

} // end





function openWide() {

	//*** only call this function once
	if (ready) ready = false; 
	
	//*** get height value from "stretch"
	thing2.height = stretch[s] + 'px';
	
	s++;
	
	
	if (s < stretch.length) setTimeout('openWide()', delay); //*** repeat till done
	else {
		fixed_delayout(); // can't remember what this does; from other script for IE
		
		if (grow < 11) {
			//*** page animation - pop in text when container is full size
			document.getElementById('con').style.display = 'block';
			
			//*** replace background for stupid IE
			if (document.all) {document.all.bg.style.background = bgInfo; document.all.bg.style.marginLeft = '10px';} //*** compensate for scrollbar
		}
		
		return 0;
	}

} // end



function viewPic(page) {

	window.open(page,'v','width=650,height=560,location=no,menubar=no,resizable=yes,status=no,scrollbars=yes,toolbar=no');

} // end