//************************************************//
//************************************************//
//**** Liquid Development, LLP                ****//
//**** http://www.liquiddev.com               ****//
//**** 713-521-9574                           ****//
//****                                        ****//
//**** Copyright Liquid Development, LLP 2003 ****//
//**** All Rights Reserved                    ****//
//****                                        ****//
//************************************************//
//************************************************//

//Functions to call when windows are resized are added as strings to this array
var AQResizeArray = [];

function AQ_Menu(tmpMenuItemSize, tmpMenuOffset){
	this.MenuItemSize = tmpMenuItemSize;
	this.MenuOffset = tmpMenuOffset;
	this.timeoutID = new Array(1);
	this.currentMenu = new Array();
}
var AQ_Right_Limit = window.innerWidth;
var AQ_MenuArray = new Array()

window.onresize = AQ_WindowResize;
window.onload = AQ_WindowResize;

function AQ_WindowResize(){
	//hideAll();
	AQ_Right_Limit = window.innerWidth;

	if (AQ_Current_Popout) {
		if (AQ_Current_Popout.length > 0) {
			for (var i=1; i < AQ_Current_Popout.length; i++) {
				if (AQ_Current_Popout[i].Showing) {
						//hide whatever is showing			
						//AQ_hidePopOut(i);
						AQ_showPopOut(i, AQ_Current_Popout[i].Showing.id, AQ_Current_Popout[i].ContainingLayer, AQ_Current_Popout[i].ShowingImage, AQ_Current_Popout[i].ShowingImageURL)
				}
			}		
		}
	}
	
	//loop through all functions that need to fire on window resize
	//alert(AQResizeArray.length);
	for (var idx in AQResizeArray) {
		eval(AQResizeArray[idx]);
	}					
}
//AQ_MenuArray[0] = new AQ_Menu(152, 2);

/**** ****/

function AQ_hideMenu(MenuIndex){
	if(!AQ_MenuArray[MenuIndex])
		return;
	//timeoutID[timeoutID.length] = setTimeout("AQ_RemoveMenuLayer(0)", 500);
	AQ_MenuArray[MenuIndex].timeoutID[AQ_MenuArray[MenuIndex].timeoutID.length] = setTimeout("AQ_RemoveMenuLayer(0, " + MenuIndex + ")", 500);
}

function AQ_hideMenuFromSpan(MenuIndex){
	AQ_hideMenu(MenuIndex);
}

function AQ_hideMenuFromAnchor(MenuIndex){
	/* Not Used In NS6 */
	return;
}


function AQ_MenuLayer(tmpMenuID, tmpParentID, tmpLevel){
	this.MenuID = tmpMenuID;
	this.ParentID = tmpParentID;
	this.Level = tmpLevel;
}

function AQ_addMenuLayer(tmpMenuID, tmpParentID, tmpLevel, MenuIndex){
	if(tmpMenuID != '0'){
		AQ_showMyself(AQ_findObj(tmpParentID), MenuIndex);
	}
	if(AQ_MenuArray[MenuIndex].currentMenu[tmpLevel]){
		AQ_hideLayer(AQ_findObj(AQ_MenuArray[MenuIndex].currentMenu[tmpLevel].MenuID));
	}
	AQ_MenuArray[MenuIndex].currentMenu[tmpLevel] = new AQ_MenuLayer(tmpMenuID, tmpParentID, tmpLevel);
}

function AQ_RemoveMenuLayer(tmpLevel, MenuIndex){
	if(tmpLevel < AQ_MenuArray[MenuIndex].currentMenu.length){
		for(i=tmpLevel;i< AQ_MenuArray[MenuIndex].currentMenu.length;i++){
			if(AQ_MenuArray[MenuIndex].currentMenu[i])
				AQ_hideLayer(AQ_findObj(AQ_MenuArray[MenuIndex].currentMenu[i].MenuID));
		}
	}
}

function AQ_showMyself(objLayer, MenuIndex){
	clearMenuTimeout(MenuIndex);
	if(objLayer)
		objLayer.style.visibility = 'visible';
}

function AQ_hideLayer(obj) {
	if(obj)
		obj.style.visibility = 'hidden';
}

