//	Super Web Group Menu Code
//	Super Web Content Management System 3.5
//	Copyright © 2007 Super Web Group.  All Rights Reserved.
//	info@superwebgroup.com

var iFadeSpeed = 50;
var iExpandSpeed = 50;
var iMenuHoldCount = 100;
var bMenuEffectActive = false;
var bMenuOver;
var bMenuItemOver;
var bScroll;
var iTopNavMenuYOffset = 0; //Arbutus Note: Change this offset to change the Y position of hover menu
var iTopNavMenuXOffset = 0;
var iMenuYOffset = 2;
var iMenuXOffset = 10;
var iMenuDivWidth = 140;
var bUseExternalLinkWindow = false;
var iNavType = 0; // 0 = top, 1 = left, 2 = right
var iMenuRoot = 0;
var MenuArrayCount = 0;
var MenuArray = new Array(99);

window.onresize = HideAllMenus;

function BuildMenus(iRootID){
    var itemlink
    var i= 0;
    document.write('<div id="navTopNavHolder" class="navTopNavHolder" width="100%">'); 
    if (iNavType == 0){
        document.write('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr valign="top">');
    }
    for(i=0; i<iMenuPageCount; i++){     
        if (MenuPages[i][1] == iRootID){
            itemlink = "";
            if (MenuPages[i][3].substr(0,4).toLowerCase() == "http"){
                if (bUseExternalLinkWindow == true) {
                    itemlink = "external_site(\'"+MenuPages[i][3]+"\');";
                } else {
                    itemlink = "pop(\'"+MenuPages[i][3]+"\',950,750);";
                }
            }
            if (MenuPages[i][3] != "" && itemlink == "") {
                itemlink = "location.href=\'"+MenuPages[i][3]+"\';";
            }
            if (itemlink == "#") {
                itemlink = "";
            }
            if (iNavType == 0){ //topnav
                document.write('<td id="navTopNav_Item'+MenuPages[i][0]+'" class="navTopNavItem" onmouseover="this.className=\'navTopNavItemOver\';HideAllMenus();ShowPulldownMenu('+MenuPages[i][0]+');" onmouseout="this.className=\'navTopNavItem\';HideAllMenus();" onclick="HideAllMenus();'+itemlink+'"><div id="Anchor'+MenuPages[i][0]+'" name="Anchor'+MenuPages[i][0]+'" class="navTopNavItemAnchor"></div><div class="navTopNavItemPadding">'+MenuPages[i][2]+'</div></td>');
            }
            if (iNavType == 1){ //leftnav
                document.write('<div id="navLeftNav_Item'+MenuPages[i][0]+'" class="navLeftNavItem" onmouseover="this.className=\'navLeftNavItemOver\';HideAllMenus();ShowPulloutMenu('+MenuPages[i][0]+');" onmouseout="this.className=\'navLeftNavItem\';MenuOut('+MenuPages[i][0]+');" onclick="HideAllMenus();'+itemlink+'"><div id="Anchor'+MenuPages[i][0]+'" name="Anchor'+MenuPages[i][0]+'" class="navLeftNavItemAnchor"></div><div class="navLeftNavItemPadding">'+MenuPages[i][2]+'</div></div>');
            }
            if (iNavType == 2){ //rightnav
                document.write('<div id="navRightNav_Item'+MenuPages[i][0]+'" class="navRightNavItem" onmouseover="this.className=\'navRightNavItemOver\';HideAllMenus();ShowPulloutMenu('+MenuPages[i][0]+');" onmouseout="this.className=\'navRightNavItem\';MenuOut('+MenuPages[i][0]+');" onclick="HideAllMenus();'+itemlink+'"><div id="Anchor'+MenuPages[i][0]+'" name="Anchor'+MenuPages[i][0]+'" class="navRightNavItemAnchor"></div><div class="navRightNavItemPadding">'+MenuPages[i][2]+'</div></div>');                
            }
        }        
    }
    if (iNavType == 0){
        document.write('</tr></table>');
    }   
    document.write('</div>'); 
    BuildPopupMenus();
}

