// |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 
// Coded by Travis Beckham
// http://www.squidfingers.com | http://www.podlob.com
// If want to use this code, feel free to do so, but please leave this message intact.
// If you do remove this, I will hunt you down :)
//
// |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// --- myapi version date: 03/29/02 ------------------------------------------------------
//
// ---------------------------------------------------------------------------------------
// Several functions added or modified by Scott Upton, Uptonic.com
// January 2005
// ---------------------------------------------------------------------------------------
// 
// Detect = function(){
// 	var agent = navigator.userAgent.toLowerCase(); 
// 	this._mac = agent.indexOf('mac') != -1;
// 	this._win = !this._mac;
// 	this._w3c = document.getElementById;
// 	this._iex = document.all;
// 	this._ns4 = document.layers;
// }
// Detect.prototype.getObj = function(name){
// 	if(this._w3c){
// 		return document.getElementById(name);
// 	}else if(this._iex){
// 		return document.all[name];
// 	}else if(this._ns4){
// 		return this.getObjNS4(document,name);
// 	}
// }
// Detect.prototype.getObjNS4 = function(obj, name){
// 	var d = obj.layers;
// 	var result,temp;
// 	for(var i=0; i<d.length; i++){
// 		if(d[i].id == name){
// 		 	result = d[i];
// 		}else if(d[i].layers.length){
// 			var temp = this.getObjNS4(d[i],name);
// 		}
// 		if(temp){
// 			result = temp;
// 		}
// 	}
// 	return result;
// }
// Detect.prototype.getStyle = function(obj){
// 	return (this._ns4) ? obj : obj.style;
// }
// Detect.prototype.getWindowWidth = function(){ // width of the window
// 	return this._iex ? document.body.clientWidth : window.innerWidth;
// }
// Detect.prototype.getWindowHeight = function(){ // height of the window
// 	return this._iex ? document.body.clientHeight : window.innerHeight;
// }
// Detect.prototype.getScrollTop = function(){ // top scroll position of the window
// 	return this._iex ? document.body.scrollTop : window.pageYOffset;
// }
// Detect.prototype.getScrollLeft = function(){ // left scroll position of the window
// 	return this._iex ? document.body.scrollLeft : window.pageXOffset;
// }
// Detect.prototype.setScrollTop = function(n){ // set the vertical scroll position of the window
// 	window.scrollTo(this.getScrollLeft(),n);
// }
// Detect.prototype.setScrollLeft = function(n){ // set the horizontal scroll position of the window
// 	window.scrollTo(n,this.getScrollTop());
// }
// Detect.prototype.setScroll = function(x,y){ // set the x,y scroll position of the window
// 	window.scrollTo(x,y);
// }
// 
// // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
// 
// // HTMLobj Constructor
// 
// HTMLobj = function(name){
// 	if(name){
// 		this._inherit = Detect; this._inherit(name);
// 		this._id  = name;
// 		this._el  = this.getObj(this._id);
// 		this._css = this.getStyle(this._el);
// 		this._obj = name+'Object'; eval(this._obj+'=this');	
// 		this._timer = null;
// 		this._glideRunning = false;
// 		this._tweenRunning = false;
// 		this._fadeRunning = false;	// Added by SU, Couloir
// 		this._randNum = null;		// Added by SU, Couloir
// 		this._startFade = false;	// Added by SU, Couloir
// 		return this;
// 	}
// }
// HTMLobj.prototype = new Detect();
// 
// HTMLobj.prototype.getLeft = function(){ // left position of the element
// 	return parseInt(this._css.left || 0);
// }
// HTMLobj.prototype.getTop = function(){ // top position of the element
// 	return parseInt(this._css.top || 0);
// }		
// HTMLobj.prototype.getWidth = function(){ // width of the element
// 	if(this._ns4){
// 		 return this._el.document.width;
// 	}else{
// 		return this._el.offsetWidth;
// 	}
// }
// HTMLobj.prototype.getHeight = function(){ // height of the element
// 	if(this._ns4){
// 		 return this._el.document.height;
// 	}else{
// 		return this._el.offsetHeight;
// 	}
// }
// HTMLobj.prototype.getClipWidth = function(){ // clip width of the element
// 	if(this._ns4){
// 		 return this._el.clip.width;
// 	}else{
// 		return this._el.offsetWidth;
// 	}
// }
// HTMLobj.prototype.getClipHeight = function(){ // clip height of the element
// 	if(this._ns4){
// 		 return this._el.clip.height;
// 	}else{
// 		return this._el.offsetHeight;
// 	}
// }
// HTMLobj.prototype.setStyle = function(prop, val){ // change the value of any css property
// 	if(!this._ns4){
// 		this._el.style[prop] = val;
// 		if(this._iex && this._mac){
// 			this._el.innerHTML = this._el.innerHTML;
// 		}
// 	}
// }
// HTMLobj.prototype.show = function(){ // show the visibility of the element
// 	this._css.visibility = 'visible';
// }
// HTMLobj.prototype.hide = function(){ // hide the visibility of the element
// 	this._css.visibility = 'hidden';
// }
// HTMLobj.prototype.showhide = function(){ // toggle the visibility of the element
// 	if(this._css.visibility == 'hidden' || this._css.visibility == 'hide'){
// 		this._css.visibility = 'visible';
// 	}else{
// 		this._css.visibility = 'hidden';
// 	}
// }
// HTMLobj.prototype.setInner = function(html){ // change the contents of the element
// 	if(this._ns4){
// 		this._el.document.open();
// 		this._el.document.write(html);
// 		this._el.document.close();
// 	}else{
// 		this._el.innerHTML = html;
// 	}
// }
// HTMLobj.prototype.moveTo = function(x,y){ // move the element to a new position
// 	if(this._ns4){
// 		this._el.moveTo(x,y);
// 	}else{
// 		this._css.left = x;
// 		this._css.top  = y;
// 	}
// }
// HTMLobj.prototype.moveBy = function(x,y){ // move the element to a new position relative to it's current position
// 	if(this._ns4) {
// 		this._el.moveBy(x,y);
// 	}else{
// 		this._css.left = this.getLeft()+x;
// 		this._css.top  = this.getTop()+y;
// 	}
// }
// HTMLobj.prototype.sizeTo = function(w,h){ // set the size of the element
// 	if(!this._ns4){
// 		this._css.width = w+'px';
// 		this._css.height = h+'px';
// 	}
// }
// HTMLobj.prototype.sizeBy = function(w,h){ // set the size of the element relative to it's current size
// 	if(!this._ns4){
// 		this._css.width = this.getWidth()+w+'px';
// 		this._css.height = this.getHeight()+h+'px';
// 	}
// }
// HTMLobj.prototype.glideTo = function(x,y,callback){ // ease-out animation, callback function optional
// 	if(this._glideRunning){
// 		var left = this.getLeft();
// 		var top  = this.getTop();
// 		if(Math.abs(left-x)<=1 && Math.abs(top-y)<=1){
// 			this.moveTo(x,y);
// 			this.cancelGlide();
// 			if(callback){
// 				eval(this._obj+'.'+callback+'()');
// 			}
// 		}else{
// 			this.moveTo(left+(x-left)/2, top+(y-top)/2);
// 		}
// 	}else{
// 		var c = (callback) ? ',\"'+callback+'\"' : '' ;
// 		this._timer  = setInterval(this._obj+'.glideTo('+x+','+y+c+')',100);
// 		this._glideRunning = true;
// 	}
// }
// HTMLobj.prototype.cancelGlide = function(){ // cancel the glideTo method
// 	clearInterval(this._timer);
// 	this._timer = null;
// 	this._glideRunning = false;
// }
// HTMLobj.prototype.swapDepth = function(obj){ // swap the z-index of 2 elements
// 	var temp = this._css.zIndex;
// 	this._css.zIndex = obj._css.zIndex;
// 	obj._css.zIndex = temp;
// }
// // -------------------------------------------
// // Modified by SU, Uptonic.com
// // -------------------------------------------
// HTMLobj.prototype.tweenTo = function(method, start, end, time){ // time-based animation, with multiple easing methods
// // method: a function that takes 4 arguments: time, start, change, and duration
// // start: array of starting width, height dimensions [w, h]
// // end: array of ending width, height dimensions [w, h]
// // time: number of 'frames' it takes to get to the end position
// 	if(!this._tweenRunning){
// 		this._tweenTime = 0;
// 		var s = '['+start.toString()+']';
// 		var e = '['+end.toString()+']';
// 		this._timer = setInterval(this._obj+'.tweenTo('+method+','+s+','+e+','+time+')', 33);
// 		this._tweenRunning = true;
// 	}
// 	if(++this._tweenTime > time){
// 		this.cancelTween();
// 	}else{
// 		var w = method(this._tweenTime, start[0], end[0]-start[0], time);
// 		var h = method(this._tweenTime, start[1], end[1]-start[1], time);
// 		this.sizeTo(w,h);
// 	}
// }
// HTMLobj.prototype.cancelTween = function(){ // cancel the tweenTo method
// 	clearInterval(this._timer);
// 	this._timer = null;
// 	this._tweenRunning = false;
// 	this._startFade = true;
// }
// 
// // -> Easing Equations by Robert Penner - robertpenner.com -
// linearTween = function(t, b, c, d){
// 	return c*t/d + b;
// }
// easeInQuad = function(t, b, c, d){
// 	t /= d;
// 	return c*t*t + b;
// }
// easeOutQuad = function(t, b, c, d){
// 	t /= d;
// 	return -c * t*(t-2) + b;
// }
// easeInOutQuad = function(t, b, c, d){
// 	t /= d/2;
// 	if (t < 1) return c/2*t*t + b;
// 	t--;
// 	return -c/2 * (t*(t-2) - 1) + b;
// }
// easeInExpo = function(t, b, c, d){
// 	return c * Math.pow( 2, 10 * (t/d - 1) ) + b;
// }
// easeOutExpo = function(t, b, c, d){
// 	return c * ( -Math.pow( 2, -10 * t/d ) + 1 ) + b;
// }
// // -------------------------------------------
// // Added by SU, Uptonic.com
// // December 2004 - January 2005
// // -------------------------------------------
// HTMLobj.prototype.getRandom = function(start,end){ // generate new random number
//     this._randNum= Math.round(start + ((end-start) * Math.random()));
//     return this._randNum;
// }
// HTMLobj.prototype.setOpacity = function(opacity){ // set opacity of the element
// 	// Fix for math error in some browsers
// 	opacity = (opacity == 100)?99.999:opacity;
// 	// IE/Windows
// 	this._css.filter = "alpha(opacity:"+opacity+")";
// 	// Safari < 1.2, Konqueror
// 	this._css.KHTMLOpacity = opacity/100;	
// 	// Older Mozilla and Firefox
// 	this._css.MozOpacity = opacity/100;
// 	// Safari 1.2, newer Firefox and Mozilla, CSS3
// 	this._css.opacity = opacity/100;
// }
// HTMLobj.prototype.fadeOut = function(opacity, change, speed){ // gradually decrease the opacity of the element
// // opacity: starting opacity of element
// // change: the size of the increments between steps
// // speed: the rate of the animation
// 	if (opacity >= 0){
// 	  this._fadeRunning = true;
// 	  this.setOpacity(opacity);
// 	  opacity -= change;
// 	  setTimeout(this._obj+'.fadeOut('+opacity+','+change+','+speed+')', speed);
// 	} else {
// 		this._fadeRunning = false;
// 		this.hide();
// 	}
// }
// HTMLobj.prototype.fadeIn = function(opacity, change, speed){ // gradually increase the opacity of the element
// // opacity: starting opacity of element
// // change: the size of the increments between steps
// // speed: the rate of the animation	
// 	if (opacity <= 100){
// 	  this.show();
// 	  this._fadeRunning = true;
// 	  this.setOpacity(opacity);
// 	  opacity += change;
// 	  setTimeout(this._obj+'.fadeIn('+opacity+','+change+','+speed+')', speed);
// 	} else {
// 		this._fadeRunning = false;
// 		this.setOpacity(100);
// 	}
// }
// HTMLobj.prototype.displayShow = function(){ // display the element as 'block'
// 	this._css.display = 'block';
// }
// HTMLobj.prototype.displayHide = function(){ // do not display the element
// 	this._css.display = 'none';
// }
// HTMLobj.prototype.setSrc = function(target){ // set the element's source to target
// 	this._el.src = target;
// }
// HTMLobj.prototype.setHref = function(target){ // set the element's link to target
// 	this._el.href = target;
// }
// HTMLobj.prototype.setInnerHtml = function(content){ // set the element's inner HTML to content
// 	this._el.innerHTML = content;
// }
// 
// 
// 
// 
// 
// 
// 
// 
// 	// set the edit parameters
// /*	ar = Vals.split('&');
// 	var regexstr = '';
// 
// 	for (i=0; i<ar.length; i++) { eval(ar[i]); }
// 	var regexstr = '';
// 	for (i=0; i<deeps.length; i++) {
// 		reg = reg + eval(deeps[i])+'\\=\\[';
// 		row = row + eval(deeps[i])+'=[';
// 		regend = end + '\\]';
// 		rowend = end + ']';
// 		if (Deep == deeps[i]) break;
// 	}
// 	re = new RegExp(reg+'(\\w+)'+regend);
// 	Res = re.exec(document.DEUS.addTHEME.value);
// 
// 	var val;
// 	if (localCriteria) {
// 		if (eval(localCriteria)) { eval(Deep+' = "N"'); }
// 		else { eval(Deep+' = "Y"'); }
// 	}
// 
// 	if (realVal) document.DEUS.addTHEME.value = realVal+', '+ref;
// 	else document.DEUS.addTHEME.value = ref;	
// 
// 	document.DEUS.addTHEME.value = realVal+', '+ref;
// 
// 	} else {
// 	}
// 
// 
// */
// 
// 
// /*	re = new RegExp(
// 			DO+'\\=\\['+DO_AL+'\\=\\['+
// 			SE+'\\=\\['+SE_AL+'\\=\\['+
// 			SI+'\\=\\['+SI_AL+'\\=\\['+
// 			PA+'\\=\\['+PA_AL+'\\=\\['+
// 			TA+'\\=\\['+TA_AL+'\\=\\['+
// 			CO+'\\=\\['+VAL+'\\+ATTR+'sID\\=\\['+sID+
// 			'\\=\\['+alias+'\\=\\['+tab+'\\=\\['+col+
// 			'\\=\\[attsc\\=\\['+attr+'\\=\\[(\\w+)\\]\\]\\]\\]\\]\\]\\]');
// 	
// 
// 	var ref = '';
// 	var re; var val2;
// 	if (val == 'SWITCH_YES_NO') { val2 = 'Y'; }
// 	if (tab && col) {
// 
// 		re = new RegExp(DO+'\\=\\['+DO_AL+'\\=\\['+SE+
// 				'\\=\\[A\\=\\['+SI+'\\=\\[A\\=\\['+PA+
// 				'\\=\\[A\\=\\['+PA_AL+'\\=\\['+TA+
// 				'\\=\\['+CO+'\\=\\['+VAL+ATTR+'sID\\=\\['+sID+
// 				'\\=\\['+alias+'\\=\\['+tab+'\\=\\['+col+
// 				'\\=\\[attsc\\=\\['+attr+'\\=\\[(\\w+)\\]\\]\\]\\]\\]\\]\\]');
// 
// 		re = new RegExp(DO+'\\=\\['+DO_AL+'\\=\\['+SE+'\\=\\[A\\=\\['+SI+'\\=\\[A\\=\\['+PA+'\\=\\[A\\=\\['+PA_AL+
// 				'\\=\\['+TA+'\\=\\['+CO+'\\=\\['+VAL+ATTR+'sID\\=\\['+sID+'\\=\\['+alias+'\\=\\['+tab+'\\=\\['+col+'\\=\\[attsc\\=\\['+attr+'\\=\\[(\\w+)\\]\\]\\]\\]\\]\\]\\]');
// 
// 	} else if (tab) {
// 
// 		re = new RegExp('sID\\=\\['+sID+'\\=\\['+alias+'\\=\\['+tab+'\\=\\[attst\\=\\['+attr+'\\=\\[(\\w+)\\]\\]\\]\\]\\]\\]');
// 
// 	}
// 	results = re.exec(document.DEUS.addTHEME.value);
// 
// 	if (val == 'SWITCH_YES_NO' && results && results[1] == val2) { val = 'N'; }
// 	else if (val == 'SWITCH_YES_NO') { val = val2; }
// 	
// //	stringName.length
// 	
// 	if (tab && col) {
// 		ref = 'sID=['+sID+'=['+alias+'=['+tab+'=['+col+'=[attsc=['+attr+'=['+val+']]]]]]]';
// 	} else if (tab) {
// 		ref = 'sID=['+sID+'=['+alias+'=['+tab+'=[attst=['+attr+'=['+val+']]]]]]';
// 	}
// 	
// 	var realVal = document.DEUS.addTHEME.value;
// 
// 	if (results) {
// 		document.DEUS.addTHEME.value = realVal.replace(re,ref);
// 	} else {
// 		if (realVal) {
// //			realVal = realVal.substr(0,realVal.length-1);
// 			document.DEUS.addTHEME.value = realVal+', '+ref;
// 		} else {
// 			document.DEUS.addTHEME.value = ref;	
// 		}
// 	}
// //	window.alert("addTHEME after: "+document.DEUS.addTHEME.value);
// }
// 
// */
// 
// var switchImages
// function switchIconImage(Path,Name) {
// 	myRe = new RegExp("/system/images/formDisplay/icons/"+Name+".gif$");
// 	eval("if (myRe.exec(document.DEUS.img_"+Path+".src)) "+
// 		"{ document.DEUS.img_"+Path+".src=\"/pub/SYSTEM/images/formDisplay/icons/"+Name+"_v2.gif\"; }"+ 
// 		" else { document.DEUS.img_"+Path+".src=\"/pub/SYSTEM/images/formDisplay/icons/"+Name+".gif\"; }"); 
// }
// 
// /*
// 
// // switch location of default and set color
// function renderColors(sID,attr) {
// 	var i = 0;
// 	var tmp;
// 	// set table color
// 	if (document.getElementById('matrix_'+sID).bgColor == eval("DTREE_"+attr+"_"+sID+"_tab")) {
// 		eval("document.getElementById('matrix_"+sID+"').bgColor = DTREE_DEFCOLORS_"+sID+"_tab");		
// 	} else {
// 		eval("document.getElementById('matrix_"+sID+"').bgColor = DTREE_"+attr+"_"+sID+
// 				"_tab || DTREE_DEFCOLORS_"+sID+"_tab");
// 	}
// 
// 	// set column colors
// 	while (document.getElementById('matrix_'+sID+'__'+i) != null) {
// 		if (document.getElementById('matrix_'+sID+"__"+i).bgColor == eval("DTREE_"+attr+"_"+sID+"_col["+i+"]")) {
// 			eval("document.getElementById('matrix_"+sID+"__"+i+"').bgColor = "+
// 					"DTREE_DEFCOLORS_"+sID+"_col["+i+"]");		
// 		} else {
// 			eval("document.getElementById('matrix_"+sID+"__"+i+"').bgColor = "+
// 					"DTREE_"+attr+"_"+sID+"_col["+i+"] || DTREE_DEFCOLORS_"+sID+"_col["+i+"]");
// 		}
// 		i++;
// 	}
// 
// 	// set row and values colors
// 	var i = 0;
// 	while (document.getElementById('matrix_'+sID+'_'+i) != null) {
// 		var j = 0;
// 		if (document.getElementById('matrix_'+sID+"_"+i).bgColor == eval("DTREE_"+attr+"_"+sID+"_row["+i+"]")) {
// 			eval("document.getElementById('matrix_"+sID+"_"+i+"').bgColor = "+
// 					"DTREE_DEFCOLORS_"+sID+"_row["+i+"]");
// 		} else {
// 			eval("document.getElementById('matrix_"+sID+"_"+i+"').bgColor = "+
// 					"DTREE_"+attr+"_"+sID+"_row["+i+"] || DTREE_DEFCOLORS_"+sID+"_row["+i+"]");
// 		}
// 
// 		while (document.getElementById('matrix_'+sID+'_'+i+'_'+j) != null) {
// 			if (document.getElementById('matrix_'+sID+"_"+i+"_"+j).bgColor == eval("DTREE_"+attr+"_"+sID+"_val["+i+"]["+j+"]")) {
// 				eval("document.getElementById('matrix_"+sID+"_"+i+"_"+j+"').bgColor = "+
// 						"DTREE_DEFCOLORS_"+sID+"_val["+i+"]["+j+"]");
// 			} else {
// 				eval("document.getElementById('matrix_"+sID+"_"+i+"_"+j+"').bgColor = "+
// 						"DTREE_"+attr+"_"+sID+"_val["+i+"]["+j+"] || DTREE_DEFCOLORS_"+sID+"_val["+i+"]["+j+"]");
// 			}
// 			j++;
// 		}
// 		i++;
// 	}
// }
// */
// 
// function switchIcon(Path,val) {
// 	
// 	var i = 1;
// 	while (document.getElementById('switch_'+Path+'-'+i)) {
// 		if	(document.getElementById('switch_'+Path+'-'+i).style.display=='none') {
// 			document.getElementById('switch_'+Path+'-'+i).style.display='inline';	
// 
// 		} else if (document.getElementById('switch_'+Path+'-'+i).style.display=='inline') {
// 			document.getElementById('switch_'+Path+'-'+i).style.display='none';
// 
// 		} else if (val == 'block') {
// 			document.getElementById('switch_'+Path+'-'+i).style.display='inline';
// 
// 		} else if (val == 'none') {
// 			document.getElementById('switch_'+Path+'-'+i).style.display='none';
// 
// 		} else {		
// 			document.getElementById('switch_'+Path+'-'+i).style.display='inline';
// 		}
// 		i++;
// 	}
// }
// 
// 
// 
// 
// function imgGallery(id,photoDir,photoArray,borderSize,slideShowTime,continuity) {
// 
// 	// This part coded by Scott Upton
// 	// http://www.uptonic.com | http://www.couloir.org	
// 
// //	var photoDir = "images/"; // Location of photos for gallery
// //	var photoArray = new Array( // 	Define each photo's name, height, width, and caption
// //		// Source, Width, Height, Caption
// //		new Array("3.jpg", "500", "280", "Door 3 - Click on the image to view previous or next image"),
// //		new Array("2.jpg", "425", "319", "Door 2 - Click on the image to view previous or next image"),             
// //		new Array("1.jpg", "700", "260", "Door 1 - Click on the image to view previous or next image")
// //	);
// 
// //	var borderSize = 6;	 // = 2x CSS border size
// //	var slideShowTime = 3; // time to loop, 0 = off
// 
// 	// get current photo id from URL
// 	var thisURL = document.location.href;
// 	var splitURL = thisURL.split("#");
// 	var photoId = splitURL[1] - 1;
// 	
// 	// if no id in query string then set to 0
// 	photoId = (!photoId)? 0:photoId;
// 		
// 
// 	// Number of photos in this gallery
// 	var photoNum = photoArray.length;
// 	
// 	// Create access to 'Detect' object and a place to put instances of 'HTMLobj'
// 	API = new Detect();
// 	
// 	// CREATE INSTANCES & LOAD
// 	loadAPI = function(){
// 		// Instantiate HTMLobj
// 		API.Container		= new HTMLobj('Container'+id);
// 		API.Photo			= new HTMLobj('Photo'+id);
// 		API.PhotoContainer	= new HTMLobj('PhotoContainer'+id);
// 		API.LinkContainer	= new HTMLobj('LinkContainer'+id);
// 		if (continuity != 1) API.PrevLink = new HTMLobj('PrevLink'+id);
// 		if (continuity != 1) API.NextLink = new HTMLobj('NextLink'+id);
// 		API.CaptionBlock	= new HTMLobj('CaptionBlock'+id);
// 		API.Counter			= new HTMLobj('Counter'+id);
// 		API.Caption			= new HTMLobj('Caption'+id);
// 		API.LoadImg			= new HTMLobj('LoadImg'+id);
// 		
// 		// Show initial photo
// //		if (continuity != 1) photoId++;
// 		cyclePhoto(photoId);
// 	}
// 	
// 	onload = loadAPI;
// 	
// 	// Fade in photo when it is loaded from the server
// 	initFade = function(){
// 		// Show PhotoContainer again
// 		API.PhotoContainer.show();
// 		
// 		// Be certain the tween is complete before fading, too
// 		var fade_timer = setInterval('startFade()', 300);
// 						
// 		// Fade photo in when ready and clear listener
// 		startFade = function(){
// 			if(API.Container._tweenRunning == false){
// 				clearInterval(fade_timer);
// 				
// 				// Be certain fade is done running before allowing next/previous links to work
// 				// This avoids rapid fade-in when users click next/previous links in quick succession
// 				var adv_timer = setInterval('permitNextPrev()', 300);
// 				
// 				// Permit next/previous links to function normally when fade is completed
// 				permitNextPrev = function(){
// 					if(API.Photo._fadeRunning == false){
// 						clearInterval(adv_timer);
// 						
// 						// Only show links if there is more than one photo in array
// 						if(photoNum > 1){
// 							API.LinkContainer.displayShow();
// 							if (continuity != 1) document.getElementById('NextLink'+id).onclick = nextPhoto;
// 							if (continuity != 1) document.getElementById('PrevLink'+id).onclick = prevPhoto;
// 						}
// 					} else {
// 						return;
// 					}
// 				}
// 				// Swap out loading animation to spare CPU cycles when hidden anyway
// 				API.LoadImg.setSrc("/pub/SYSTEM/images/slideshow/start.gif");
// 				
// 				// Show caption again
// 				API.CaptionBlock.show();
// 				
// 				// Fade photo in
// 				API.Photo.fadeIn(0,15,33);
// 			} else {
// 				return;
// 			}
// 		}
// 	}
// 	
// 	// Prevent next/previous
// 	falsify = function(){
// 		return false;
// 	}
// 	
// 	// Go to next photo
// 	nextPhoto = function(){
// 		// Go to next photo
// 		if(photoId == (photoArray.length - 1)){
// 			photoId = 0;
// 		} else {
// 			photoId++;
// 		}
// 		cyclePhoto(photoId);
// 	}
// 	
// 	// Go to previous photo
// 	prevPhoto = function(){
// 		// If at start, go back to end
// 		if(photoId == 0){
// 			photoId = photoArray.length - 1;
// 		} else {
// 			photoId--;
// 		}
// 		
// 		cyclePhoto(photoId);
// 	}
// 	
// 	// Alter class of elements
// 	changeElementClass = function(objId,setClass) {
// 		document.getElementById(objId).className = setClass;
// 	}
// 	
// 	// Function to load subsequent photos in gallery
// 	cyclePhoto = function(photoId){
// 				
// 		// Swap in loading animation
// 		API.LoadImg.setSrc("/pub/SYSTEM/images/slideshow/loading_ani2.gif");
// 		
// 		// Hide link container if it is not already hidden
// 		API.LinkContainer.displayHide();
// 		
// 		// Hide photo container and caption temporarily
// 		API.Photo.hide();
// 		API.Photo.setOpacity(0);
// 		API.CaptionBlock.hide();
// 		
// 		// Get dimensions of photo
// 		var wNew = photoArray[photoId][1];
// 		var hNew = photoArray[photoId][2];
// 
// 		// Start tween on a delay
// 		var wCur = API.Container.getWidth() - borderSize;
// 		var hCur = API.Container.getHeight() - borderSize;
// 		
// 		// Begin tweening on a short timer
// 		setTimeout('API.Container.tweenTo(easeInQuad, ['+wCur+', '+hCur+'], ['+wNew+','+hNew+'], 7)',100);
// 		setTimeout('API.LinkContainer.sizeTo('+wNew+','+hNew+')',100);
// 		if (continuity != 1) setTimeout('API.PrevLink.sizeTo('+wNew/2+','+hNew+')',100);
// 		if (continuity != 1) setTimeout('API.NextLink.sizeTo('+wNew/2+','+hNew+')',100);
// 		setTimeout('API.CaptionBlock.sizeTo('+wNew+',18)',100);
// 		
// 		// Get new photo source
// 		var newPhoto = photoDir + photoArray[photoId][0];
// 		
// 		// Set source, width, and height of new photo
// 		API.Photo.setSrc(newPhoto);		
// 		API.Photo.sizeTo(wNew,hNew);
// 		
// 		// Set links to new targets based on photoId
// 		if (continuity != 1) API.NextLink.setHref("#" + (photoId+1));
// 		if (continuity != 1) API.PrevLink.setHref("#" + (photoId+1));
// 		API.Counter.setInnerHtml((photoId+1)+" of "+photoNum+" |");
// 		API.Caption.setInnerHtml(photoArray[photoId][3]);
// 		
// 		// Event listeners for onload and onclick events
// 		document.getElementById('Photo'+id).onload = initFade;
// 		
// 		// Block next/previous links until permitNextPrev() has fired
// 		if (continuity != 1) document.getElementById('NextLink'+id).onclick = falsify;
// 		if (continuity != 1) document.getElementById('PrevLink'+id).onclick = falsify;
// 
// 		if (continuity == 1) setTimeout("nextPhoto()", slideShowTime*1000);
// 	}
// }
// 
// 






