	//encapsulated script to animate and fade tab content display
	var animatedQuotes = {
		
		init: function(){

			//set animation and fade parameters

			animatedQuotes.div = document.getElementById("QuoteBar");
			animatedQuotes.fadeDiv = document.getElementById("quotelist");
			animatedQuotes.oType = animatedQuotes.getOpacityType(animatedQuotes.fadeDiv);
		},

		changeText: function() {
			listitems = animatedQuotes.fadeDiv.getElementsByTagName("li");
			for (var i = 0; i < listitems.length; i++) {
				//alert(listitems[i].firstChild.nodeValue + ", " + i);
				
				var one = 0;
				var two = 0;
				
				if (quotes.length>1) while (one==two){
					one = Math.floor(Math.random()*quotes.length)+0;
					two = Math.floor(Math.random()*quotes.length)+0;
					//alert(one +" " +two);
				}

				document.getElementById("q1a").firstChild.nodeValue = ""+ quotes[one] +"";
				document.getElementById("q1b").firstChild.nodeValue = quotees[one];
				document.getElementById("q2a").firstChild.nodeValue = ""+ quotes[two] +"";
				document.getElementById("q2b").firstChild.nodeValue = quotees[two];
			}

		},

		fade: function(direction){

			//alert(animatedQuotes.oType);
			//initialise the fade
			if (animatedQuotes.oType != "none"){
				if (direction == "out"){ 
					animatedQuotes.dofade(1, false); 
					setTimeout(function(){animatedQuotes.fade("in");}, 3000);
					setTimeout(function(){animatedQuotes.changeText();}, 2750);
				}else{ 
					animatedQuotes.dofade(0, true); 
					setTimeout(function(){animatedQuotes.fade("out");}, 7500);
				}
		  	}
		},
		
		dofade: function(value, targetvisibility){

			animatedQuotes.fps = 50;
			animatedQuotes.fadeTime = 2.5;
			animatedQuotes.steps = animatedQuotes.fadeTime * animatedQuotes.fps;
			
			value += (targetvisibility ? 1 : -1) / animatedQuotes.steps;
			if (targetvisibility ? value > 1 : value < 0){
				value = targetvisibility ? 1 : 0;
			}
			
			animatedQuotes.setfade(value);
			
			if (targetvisibility ? value < 1 : value > 0){
				setTimeout(function(){animatedQuotes.dofade(value, targetvisibility);}, animatedQuotes.fadeTime / animatedQuotes.fps);
			}
		},
		
		setfade: function(value){
			
			//set the opacity

			animatedQuotes.fadeDiv = document.getElementById("quotelist");

			switch(animatedQuotes.oType){
				case 'ie':
					animatedQuotes.fadeDiv.filters.alpha.opacity = value * 100;
					break;
			
				case 'khtml':
					animatedQuotes.fadeDiv.style.KhtmlOpacity = value;
					break;
			
				case 'moz':
					animatedQuotes.fadeDiv.style.MozOpacity = (value == 1 ? 0.9999999 : value);
					break;
			
				default:
					animatedQuotes.fadeDiv.style.opacity = (value == 1 ? 0.9999999 : value);
			}
		},
		
		getOpacityType: function(oDiv){
			//find the type of opacity used by the browser
			if (typeof oDiv.style.opacity != 'undefined'){
				var otype = 'w3c';
			}else if (typeof oDiv.style.MozOpacity != 'undefined'){
				otype = 'moz';
			}else if (typeof oDiv.style.KhtmlOpacity != 'undefined'){
				otype = 'khtml';
			}else if (typeof oDiv.filters == 'object'){
				otype = (oDiv.filters.length > 0
				&& typeof oDiv.filters.alpha == 'object'
				&& typeof oDiv.filters.alpha.opacity == 'number')
				? 'ie' : 'none';
			}else{ 
				otype = 'none'; 
			}
			return otype;
		},
		
		querySt: function(ji) {
			hu = window.location.search.substring(1);
			gy = hu.split("&");
			for (i=0;i<gy.length;i++) {
				ft = gy[i].split("=");
				if (ft[0] == ji) {
					return ft[1];
				}
			}
		}
		
	}
	
	Core.start(animatedQuotes);