function BuildPopupMenus(){
    var itemlink
    var i = 0;
    var j = 0;
    for(i=0; i<iMenuPageCount; i++){     
        if (MenuPages[i][4] > 0){
            // add to menu array
            MenuArray[MenuArrayCount] = new Array(6);
            MenuArray[MenuArrayCount][0] = MenuPages[i][0];  //ID
            MenuArray[MenuArrayCount][1] = MenuPages[i][1];  //ParentID
            MenuArray[MenuArrayCount][2] = 0;                //status indicator
            MenuArray[MenuArrayCount][3] = 0;                //timer boolean
            MenuArray[MenuArrayCount][4] = 0;                //height
            MenuArray[MenuArrayCount][5] = 0;                //width			
            MenuArrayCount = MenuArrayCount + 1
            document.write('<div id="Menu'+MenuPages[i][0]+'" class="navMenuHolder" style="position:absolute;visibility:hidden;overflow:hidden;">');
            for(j=0; j<iMenuPageCount; j++){ 
               if (MenuPages[j][1] == MenuPages[i][0]){
                    itemlink = "";
                    if (MenuPages[j][3].substr(0,4).toLowerCase() == "http"){
                        if (bUseExternalLinkWindow == true) {
                            itemlink = "external_site(\'"+MenuPages[j][3]+"\');";
                        } else {
                            itemlink = "pop(\'"+MenuPages[j][3]+"\',950,750);";
                        }
                    }
                    if (MenuPages[j][3] != "" && itemlink == "") {
                        itemlink = "location.href=\'"+MenuPages[j][3]+"\';";
                    }
                    if (itemlink == "#") {
                        itemlink = "";
                    }
            	    document.write('<div id="Menu'+MenuPages[i][0]+'_Item'+MenuPages[j][0]+'" class="navMenuItem" onmouseover="this.className=\'navMenuItemOver\';MenuItemOver('+MenuPages[i][0]+','+MenuPages[j][0]+');" onmouseout="this.className=\'navMenuItem\';MenuOut('+MenuPages[i][0]+');" onclick="HideAllMenus();'+itemlink+'">');
            	    if (MenuPages[j][4] > 0){
        	            document.write('<span id="Anchor'+MenuPages[j][0]+'" name="Anchor'+MenuPages[j][0]+'" class="navMenuItemAnchor"></span>');
        	        }
            	    document.write('<div class="navMenuItemPadding">'+MenuPages[j][2]+'</div>');
             	    document.write('</div>');
           	        document.write('<div class="navMenuItemBorder" onmouseover="MenuItemOver('+MenuPages[i][0]+','+MenuPages[j][0]+');" onmouseout="MenuOut('+MenuPages[i][0]+');"><img src="images/1x1trans.gif" height="1"></div>');
        	    }
        	}
            document.write('</div>');
            document.write('<iframe id="ShimMenu'+MenuPages[i][0]+'" src="javascript:false;" scrolling="no" frameborder="0" style="position:absolute; top:0px; left:0px; display:none;"></iframe>');
        }        
    }
}

function InitializeMenu(){
    BuildMenus(iMenuRoot);
    var Menu = new getObj('navTopNavHolder');
    Menu.style.visibility = 'visible';
    Menu.style.display = "block";	
}

function MenuOut(MenuID) {
	var i = 0;
	clearInterval(bMenuOver);
	if (document.getElementById('navTopNav_Item'+MenuID)){
		bMenuOver = setTimeout('HideMenu('+MenuID+')',iMenuHoldCount);
	}
	clearInterval(bScroll);
	allNodes = getElementsByClassName(document, "div", "navMenuItemOver");
	for(i = 0; i < allNodes.length; i++) {
		allNodes[i].className = 'navMenuItem';
	}
	if (document.getElementById('navTopNav_Item'+MenuID)){
		document.getElementById('navTopNav_Item'+MenuID).className = 'navTopNavItem';
	}

}

function MenuOver(MenuID) {
	clearInterval(bMenuOver);
	var i = 0;
	var j = 0;
	if (document.getElementById('navTopNav_Item'+MenuID)){
		document.getElementById('navTopNav_Item'+MenuID).className = 'navTopNavItemOver';
	}	
	for(i=0; i<MenuArrayCount; i++){
		if (MenuID == MenuArray[i][0])
		{
			MenuArray[i][2] = 1;
			clearInterval(MenuArray[i][3]);
			//recursive check for parents
			for(j=0; j<MenuArrayCount; j++){
				if (MenuArray[i][1] == MenuArray[j][0]){
					MenuOver(MenuArray[j][0]); 
					HighlightParent(MenuArray[j][0],MenuArray[i][0]); 
				}						
			}			
		}
	}
	setTimeout('MenuStates()',iMenuHoldCount);	
}			