function clearMenuTimeout(MenuIndex){
	for(i=0;i<AQ_MenuArray[MenuIndex].timeoutID.length;i++)
		if(AQ_MenuArray[MenuIndex].timeoutID[i] > 0)
			clearTimeout(AQ_MenuArray[MenuIndex].timeoutID[i]);
			
	AQ_MenuArray[MenuIndex].timeoutID = new Array(1);
}

function AQ_positionLayer(obj, x, y) {
	x = parseInt(x)+'px';
	y = parseInt(y)+'px';
	obj.style.left = x;
	obj.style.top = y;
}

function AQ_showHorizontalMenu(type, imageName, layerName, parentLayerName, level, divName, LinkIndex, MenuIndex, tmp_Anchor_ID){
	if(!AQ_MenuArray[MenuIndex])
		return;
	if(level > 0) {
		AQ_showVerticalMenu(type, imageName, layerName, parentLayerName, level, divName, LinkIndex, MenuIndex, tmp_Anchor_ID)
		return;
	}
	var objImage;
	var objDiv;
	var tmpX;
	var tmpY;
	
	var objLayer = AQ_findObj(layerName);
	clearMenuTimeout(MenuIndex);
	
	//Make sure we got an object
	if(objLayer != null) {
		
		AQ_RemoveMenuLayer(level, MenuIndex);
		AQ_addMenuLayer(layerName, parentLayerName, level, MenuIndex);
		
		//Check for image or text menu
		if(type=="image"){
			objImage = AQ_findObj(imageName);
			tmpX = calcLeft(objImage);
			tmpY = calcTop(objImage)+objImage.height;
		} else {
			/*if(level > 0){
				objDiv = AQ_findObj(parentLayerName);
			}else{*/
				objDiv = AQ_findObj(divName);
			//}	
			tmpX = calcLeft(objDiv);
			tmpY = calcTop(objDiv);
		}
		
		//Set the position of the new layer to show
		objLayer.style.left = tmpX+'px';
		objLayer.style.top = tmpY+'px';

		//Show the layer
		objLayer.style.visibility = "visible";
	}
}



var Menu_Level = -1;
var First_Offset = 0;
function AQ_showVerticalMenu(type, imageName, layerName, parentLayerName, level, divName, LinkIndex, MenuIndex, tmp_Anchor_ID){
	if(!AQ_MenuArray[MenuIndex])
		return;
	var objImage;
	var objDiv;
	var tmpX;
	var tmpY;
	var objLayer = AQ_findObj(layerName);
	clearMenuTimeout(MenuIndex);
	//Make sure we got an object
	if(objLayer != null) {
		AQ_RemoveMenuLayer(level, MenuIndex);
		AQ_addMenuLayer(layerName, parentLayerName, level, MenuIndex);
		//Check for image or text menu
		if(type=="image"){
			objImage = AQ_findObj(imageName);
			
			tmpX = calcLeft(objImage) + objImage.width;
			tmpY = calcTop(objImage);
			
		} else {
			if(level > 0){
				objDiv = AQ_findObj(tmp_Anchor_ID);
				tmpX = calcLeft(objDiv.offsetParent) + AQ_MenuArray[MenuIndex].MenuOffset;
				tmpY = calcTop(objDiv.offsetParent);

				//alert(objDiv.offsetParent);
				//objDiv = AQ_findObj(divName);
				
				if(Menu_Level != level){
					Menu_Level = level;
					if(LinkIndex == 0)
						First_Offset = objDiv.offsetTop;
				}
				tmpY = tmpY + (objDiv.offsetTop - (LinkIndex * First_Offset)) * LinkIndex;
			}else{
				objDiv = AQ_findObj(tmp_Anchor_ID);
				tmpX = calcLeft(objDiv) + AQ_MenuArray[MenuIndex].MenuOffset;
				tmpY = calcTop(objDiv);
			}		
			
			
		}
		
		if(tmpX > (AQ_Right_Limit - AQ_MenuArray[MenuIndex].MenuOffset)){
			tmpX = tmpX - (2*AQ_MenuArray[MenuIndex].MenuOffset)
		}
		
		if(tmpX < 0){
			tmpX = tmpX + (2*AQ_MenuArray[MenuIndex].MenuOffset)
		}
		
		//Set the position of the new layer to show
		AQ_positionLayer(objLayer, tmpX, tmpY);
		
		//Show the layer
		objLayer.style.visibility = 'visible';
	}
}