// 
// function slideShow() {
// 
// 	//Set the opacity of all images to 0
// 	$('#gallery a').css({opacity: 0.0});
// 	
// 	//Get the first image and display it (set it to full opacity)
// 	$('#gallery a:first').css({opacity: 1.0});
// 	
// 	//Set the caption background to semi-transparent
// 	$('#gallery .caption').css({opacity: 0.7});
// 
// 	//Resize the width of the caption according to the image width
// 	$('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
// 	
// 	//Get the caption of the first image from REL attribute and display it
// 	if ($('#gallery a:first').find('img').attr('rel')) {
// 		$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
// 			.animate({opacity: 0.7}, 400);
// 	}
// 	
// 	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
// 	setInterval('gallery()',6000);
// 	
// }
// 
// function gallery() {
// 	
// 	//if no IMGs have the show class, grab the first image
// 	var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));
// 
// 	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
// 	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
// 	
// 	//Get next image caption
// 	var caption = next.find('img').attr('rel');	
// 	
// 	//Set the fade in effect for the next image, show class has higher z-index
// 	next.css({opacity: 0.0})
// 	.addClass('show')
// 	.animate({opacity: 1.0}, 1000);
// 
// 	//Hide the current image
// 	current.animate({opacity: 0.0}, 1000)
// 	.removeClass('show');
// 	
// 	//Set the opacity to 0 and height to 1px
// 	$('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
// 	
// 	//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
// 	$('#gallery .caption').animate({opacity: 0.7},100 ).animate({height: '100px'},500 );
// 	
// 	//Display the content
// 	$('#gallery .content').html(caption);
// 	
// 	
// }