function MenuItemOver(MenuID,ItemID) {
	clearInterval(bMenuItemOver);
	bMenuItemOver = setTimeout('HideSubMenus('+MenuID+')',iMenuHoldCount);	
	MenuOver(MenuID);	
	var p = 0;
	for(p=0; p<MenuArrayCount; p++){
		if (MenuArray[p][0] == ItemID){
		    clearInterval(bMenuItemOver);
		    HideSubMenus(MenuID);
			ShowPulloutMenu(ItemID); //recursive check for children
			p = MenuArrayCount; // only first child menu
		}		
	}
	clearInterval(bScroll);
    ScrollWindow('Menu'+MenuID+'_Item'+ItemID);
}

function HighlightParent(MenuID,ItemID){
	if (document.getElementById('Menu'+MenuID+'_Item'+ItemID)){
		document.getElementById('Menu'+MenuID+'_Item'+ItemID).className = 'navMenuItemOver';
	}
	if (document.getElementById('navTopNav_Item'+MenuID)){
		document.getElementById('navTopNav_Item'+MenuID).className = 'navTopNavItemOver';
	}
}

function ShowPulldownMenu(MenuID) {
    var i = 0;
	if (document.getElementById('navTopNav_Item'+MenuID)){
		document.getElementById('navTopNav_Item'+MenuID).className = 'navTopNavItemOver';
		for(i=0; i<MenuArrayCount; i++){
			if (MenuID == MenuArray[i][0] && MenuArray[i][2] == 0)
			{	
				var anchorobj = new getObj('Anchor'+MenuArray[i][0]);
				MenuPosition(anchorobj.obj,'Menu'+MenuArray[i][0],iTopNavMenuYOffset,iTopNavMenuXOffset,i);
				MenuOver(MenuID);				
			}
		}
	}
}

function ShowPulloutMenu(MenuID) {
    var i = 0;
	for(i=0; i<MenuArrayCount; i++){
		if (MenuID == MenuArray[i][0] && MenuArray[i][2] == 0)
		{		
			var anchorobj = new getObj('Anchor'+MenuArray[i][0]);
			MenuPosition(anchorobj.obj,'Menu'+MenuArray[i][0],iMenuYOffset,iMenuXOffset,i);			
			MenuOver(MenuID);
		}
	}
}


function HideMenu(MenuID) {
    var k = 0;

	for(k=0; k<MenuArrayCount; k++){
		if (MenuID == MenuArray[k][0])
		{
			HideSubMenus(MenuID);
			MenuOut(MenuArray[k][1]);
			MenuArray[k][2] = 0;
			clearInterval(MenuArray[k][3]);
			MenuArray[k][3] = setTimeout('MenuStates()',iMenuHoldCount);
		}
	}
}

function HideSubMenus(MenuID) {
    var i = 0;
    var j = 0;
	for(i=0; i<MenuArrayCount; i++){
		if (MenuID == MenuArray[i][0])
		{
			for(j=0; j<MenuArrayCount; j++){
				if (MenuArray[i][0] == MenuArray[j][1]){
					for(p=0; p<MenuArrayCount; p++){
						if (MenuArray[j][0] == MenuArray[p][1]){
							MenuArray[p][2] = 0;
							clearInterval(MenuArray[p][3]);
							MenuArray[p][3] = setTimeout('MenuStates()',iMenuHoldCount);	
						}			
					}				
					MenuArray[j][2] = 0;
					clearInterval(MenuArray[j][3]);
					MenuArray[j][3] = setTimeout('MenuStates()',iMenuHoldCount);	
				}			
			}
		}
	}
}

function HideAllMenus() {
    var i = 0;
	allNodes = getElementsByClassName(document, "td", "navTopNavItemOver");
	for(i = 0; i < allNodes.length; i++) {
		allNodes[i].className = 'navTopNavItem';
	}
 	for(i=0; i<MenuArrayCount; i++){
		MenuArray[i][2] = 0;
		clearInterval(MenuArray[i][3]);
		//MenuArray[i][3] = setTimeout('MenuStates()',iMenuHoldCount);	
	}
	setTimeout('MenuStates()',iMenuHoldCount);		
}