function calcTop(obj){
	var tmpObj;
	var tmpTop = 0;
	tmpObj = obj;
	while(tmpObj){
		tmpTop += tmpObj.offsetTop; 
		tmpObj = tmpObj.offsetParent;
	}
	return tmpTop;
}

function calcLeft(obj){
	var tmpObj;
	var tmpLeft = 0;
	tmpObj = obj;
	while(tmpObj){
		tmpLeft += tmpObj.offsetLeft; 
		tmpObj = tmpObj.offsetParent;
	}
	return tmpLeft;
}

function AQ_calcImageTop(imageName){
	var tmpImg;
	var objImg = AQ_findObj(imageName);
	var tmpTop;
	tmpTop = 0;
	while(objImg)
	{
		tmpTop += objImg.offsetTop;
		objImg = objImg.offsetParent;	 
	}
	return tmpTop;
}

function AQ_calcImageLeft(imageName){
	var tmpImg;
	var objImg = AQ_findObj(imageName);
	var tmpleft;
	tmpleft = 0;
	while(objImg)
	{
		tmpleft += objImg.offsetLeft;
		objImg = objImg.offsetParent;	 
	}
	return tmpleft;
}

/*******************************************************************
	Utilities
*******************************************************************/

function AQ_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function AQ_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.AQ_p) d.AQ_p=new Array();
    var i,j=d.AQ_p.length,a=AQ_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.AQ_p[j]=new Image; d.AQ_p[j++].src=a[i];}}
}

function AQ_swapImgRestore() { //v3.0
  var i,x,a=document.AQ_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function AQ_swapImage(imgname, imgsrc) {
	var objImage = AQ_findObj(imgname);
	if (objImage) {
		objImage.src = imgsrc;
	}
}

function AQ_findObj(n, d) { //v4.0
	var p,i,x;  
	if(!d) 
  		d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
    	d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
  	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) 
		x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=AQ_findObj(n,d.layers[i].document);
  	if(!x && document.getElementById) 
		x=document.getElementById(n); 
	return x;
}

function AQ_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=AQ_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = AQ_findObj(args[2])) != null && !img.AQ_init) {
      img.AQ_init = true; img.AQ_up = args[3]; img.AQ_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = AQ_findObj(args[i])) != null) {
        if (!img.AQ_up) img.AQ_up = img.src;
        img.src = img.AQ_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.AQ_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = AQ_findObj(args[i])) != null) {
      if (!img.AQ_up) img.AQ_up = img.src;
      img.src = (img.AQ_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.AQ_nbOver.length; i++) {
      img = document.AQ_nbOver[i]; img.src = (img.AQ_dn) ? img.AQ_dn : img.AQ_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.AQ_up; img.AQ_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = AQ_findObj(args[i])) != null) {
      if (!img.AQ_up) img.AQ_up = img.src;
      img.src = img.AQ_dn = args[i+1];
      nbArr[nbArr.length] = img;
  }
 }
}

function AQ_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/* general functions added 10-5-2005 */
function AQ_calcTop(obj){
	var tmpObj;
	var tmpTop = 0;
	tmpObj = obj;
	while(tmpObj){
		tmpTop += tmpObj.offsetTop; 
		tmpObj = tmpObj.offsetParent;
	}
	return tmpTop;
}

function AQ_calcLeft(obj){
	var tmpObj;
	var tmpLeft = 0;
	tmpObj = obj;
	while(tmpObj){
		tmpLeft += tmpObj.offsetLeft; 
		//alert(getComputedStyle(tmpObj, "").getPropertyValue('left'));
		tmpObj = tmpObj.offsetParent;
	}
	return tmpLeft;
}

function AQ_findParentWithTagName(obj, tagName) {
	obj = obj.parentNode;

	while (obj) {
		if (obj.tagName == tagName) {
			return obj;
		} else {
			obj = obj.parentNode;
		}
	}
	return obj
}
/* end general functions added 10-5-2005 */