/* NEW SLIDESHOW */
function slideShow(speed) {


	//append a LI item to the UL list for displaying caption
	$('ul.slideshow').append('<li id="slideshow-caption" class="caption" style="width:100%; height: 40px;"><div class="slideshow-caption-container"><h3></h3><p></p></div></li>');

	//Set the opacity of all images to 0
	$('ul.slideshow li').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('ul.slideshow li:first').css({opacity: 1.0});
	
	//Get the caption of the first image from REL attribute and display it
	$('#slideshow-caption h3').html($('ul.slideshow a:first').find('img').attr('title'));
	$('#slideshow-caption p').html($('ul.slideshow a:first').find('img').attr('alt'));
		
	if ($('ul.slideshow a:first').find('img').attr('title') || $('ul.slideshow a:first').find('img').attr('alt')) {
		$('#slideshow-caption').css({opacity: 0.7, bottom:0});
	}
	
	//Call the gallery function to run the slideshow	
	var timer = setInterval('gallery()',speed);
	
	//pause the slideshow on mouse over
	$('ul.slideshow').hover(
		function () {
			clearInterval(timer);	
		}, 	
		function () {
			timer = setInterval('gallery()',speed);			
		}
	);
	
}

function gallery() {

	//if no IMGs have the show class, grab the first image
	var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption')? $('ul.slideshow li:first') :current.next()) : $('ul.slideshow li:first'));
		
	//Get next image caption
	var title = next.find('img').attr('title');	
	var desc = next.find('img').attr('alt');	
		
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	
	//Hide the caption first, and then set and display the caption
	if (title || desc) {
		$('#slideshow-caption').animate({bottom:-70}, 300, function () {
				// Display the content
				$('#slideshow-caption h3').html(title);
				$('#slideshow-caption p').html(desc);				
				$('#slideshow-caption').animate({bottom:0}, 500);	
		});
	}

	//Hide the current image
	current.animate({opacity: 0.0}, 1000).removeClass('show');

}




/* NEW SLIDESHOW */
var slideShowBGPhotos=new Array();
function slideShowBG(obj,speed) {
	
/*

// SET BY USER !!!!!!
slideShowBGPhotos = [
 "ppc", 
 "games", 
 "advertise", 
 "meta", 
 "home", 
 "gaming", 
 "welcome"
]

*/
	var slideimg = slideShowBGPhotos[Math.floor(Math.random()*slideShowBGPhotos.length)];
//	alert(slideimg);
	if (slideimg && slideimg.src) { document.getElementById(obj).style.backgroundImage = 'url(\''+slideimg.src+'\')'; }

}	
	