function HideAllMenusExcept(Index) {
    var i = 0;
	allNodes = getElementsByClassName(document, "td", "navTopNavItemOver");
	for(i = 0; i < allNodes.length; i++) {
		allNodes[i].className = 'navTopNavItem';
	}
 	for(i=0; i<MenuArrayCount; i++){
		if (Index != i){
			MenuArray[i][2] = 0;
		}
	}
	setTimeout('MenuStates()',iMenuHoldCount);	
}

function MenuStates() {
    var i = 0;
	for(i=0; i<MenuArrayCount; i++){	
		clearInterval(MenuArray[i][3]); 
	}
	for(i=0; i<MenuArrayCount; i++){	
		if (MenuArray[i][2] == 0){
			hide('Menu'+MenuArray[i][0],i);		
		}
		if (MenuArray[i][2] == 1){
			show('Menu'+MenuArray[i][0],i);
		}
	}
}


function MenuPosition(obj,lyr,mody,modx,MenuIndex)
{
    var Menu = new getObj(lyr);    
    var MenuHeight = Menu.obj.offsetHeight;
    var MenuWidth = Menu.obj.offsetWidth;
	var AnchorX = findPosX(obj);
	var AnchorY = findPosY(obj);       
    var WinScroll = getScrollXY();
    var WinSize = getWindowSize();
    var MenuParentIndex = 0;
    var i = 0;
	
	// update h/w in array if first time
	if (MenuArray[MenuIndex][4] == 0) MenuArray[MenuIndex][4] = MenuHeight
	if (MenuArray[MenuIndex][5] == 0) MenuArray[MenuIndex][5] = MenuWidth
	
    // get parent id index for zIndex swap
	for(i=0; i<MenuArrayCount; i++){
		if (MenuArray[i][0] == MenuArray[MenuIndex][1]){	
		    MenuParentIndex = i;
		    i = MenuArrayCount;
		}
	}
    // move menu up if possible when menu is to tall to show completly
    if ((WinScroll[1] + WinSize[1]) <= (AnchorY + MenuHeight)){
        if (MenuArray[MenuIndex][1] >= 0){ //exclude root menus if desired here
            if ((WinSize[1] - AnchorY) >= 0){
                mody -= (AnchorY + MenuHeight) - (WinScroll[1] + WinSize[1]);
            }
        }
    }     
    // move menu left if menu goes offscreen to the right
    if ((WinScroll[0] + WinSize[0]) <= (AnchorX + MenuWidth)){
        if (MenuArray[MenuIndex][1] != 0){ 
            if ((AnchorX - MenuWidth) >= 0){
                modx -= ((2*MenuWidth) - (modx/2));
            }
        } else {//root menus use different math
			modx += ((WinScroll[0] + WinSize[0]) - (AnchorX + MenuWidth));
		}
    }      
	if (is_mac && is_ie5up) { // mac ie position bug fix
		var menuanchor = new getObj('MenuAnchor');
		var newX = modx + findPosX(obj) - findPosX(menuanchor.obj);
		var newY = mody + findPosY(obj) - findPosY(menuanchor.obj);
		Menu.style.top = newY + 'px';
		Menu.style.left = newX + 'px';
	} else { // all the other browsers
		var newX = modx + AnchorX;
		var newY = mody + AnchorY;
		Menu.style.top = newY + 'px';
		Menu.style.left = newX + 'px';
		if (document.getElementById('Menu'+MenuArray[MenuParentIndex][0])){
		    Menu.style.zIndex = 1+document.getElementById('Menu'+MenuArray[MenuParentIndex][0]).style.zIndex;
		}
	}	
	if (is_win && (is_ie5 || is_ie6 ) || is_mac && is_nav6up) {
		var DivRef = document.getElementById(lyr);
		var IfrRef = document.getElementById('Shim'+lyr);
	    IfrRef.style.width = DivRef.offsetWidth;
	    IfrRef.style.height = DivRef.offsetHeight;
	    IfrRef.style.top = newY + 'px';
	    IfrRef.style.left = newX + 'px';
	    IfrRef.style.zIndex = DivRef.style.zIndex - 1;
	}		
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
 }
}