/* PopUp Content Code */
function AQ_PopOut(tmpPosition_Against, tmpHorizontal_Offset, tmpVertical_Offset, tmpUseImage, tmpStyleOrClass, tmpYoYoStyle, tmpOriginalStyle){		
	this.Position_Against = tmpPosition_Against; //current, fixed, <Layer_Name>
	this.Horizontal_Offset = tmpHorizontal_Offset;
	this.Vertical_Offset = tmpVertical_Offset;
	this.Showing = '';
	this.ShowingImage = '';
	this.ShowingImageURL = '';
	this.OriginalImageURL = '';
	this.UseImage = tmpUseImage;
	if ((tmpStyleOrClass == 'style') || (tmpStyleOrClass == 'class')) {
		this.UseYoYo = true;	
		this.StyleOrClass = tmpStyleOrClass;			
	} else {
		this.UseYoYo = false;	
		//need to have a default here to prevent errors
		this.StyleOrClass = 'style';		
	}
	this.YoYoStyle = tmpYoYoStyle;
	this.OriginalStyle = tmpOriginalStyle;
	this.Netscape6_Vertical_Offset = 0;
}

var AQ_Current_Popout = new Array();

var AQ_hidePopOut = function (Page_Section_ID) {
	if (AQ_Current_Popout[Page_Section_ID].Showing) {
		AQ_Current_Popout[Page_Section_ID].Showing.style.visibility = "hidden";
		//swap back image if necessary
		if ((AQ_Current_Popout[Page_Section_ID].UseImage) && (AQ_Current_Popout[Page_Section_ID].ShowingImage.length > 0)) {
			AQ_swapImage(AQ_Current_Popout[Page_Section_ID].ShowingImage, AQ_Current_Popout[Page_Section_ID].OriginalImageURL);
		}
	}
}


var AQ_showPopOut = function (Page_Section_ID, showlayer, containinglayer, imagelayer, imageurl) {
	var objContainingLayer;
	var objShowLayer;
	var tmpY = 0;
	var tmpX = 0;			
	var bFirstTime = false;
	
	if (!AQ_Current_Popout[Page_Section_ID]) {
		//object not set - leave function
		return
	}

	//Find the layer to display
	objShowLayer = AQ_findObj(showlayer);
		
	//hide whatever is showing		
	if (AQ_Current_Popout[Page_Section_ID].Showing) {
		AQ_hidePopOut(Page_Section_ID);
	} else {
		// for netscape 6/7 we need to know if we have shown anything or not
		// b/c we need to calc first layer offset later
		bFirstTime = true
	}
				
	//Now find what layer to position it next to
	switch (AQ_Current_Popout[Page_Section_ID].Position_Against) {
		case "current" :
				objContainingLayer = AQ_findObj(containinglayer);
			break;
		case "fixed" :
				objContainingLayer = null;
				tmpX = AQ_Current_Popout[Page_Section_ID].Horizontal_Offset;
				tmpY = AQ_Current_Popout[Page_Section_ID].Vertical_Offset;
			break;
		default :
			objContainingLayer = AQ_findObj(AQ_Current_Popout[Page_Section_ID].Position_Against);
			break;
	}

	//if we got an object above, position next to it
	if (objContainingLayer) {
		if (bFirstTime) {
			/* if first time need to calc netscape 6/7 vert offset to use */
			//AQ_Current_Popout[Page_Section_ID].Netscape6_Vertical_Offset = AQ_calcTop(objContainingLayer);

			var oParent = AQ_findParentWithTagName(objContainingLayer, 'TABLE')
			//oParent = oParent.parentNode;
			var oTD = oParent.getElementsByTagName('TD');
			if (oTD.length >= 2) {
				AQ_Current_Popout[Page_Section_ID].Netscape6_Vertical_Offset = AQ_calcTop(oTD[1]) - AQ_calcTop(oTD[0]);
			}		

			/*** NOT SURE IF THIS WORKS - IF THERE ARE PROBLEMS WITH VERTICAL POSITION START LOOKING HERE ***/
			if (AQ_Current_Popout[Page_Section_ID].Netscape6_Vertical_Offset == 0) {
// removed 10-23-2008 to fix issue with Tabbed Horizontal Snapshot Display in Firefox			
//				AQ_Current_Popout[Page_Section_ID].Netscape6_Vertical_Offset = AQ_Current_Popout[Page_Section_ID].Vertical_Offset
			}
			/*** NOT SURE IF THIS WORKS - IF THERE ARE PROBLEMS WITH VERTICAL POSITION START LOOKING ABOVE HERE ***/			
		}

		/* adjustment for safari - netscape6_vertical_offset should be 0 */
		if ((navigator.appVersion.indexOf('Safari') != -1 ) || (navigator.appName.indexOf('Safari') != -1 )) {
			AQ_Current_Popout[Page_Section_ID].Netscape6_Vertical_Offset = 0
		}
		/* end of adjustment for safari - netscape6_vertical_offset should be 0 */		
			
		//Now get top and left & add offsets
		tmpY = AQ_calcTop(objContainingLayer) + AQ_Current_Popout[Page_Section_ID].Vertical_Offset-AQ_Current_Popout[Page_Section_ID].Netscape6_Vertical_Offset; 
		tmpX = AQ_calcLeft(objContainingLayer)+AQ_Current_Popout[Page_Section_ID].Horizontal_Offset;
	} 

	//now position and show the layer
	objShowLayer.style.left = parseInt(tmpX)+'px';
	objShowLayer.style.top = parseInt(tmpY)+'px';
	objShowLayer.style.visibility = "visible";

	//set the currently shown layer			
	AQ_Current_Popout[Page_Section_ID].Showing = objShowLayer;

	//now display the image if needed
	if (AQ_Current_Popout[Page_Section_ID].UseImage) {
		var objImage = AQ_findObj(imagelayer);
		AQ_Current_Popout[Page_Section_ID].ShowingImageURL = imageurl;
		AQ_Current_Popout[Page_Section_ID].ShowingImage = imagelayer;
		if (objImage) {
			AQ_Current_Popout[Page_Section_ID].OriginalImageURL = objImage.src;
		}
		AQ_swapImage(imagelayer, imageurl);
	}

	if (AQ_Current_Popout[Page_Section_ID].UseYoYo) {			
		AQ_showYoYo(Page_Section_ID, containinglayer);			
	}
}

function AQ_showYoYo(Page_Section_ID, containinglayer) {
	var currentTop = 0;
	var containerTop = 0;
	var oContainer = AQ_findObj(containinglayer);

	containerTop = AQ_calcTop(oContainer)//-AQ_Current_Popout[Page_Section_ID].Netscape6_Vertical_Offset;
	var oParent = AQ_findParentWithTagName(oContainer, 'TABLE')
	var oTD = oParent.getElementsByTagName('TD');
	for(var i = 0; i < oTD.length; i++) { 
		currentTop = AQ_calcTop(oTD[i]);
		if (containerTop > parseInt(currentTop)) {
				oTD[i].setAttribute(AQ_Current_Popout[Page_Section_ID].StyleOrClass, AQ_Current_Popout[Page_Section_ID].YoYoStyle);	
		} else {
				oTD[i].setAttribute(AQ_Current_Popout[Page_Section_ID].StyleOrClass, AQ_Current_Popout[Page_Section_ID].OriginalStyle);		
		}
	}
}
/* End PopUp Content Code */	

/* Marquee Content Code */
/*
*****************************************************************************
*** GreyWyvern's HTML Block Scroller & Marquee ******************************
*****************************************************************************
* HTML Block Scroller & Marquee JavaScript - v1.5 - Coded by GreyWyvern
*  - Copyright 2005 - Licenced for free distribution under the BSDL
*  -     http://www.opensource.org/licenses/bsd-license.php
*
* Have one or more scrolling blocks of HTML anywhere on your screen, and
* all infinitely adjustable!  Scroller will even pause on mouseover and
* resume on mouseout.
*
* Version 1.5
*   - Added pause-on-mouseover
*   - Added patch from Vincent Driessen:
*      - Disables scrolling when scrollObject has only one block
*****************************************************************************
*** GreyWyvern's HTML Block Scroller & Marquee ******************************
*****************************************************************************
*/
function AQ_Marquee(marquee, anchor, wrapper, width, height, bgcolor, color, textalign, direction, speed, slowdown, move, delay, pause, additionalstyle) {
  // manual properties
	this.scrollForward = true;
  this.marquee = marquee;
  this.anchor = anchor;
  this.wrapper = wrapper;
  this.width = (width >= 0) ? width : 0;
  this.height = (height >= 0) ? height : 0;
  this.bgcolor = bgcolor;
  this.color = color;
	this.additionalstyle = additionalstyle;
  this.textalign = textalign;
  this.direction = direction;
  this.speed = Math.max(Math.min(speed, (direction == "up" || direction == "down") ? height : width), 1);
  this.slowdown = Math.max(Math.min(slowdown, 2), 1);
  this.move = move;
  this.delay = Math.max(delay,move);
  this.pause = pause;
  // automatic properties
  this.anchorobj = AQ_findObj(anchor);
  this.wrapperobj = AQ_findObj(wrapper);
  this.slide = this.speed; //((direction == "up" || direction == "down") ? height : width) / this.speed;  
  this.inner1 = wrapper + "Inner1";
  this.inner2 = wrapper + "Inner2";  
  this.block = new Array();
	this.blockshowing = 0;
  this.blockup = 1;
  this.spanup = 1;  
  this.table_start = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td class=\"Aq_Marquee\" style=\"width:" + width + "px;height:" + height + "px;background-color:" + bgcolor + ";color:" + color + ";text-align:" + textalign + ";"+additionalstyle+";\">";
  this.table_end = "</td></tr></table>";
  this.scrollable = false;
  this.process = 0;
  this.innerList = '';
  // methods
  this.scroll = function() {
    if (!this.wrapperobj) return false;
    this.wrapperobj.innerHTML = "<span id=\"" + this.inner1 + "\"></span><span id=\"" + this.inner2 + "\"></span>";
    this.innerList = [this.wrapperobj, AQ_findObj(this.inner1), AQ_findObj(this.inner2)];
    for (var i = 0; i <= 2; i++) {   
      if (i > 0) {
		this.innerList[i].innerHTML = this.table_start + this.block[i - 1] + this.table_end;	
        if (this.direction == "up" || this.direction == "down") {
          this.innerList[i].style.left = "0px";
          this.innerList[i].style.top = (i == 1) ? "0px" : ((this.direction == "up") ? "" : "-") + this.height + "px";
        } else {
          this.innerList[i].style.left = (i == 1) ? "0px" : ((this.direction == "left") ? "" : "-") + this.width + "px";
          this.innerList[i].style.top = "0px";
        }
      } else { 
		this.innerList[i].style.left = parseInt(AQ_calcLeft(this.anchorobj))+'px';
		this.innerList[i].style.top = parseInt(AQ_calcTop(this.anchorobj))+'px';	
      }  
	  this.innerList[i].style.position = "absolute";
	  this.innerList[i].style.visibility = "visible";
	  this.innerList[i].style.overflow = "hidden";		  
	  this.innerList[i].style.width = this.width + "px";
	  this.innerList[i].style.height = this.height + "px";
	  this.innerList[i].style.backgroundColor = this.bgcolor;	  
      this.innerList[i].style.color = this.color;	  
	  this.innerList[i].style.textAlign = this.textalign;	 	  
    }
    if (this.block.length > 1) {
		if (this.pause==1) {
			this.wrapperobj.onmouseout = new Function(this.marquee + ".scrollable=true; setTimeout(\'" + this.marquee + ".scrollLoop()\', " + this.move + ");");				
			this.wrapperobj.onmouseover = new Function(this.marquee + ".scrollable=false; " + this.marquee + ".scrollLoop();");			
		}
		this.scrollable = true;	
		this.process = setTimeout(this.marquee + ".scrollLoop();", this.delay);	
	}
  }
	
  this.scrollLoop = function() {
    clearTimeout(this.process);
    if (!this.scrollable) return false;
    this.slide = Math.max(this.slide / this.slowdown, 1);
    var slideInc = (this.direction == "up" || this.direction == "left") ? -parseInt(this.slide) : parseInt(this.slide);
    if ((this.direction == "up" && Math.max(parseInt(this.innerList[1].style.top) + slideInc, parseInt(this.innerList[2].style.top) + slideInc) <= 0) ||
        (this.direction == "down" && Math.min(parseInt(this.innerList[1].style.top) + slideInc, parseInt(this.innerList[2].style.top) + slideInc) >= 0) ||
        (this.direction == "left" && Math.max(parseInt(this.innerList[1].style.left) + slideInc, parseInt(this.innerList[2].style.left) + slideInc) <= 0) ||
        (this.direction == "right" && Math.min(parseInt(this.innerList[1].style.left) + slideInc, parseInt(this.innerList[2].style.left) + slideInc) >= 0)) {
      this.slide = this.speed; //((this.direction == "up" || this.direction == "down") ? this.height : this.width) / this.speed;
			
			if (this.scrollForward) {
	      if (++this.blockup >= this.block.length) this.blockup = 0;
			} else {
			  if (--this.blockup < 0) this.blockup = this.block.length-1;			
			}
			this.spanup = (this.spanup == 1) ? 2 : 1;			
			this.setSpanUp(this.blockup);
/*
      this.spanup = (this.spanup == 1) ? 2 : 1;
      if (this.direction == "up" || this.direction == "down") {
        this.innerList[3 - this.spanup].style.top = ((this.direction == "down") ? "-" : "") + this.height + "px";
        this.innerList[this.spanup].style.top = "0px";
      } else {
        this.innerList[3 - this.spanup].style.left = ((this.direction == "right") ? "-" : "") + this.width + "px";
        this.innerList[this.spanup].style.left = "0px";
      } this.innerList[3 - this.spanup].innerHTML = this.table_start + this.block[this.blockup] + this.table_end;
*/
      this.process = setTimeout(this.marquee + ".scrollLoop();", this.delay);
    } else {
      for (var j = 1; j <= 2; j++) {
        if (this.direction == "up" || this.direction == "down") {
          this.innerList[j].style.top = (parseInt(this.innerList[j].style.top) + slideInc) + "px";
        } else this.innerList[j].style.left = (parseInt(this.innerList[j].style.left) + slideInc) + "px";
      } this.process = setTimeout(this.marquee + ".scrollLoop();", this.move);
    }
  }
	
	this.setSpanUp = function(tmpBlockUp) {
     //this.spanup = (this.spanup == 1) ? 2 : 1;
     if (this.direction == "up" || this.direction == "down") {
       this.innerList[3 - this.spanup].style.top = ((this.direction == "down") ? "-" : "") + this.height + "px";
       this.innerList[this.spanup].style.top = "0px";
     } else {
       this.innerList[3 - this.spanup].style.left = ((this.direction == "right") ? "-" : "") + this.width + "px";
       this.innerList[this.spanup].style.left = "0px";
     } this.innerList[3 - this.spanup].innerHTML = this.table_start + this.block[tmpBlockUp] + this.table_end;	
	}

	this.changeDirection = function() {
			switch (this.direction) {
					case 'up':
						this.direction='down';
						break;					
					case 'down':
						this.direction='up';
						break;
					case 'left':
						this.direction='right';
						break;					
					case 'right':
						this.direction='left';
						break;
				}			
	}
		
	this.scrollNext = function() {
		clearTimeout(this.process);
		var adjust = 2;
		if (!this.scrollForward){	
			this.changeDirection();	
			var tmpBlockUp = this.blockup + adjust;		
			if (tmpBlockUp > this.block.length) {
				tmpBlockUp = 1;
			} else {
				if (tmpBlockUp == this.block.length) {
					tmpBlockUp = 0;
				}			
			}
			this.setSpanUp(tmpBlockUp)
			this.blockup = tmpBlockUp;		
			this.scrollForward = true;					
		}		
		this.scrollLoop();			
	}
	
	this.scrollBack = function() {
		clearTimeout(this.process);		
		var adjust = 2;
		if (this.scrollForward){		
			this.changeDirection();
			var tmpBlockUp = this.blockup - adjust;		
			if (tmpBlockUp == -1) {
				tmpBlockUp = this.block.length-1;
			} else {
				if (tmpBlockUp < -1) {
					tmpBlockUp =  this.block.length-adjust;
				}
			}
			this.setSpanUp(tmpBlockUp);
			this.blockup = tmpBlockUp;			
			this.scrollForward = false;				
		}
		this.scrollLoop();
	}	
}
/* End Marquee Content Code */

/* Start Peepshow Code */
function AQ_swapLayer(oHide, oShow) {
	oHide.style.visibility = 'hidden';
	oShow.style.visibility = 'visible';
}

function AQ_doPeepShow(layerWrapper, layerHide, layerShow){
	var oWrapper = AQ_findObj(layerWrapper);
	var oHide = AQ_findObj(layerHide);
	var oShow = AQ_findObj(layerShow);
	var iTop = AQ_calcTop(oWrapper) + 'px';
	var iLeft = AQ_calcLeft(oWrapper) + 'px';

	oHide.style.top = iTop;
	oHide.style.left = iLeft;	
	oShow.style.top = iTop;
	oShow.style.left = iLeft;	
	AQ_swapLayer(oHide, oShow);
}
/* End Peepshow Code */