function show(obj,index)
{
	var x = new getObj(obj);
	var MenuHeight = MenuArray[index][4];
	var MenuWidth = MenuArray[index][5];
	if (x.style.visibility == 'hidden'){
		if (iFadeSpeed > 0 || iExpandSpeed > 0){
			if (iFadeSpeed > 0 && !(is_nav)){
				changeOpac(0, obj);
			    opacity(obj, 0, 100, iFadeSpeed);
			}
			if (iExpandSpeed > 0 && !(is_nav)){
				expand(obj, MenuHeight, MenuWidth, iExpandSpeed) 
			}
		    x.style.display = 'block';			
			x.style.visibility = 'visible';
			setTimeout("useShim('" + obj + "','show')",iExpandSpeed);		
		} else {
		    x.style.display = 'block';
			x.style.visibility = 'visible';
			useShim(obj,'show');
		}
	}
}

function hide(obj,index)
{
	var x = new getObj(obj);
	if (x.style.visibility == 'visible'){
		useShim(obj,'hide');
		x.style.visibility = 'hidden';		
	}
}

function getWindowSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
  return [myWidth, myHeight];
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  //window.alert( 'Y Scroll = ' + scrOfY );
  //window.alert( 'X Scroll = ' + scrOfX );
  return [scrOfX, scrOfY];
}

function ScrollWindow(ItemName){
    var itemObj = new getObj(ItemName);
    var itemY = findPosY(itemObj.obj);
    var WinScroll = getScrollXY();
    var WinSize = getWindowSize();
    if ((WinScroll[1] + WinSize[1]) <= (itemY+50)){
        SmoothScroll(50);
    }
    if (WinScroll[1] >= (itemY-50)){
        SmoothScroll(-50);
    }    
}

function SmoothScroll(direction){
    var movecount = 0;
    if(direction > 0){movecount = 1;}
    if(direction < 0){movecount = -1;}
    if(direction != 0){
        scrollBy(0,movecount); 
        clearInterval(bScroll);
        bScroll = setTimeout('SmoothScroll('+direction+')',10);
    }else{
        clearInterval(bScroll);
    }
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
	var i = 0;

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 
//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function expand(id, MenuHeight, MenuWidth, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
	var MenuHPercent = Math.round((MenuHeight/50))	
	var MenuWPercent = Math.round((MenuWidth/50))	
    var timer = 0; 
	var i = 0;
	var num = 0;
	changeExpand(MenuHeight,MenuWidth,id);
	for(i = 0; i <= 50; i++) { 
		NumH = Math.round(i * MenuHPercent)
		NumW = Math.round(i * MenuWPercent)
		if (NumH >= MenuHeight) NumH = MenuHeight
		if (NumW >= MenuWidth) NumW = MenuWidth
        setTimeout("changeExpand(" + NumH + "," + NumW + ",'" + id + "')",(timer * speed)); 
    	timer++; 
	}
	setTimeout("changeExpand(0,0,'" + id + "')",(timer * speed));
} 
//change the height/width
function changeExpand(height, width, id) { 
    var object = document.getElementById(id).style; 
	object.overflow = 'hidden';
	if (height == 0 && width == 0){
		object.clip = "rect(auto auto auto auto)";
	} else {
		clipTo(object,0,width,height,0);
	}
} 

function clipTo(obj,t,r,b,l){
  	if (document.layers){
         obj.clip.top = t;
         obj.clip.right = r;
         obj.clip.bottom = b;
         obj.clip.left = l;
   	} else {
          obj.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
    }
}


function useShim(obj,act){
	if (is_win && (is_ie5 || is_ie6 ) || is_mac && is_nav6up) {
		var DivRef = document.getElementById(obj);
		var IfrRef = document.getElementById('Shim'+obj);
		if (DivRef.style.visibility == 'visible' && act == 'show'){
			IfrRef.style.display = 'block';	
			IfrRef.style.visibility = 'visible';
		} else {
			IfrRef.style.display = 'none';	
			IfrRef.style.visibility = 'hidden';		
		}
	}
}

function getElementsByClassName(oElm, strTagName, strClassName){
/*
    Written by Jonathan Snook, http://www.snook.ca/jonathan
    Add-ons by Robert Nyman, http://www.robertnyman.com
*/
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];		
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}	
	}
	return (arrReturnElements)
}
// Array support for the push method in IE 5
if(typeof Array.prototype.push != "function"){
	Array.prototype.push = ArrayPush;
	function ArrayPush(value){
		this[this.length] = value;
	}
}
