NS6=(document.getElementById&&!document.all)
IE=(document.all);IE4=(document.all&&!document.getElementById)
NS=(navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4")
OP=(navigator.userAgent.indexOf('Opera')>-1)

function PageOnLoad()
{	local_PageOnLoad();			}

function PageOnUnLoad()
{	local_PageOnUnLoad();		}

function OpenNewPicture(new_pix)
{	winNewPix = window.open('/scripts/site/show.picture?pix=' + new_pix, 'winNewPix', 'width=400,height=400,scrollbars=0,status=0,resize=1'); winNewPix.focus(); return false;		}

function MM_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 = MM_findObj(n,d.layers[i].document);	}
	if (!x && document.getElementById) { x=document.getElementById(n); }
	return x;
}

var ar_OpenPopupMenus = new Array();

function MM_showHideLayers() 
{	//v3.0
	var i, p, v, obj, args = MM_showHideLayers.arguments;
	
	for (i = 0; i < (args.length-2); i += 5) 
	{	if ((obj = MM_findObj(args[i])) != null) 
		{	st_object_name = args[i+0];
			e = args[i+1];
			v = args[i+2];
			dx = args[i+3];
			dy = args[i+4];
			offsetLeft = args[i+5];
			offsetTop = args[i+6];
			if (obj.style) 
			{	obj = obj.style; 
				if (v == 'show')
				{	obj.left = offsetLeft + dx;
					obj.top = offsetTop + dy; 
					for (in_popup_menu = 1; in_popup_menu <= ar_OpenPopupMenus.length; in_popup_menu++) 		// clear all timeouts and also close open menus
					{	if (ar_OpenPopupMenus[in_popup_menu-1] != "Processed")
						{	popup_to_close = ar_OpenPopupMenus[in_popup_menu-1];
							popup_to_close.visibility = 'hidden';
							ar_OpenPopupMenus[in_popup_menu-1] = "Processed";	// mark element as processed
						}
					}
					ar_OpenPopupMenus[ar_OpenPopupMenus.length] = obj;
//					setTimeout("document.all." + st_object_name + ".style.visibility = 'hidden';", 20000); 
					setTimeout("document.getElementById(" + st_object_name + ").style.visibility = 'hidden';", 20000); 
				}
				v = ((v == 'show' || v == 'nochange')? 'visible' : (v == 'hide') ? 'hidden' : v ); 
			}
			obj.visibility = v; 
		}
	}
}

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 resize_browser_to_limits()
{	this.resizeTo(window.screen.availWidth, window.screen.availHeight);		}

function confirmMessageBox(st_message, st_name, st_url, st_next_page) 
{	switch(confirm(st_message + " '" + st_name + "'?"))
	{	case true:
			location.href = st_url;
			if (st_next_page == "undefined")
			{	st_connector = ((st_url.search("/?/i") > -1)? "?" : "&");
				location.href = (st_url + st_connector + "st_next_page=" + st_next_page);
			}
			break;
		case false:
			break;
	}
}

function confirmDelete(iname, delURL, referer) 
{	if (confirm("Are you sure you wish to delete '" + iname + "'?")) 
	{	location.href = (delURL + "&referer_page=" + referer);		}
}

//for popup windows e.g to display zipcodes
function PopUp(st_popupURL, st_name, in_width, in_height, bo_scroll) 
{	window.open(st_popupURL, st_name,'width=' + in_width + ',' + 'height=' + in_height + ',' + 'scrollbars=' + bo_scroll);		}

function PopUpPage(st_popupURL, st_name, st_parameters) 
{	window.open(st_popupURL, st_name, st_parameters);																			}

function openPage(pageURL)
{	location = pageURL;																											}

// will close the current window and reload the parent window
function reload_parent_form(in_index)
{	switch (in_index)
	{	case 0:									// open the formMemberProfile form 
			opener.formMemberProfile.submit();
			break;
		case 1:									// open the formMemberProfile form 
			opener.formProject.submit();
			break;
		default:
			self.opener.submit();
	}
	window.close();
}

function test()
{	alert('function test called');
}

function parent_redirect(url)
{	self.opener.location = url;
}

function refreshParent()
{	self.opener.location.reload();
	window.close();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


NS6=(document.getElementById&&!document.all)
IE=(document.all);IE4=(document.all&&!document.getElementById)
NS=(navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4")
OP=(navigator.userAgent.indexOf('Opera')>-1)

tempBar='';barBuilt=0;lastY=0;lastX=0
//sI=new Array();
moving=setTimeout('null',1);

function moveOut() {
	if(parseInt(ssm.left)<0&&mPos||parseInt(ssm.left)>0&&!mPos){
		clearTimeout(moving);
		moving=setTimeout('moveOut()', slideXSpeed);
		slideMenu((!mPos)?"out":"out");
		}
	else {
		clearTimeout(moving);
		moving=setTimeout('null',1);
	}
}
function moveBack() {
	clearTimeout(moving);
	moving=setTimeout('moveBack1()',waitTime);
}
function moveBack1() {
	if(parseInt(ssm.left)>-(menuWidth+1)&&mPos||parseInt(ssm.left)<menuWidth+1&&!mPos) {
		clearTimeout(moving);
		moving=setTimeout('moveBack1()',slideXSpeed);
		slideMenu((!mPos)?"in":"in");
	}
	else{
		clearTimeout(moving);
		moving=setTimeout('null',1);
	}
}
function slideMenu(way){
	fHow=(NS6)?0.4:0.2;
	if(way=="out")flow=fHow*-(parseInt(ssm.left));
	if(way=="in"&&!mPos)flow=fHow* (menuWidth+1-parseInt(ssm.left));
	else if(way=="in")flow=fHow*-(menuWidth+1+parseInt(ssm.left));
	if(flow>0)flow=Math.ceil(flow);
	else flow=Math.floor(flow);
	if(IE||NS6){
		lastX+=flow;
		bssm.clip="rect(0 "+((!mPos)?(barWidth+menuWidth+3):(barWidth+2+lastX))+" "+(((IE4)?document.body.clientHeight:0)+tssm.offsetHeight)+" "+((!mPos)?(lastX+1):0)+")";
		}
	ssm.left=parseInt(ssm.left)+flow;
	if(NS){
		if(!mPos){
			bssm.clip.left+=flow;
			bssm2.clip.left+=flow;
		}
		else{
			bssm.clip.right+=flow;
			bssm2.clip.right+=flow;
		}
		if(bssm.left+bssm.clip.right>document.width)document.width+=flow;
	}
}

function makeStatic() {
	winY=(IE)?document.body.scrollTop:window.pageYOffset;
	sHow=(NS6)?0.4:0.2;
	if(winY!=lastY&&winY>YOffset-staticYOffset)smooth=sHow*(winY-lastY-YOffset+staticYOffset);
	else if(YOffset-staticYOffset+lastY>YOffset-staticYOffset&&winY<=YOffset-staticYOffset)smooth=sHow*(winY-lastY-(YOffset-(YOffset-winY)));
	else smooth=0;
	if(smooth>0)smooth=Math.ceil(smooth);
	else smooth=Math.floor(smooth);
	bssm.top=parseInt(bssm.top)+smooth;
	lastY=lastY+smooth;
	setTimeout('makeStatic()',slideYSpeed);
}

function menuClick(id) { 
	obj=(document.all)?document.all(id):document.getElementById(id);
	with(obj){
		if(event.srcElement.id!=id){
			if(target=="_top")top.location=href;
			else if(target=="_parent")parent.location=href;
			else if(target=="_blank")window.open(href);
			else if(target>""&&top.frames[target])top.frames[target].location=href;
			else if(target>"")eval('window.open("'+href+'","'+target+'")');
			else location=href;
		}
	}
}

function buildBar() {
	if(!barType)tempBar='<IMG SRC="'+barText+'" BORDER="0">';
	else{
		for(b=0;b<barText.length;b++)tempBar+=barText.charAt(b)+"<BR>"
	}
	ssmHTML+='<td align="center" rowspan="100" width="'+barWidth+'" bgcolor="'+barBGColor+'" valign="'+barVAlign+'" align="'+barAlign+'" class="ssmBar" NOWRAP>'+tempBar+'</td>';
}

function initSlide() {
	if (!mPos)lastX=menuWidth
	if ((NS6||IE)&&!OP||(operaFix!=2&&OP)){
		ssm=(NS6)?document.getElementById("thessm").style:document.all("thessm").style;
		tssm=(NS6)?document.getElementById("thessm"):document.all("thessm");
		bssm=(NS6)?document.getElementById("basessm").style:document.all("basessm").style;
		bssm.clip="rect(0 "+(barWidth+2+((!mPos)?menuWidth+1:0))+" "+(((IE4)?document.body.clientHeight:0)+tssm.offsetHeight)+" "+((!mPos)?(menuWidth+1):0)+")";
		if (OP&&operaFix==1)XOff=(!mPos)?document.body.clientWidth-barWidth-3:0;
		bssm.left=(!mPos)?XOff-menuWidth:XOff;
		if(OP)ssm.left=ssm.left;
		bssm.visibility="visible";
		if(NS6&&!OP){
			bssm.top=YOffset;
			if(menuOpacity!=100)ssm.MozOpacity=menuOpacity/100;
			slideIsGo=window.innerHeight>tssm.offsetHeight+staticYOffset;
		}
		else{
			if(menuOpacity!=100)ssm.filter="alpha(opacity="+menuOpacity+")";
			slideIsGo=((OP)?window.innerHeight:document.body.clientHeight)>parseInt(tssm.offsetHeight)+staticYOffset;
			}
		if(autoHideXOverflow&&((IE?document.body.clientWidth:window.innerWidth-16)<parseInt(bssm.left)+parseInt(ssm.left)+menuWidth+barWidth+3)){
			document.body.style.overflowX="hidden";
			document.body.style.overflowY="scroll";
		}
	}
	else if(NS){
		bssm=document.layers["basessm1"];
		bssm2=bssm.document.layers["basessm2"];
		ssm=bssm2.document.layers["thessm"];
		bssm.clip.left=(!mPos)?menuWidth+1:0;
		bssm.clip.right=(!mPos)?(menuWidth+barWidth+3):barWidth+2;
		bssm.left=(!mPos)?XOff-menuWidth:XOff;
		ssm.visibility="show";
		slideIsGo=window.innerHeight>ssm.clip.bottom+staticYOffset;
	}
	if(slideY&&(slideOnYOverflow||(!slideOnYOverflow&&slideIsGo)))makeStatic();
	if(!slideX)moveOut();
}

function getXOff() {
	return (((!XAlign)?((IE||OP)?document.body.clientWidth-barWidth-3:window.innerWidth-barWidth-3-17):(XAlign==1)?Math.floor(((IE||OP)?document.body.clientWidth/2-barWidth/2-1.5:window.innerWidth/2-barWidth/2-1.5)):0)+XOffset);
}

function buildMenu() {
	mPos=menuPosition;
	ssmHTML="";
	XOff=getXOff();
	if(IE||NS6)ssmHTML+='<DIV ID="basessm" style="visibility:hidden;Position : Absolute ;Top : '+YOffset+' ;Z-Index : 20;width:'+(barWidth+2)+';"><DIV ID="thessm" style="Position : Absolute ;Left : '+((!mPos)?menuWidth+1:-menuWidth-1)+' ;Top : 0px ;Z-Index : 30;'+((IE)?"width:1px":"")+'" '+((slideX)?'onmouseover="moveOut()" onmouseout="moveBack()")':'')+'>';
	if(NS)ssmHTML+='<LAYER name="basessm1" top="'+YOffset+'" visibility="show" onload="initSlide()"><ILAYER name="basessm2"><LAYER visibility="hide" name="thessm" bgcolor="'+menuBGColor+'" left="'+((!mPos)?menuWidth+1:-menuWidth-1)+'" '+((slideX)?'onmouseover="moveOut()" onmouseout="moveBack()")':'')+'>';
	if(NS6)ssmHTML+='<table border="0" cellpadding="0" cellspacing="0" width="'+(menuWidth+barWidth+3)+'"><TR><TD>';
	ssmHTML+='<table border="0" cellpadding="0" cellspacing="1" width="'+(menuWidth+barWidth+3)+'" bgcolor="'+((!NS)?menuBGColor:"")+'">';
	for(i=0;i<sI.length;i++){
		ssmHTML+='<TR>';
		if(barBuilt==0&&!mPos){
			buildBar();
			barBuilt=1
		}
		if(sI[i][3]>1)ssmHTML+='<TD BGCOLOR="'+hdrBGColor+'" ALIGN="'+hdrAlign+'" WIDTH="'+menuWidth+'"'+((NS6)?' style="padding:'+hdrPadding+'px"':'><TABLE CELLPADDING="'+hdrPadding+'" CELLSPACING="0" BORDER="0"><TR><TD')+' CLASS="ssmHdr" VALIGN="'+hdrVAlign+'">'+((sI[i][3]==3)?'<a HREF="'+((sI[i][1].indexOf("://")==-1&&sI[i][1].indexOf("../")==-1)?targetDomain:'')+sI[i][1]+'" target="'+sI[i][2]+'" class="ssmHdr">':'')+sI[i][0]+((sI[i][3]==3)?'</a>':'')+((NS6)?'':'</TD></TR></TABLE>')+'</TD>';
		else{
			if(!sI[i][2])sI[i][2]=targetFrame;
			ssmHTML+='<TD WIDTH="'+menuWidth+'"'+(NS&&!sI[i][3]?'':'BGCOLOR="'+linkBGColor+'"')+' '+((NS6)?'CLASS="ssmItem" style="padding:'+linkPadding+'px;" ALIGN="'+linkAlign+'"':'')+' '+((sI[i][3])?'>':'onmouseover="style.backgroundColor=\''+linkOverBGColor+'\'" onmouseout="style.backgroundColor=\''+linkBGColor+'\'" onclick="menuClick(\'item_'+i+'\');"'+(IE?' style="cursor:hand;"':'')+'><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="100%" ALIGN="'+linkAlign+'" bgcolor="'+linkBGColor+'">')+((NS6)?'':'<DIV ALIGN="'+linkAlign+'" CLASS="ssmItem"><TABLE CELLPADDING="'+linkPadding+'" CELLSPACING="0" BORDER="0"><TR><TD VALIGN="'+linkVAlign+'" CLASS="ssmItem">')+((sI[i][3])?'':'<A HREF="'+((sI[i][1].indexOf("://")==-1&&sI[i][1].indexOf("../")==-1)?targetDomain:'')+sI[i][1]+'" target="'+sI[i][2]+'" CLASS="ssmItem" id="item_'+i+'">')+sI[i][0]+''+((sI[i][3])?'':'</A>')+((NS6)?'':'</TD></TR></TABLE></DIV>')+((sI[i][3])?'':'</LAYER></ILAYER>')+'</TD>';
		}
		if(barBuilt==0&&mPos){
			buildBar();
			barBuilt=1;
		}
		ssmHTML+='</TR>';
	}
	ssmHTML+='</table>';
	if(NS6)ssmHTML+='</TD></TR></TABLE>';
	if(IE||NS6){
		ssmHTML+='</DIV></DIV>';
		setTimeout('initSlide();',1);
	}
	if(NS)ssmHTML+='</LAYER></ILAYER></LAYER>';
	document.write(ssmHTML);
}

function addHdr(text){sI[sI.length]=[text, '', '', 2]}
function addLink(text, link, target){if(!link)link="javascript://";sI[sI.length]=[text, link, target, 3]}
function addItem(text, link, target){if(!link)link="javascript://";sI[sI.length]=[text, link, target, 0]}
function addText(text){sI[sI.length]=[text, '', '', 1]}

//window.onresize=function(){setTimeout('alert(getOff());XOff=getXOff();bssm.left=(!mPos)?XOff-menuWidth:XOff;');}

buildMenu(); 

function MakeIELinksBlink() 
{	if (!document.all) return;
	else 
	{	for(i=0;i<document.all.tags('blink').length;i++)
		{	s=document.all.tags('blink')[i];
			s.style.visibility=(s.style.visibility=='visible')  ?'hidden':'visible';
		}
	}
}

setInterval('MakeIELinksBlink()',1000);

function findInPage() 
{ 	if (parseFloat(navigator.appVersion) >= 4) 
	{ 	if (document.all) 
		{ 	st_text_to_find = window.prompt('Enter a search string', '');
			if (st_text_to_find == '') exit;
			var rng = document.body.createTextRange(); 
			var found = rng.findText(st_text_to_find); 
			if (found != false)
			{	rng.select(); 
				rng.scrollIntoView(); 
			}else { alert('Sorry, no matching information found.');	}
		} else {	window.find(); 	} 
	} 
}


// Specify speed of scroll. Larger=faster (ie: 5)
var scrollspeed=cache=2

// Specify intial delay before scroller starts scrolling (in miliseconds):
var initialdelay=500

function initializeScroller()
{	dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
	if (dataobj != null) 
	{	dataobj.style.top="5px"			
		setTimeout("getdataheight()", initialdelay) 
	}
}

function getdataheight()
{	thelength=dataobj.offsetHeight
	if (thelength==0) setTimeout("getdataheight()",10)
	else scrollDiv()
}

function scrollDiv()
{	dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
	if (parseInt(dataobj.style.top)<thelength*(-1)) dataobj.style.top="5px"
	setTimeout("scrollDiv()",40)
}

if (window.addEventListener) window.addEventListener("load", initializeScroller, false)
else if (window.attachEvent) window.attachEvent("onload", initializeScroller)
else window.onload=initializeScroller

// -- PUT THIS CODE AROUND THE CONTENT TO SCROLL IN AN HTML FILE LOADED IN AN IFRAME OBJECT
// <div id="datacontainer" style="position:absolute;left:1px;top:10px;width:100%" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache">
// </div>
// 
// -- SAMPLE IFRAME CODE THAT CAN BE USED
// <iframe src="url-to-page-to-load" name="frmEvents" id="frmEvents" width="100%" height="100" marginwidth="0" marginheight="0" frameborder="0" style="border: 0px solid groove;" border="0" scrolling="no"></iframe>

// *********************************************************************

function reformat_date(st_date)
{	ar_date = st_date.split("-");
	return ar_date[1] + "/" + ar_date[2] + "/" + ar_date[0];
}

var agt=navigator.userAgent.toLowerCase();
var is_opera = (agt.indexOf("opera") != -1);

function ShowHelp(obj,field)
{	//Get help object
	var helpObj;
	if (document.all) { helpObj = document.all[field+"_help"];	}
	else if (document.getElementById)
	{	helpObj = document.getElementById(field+"_help");		}
	if (helpObj) 
	{	//if help object is shown, hide it ; if object hidden, show it
		if (helpObj.style.display == "")
		{	helpObj.style.display = "none";		}
		else
		{	helpObj.style.display = "";			}

		//Get location of mouseover object, move help object to the left if will display off-screen
		var divWidth = 340;
		var offsetLeft = getOffsetLeft(obj);
		var screenWidth = (window.innerWidth) ? window.innerWidth - 25 : document.body.clientWidth;
		if ((offsetLeft + divWidth) > screenWidth) offsetLeft = screenWidth - divWidth;
		newX = offsetLeft;
	
		//Get location of mouseover object, move help object on top if will display off-screen
		var divHeight = helpObj.offsetHeight;
		var offsetTop = getOffsetTop(obj) + obj.offsetHeight;
		var screenHeight = (window.innerHeight) ? window.innerHeight - 25 : document.body.clientHeight;
//		if ((offsetTop + divHeight) > screenHeight + getScrollY()) offsetTop = getOffsetTop(obj) - divHeight;
		newY = offsetTop;	
	
		helpObj.style.top = newY;
		helpObj.style.left = newX;

		if (helpObj.style.display == "")
		{
		  qh_hideElement("select",helpObj);  
		  qh_hideElement("object",helpObj);  
		  qh_hideElement("embed",helpObj);  
		}else
		{
		  qh_showElement("select");  
		  qh_showElement("object");  
		  qh_showElement("embed");
		}
	}
}

function getOffsetTop (elm) 
{	var mOffsetTop = elm.offsetTop;
	var mOffsetParent = elm.offsetParent;
	while (mOffsetParent) 
	{	mOffsetTop += mOffsetParent.offsetTop;
		mOffsetParent = mOffsetParent.offsetParent;
	}
	return mOffsetTop;
}

function getOffsetLeft (elm) 
{	var mOffsetLeft = elm.offsetLeft;
	var mOffsetParent = elm.offsetParent;
	while (mOffsetParent) 
	{	mOffsetLeft += mOffsetParent.offsetLeft;
		mOffsetParent = mOffsetParent.offsetParent;
	}
	return mOffsetLeft;
}

function getScrollY() 
{	var scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) 
	{	//Netscape
	    scrOfY = window.pageYOffset;
	}else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) 
	{	//DOM
	    scrOfY = document.body.scrollTop;
	}else if( document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 
	{	//IE6
	    scrOfY = document.documentElement.scrollTop;
	}
	return scrOfY;
}

function qh_hideElement( elmID, overDiv ) 
{	if(document.all) 
	{	for(i = 0; i < document.all.tags( elmID ).length; i++) 
		{	obj = document.all.tags( elmID )[i];
			if(!obj || !obj.offsetParent) continue;

			// Find the element's offsetTop and offsetLeft relative to the BODY tag.
			objLeft   = obj.offsetLeft;
			objTop    = obj.offsetTop;
			objParent = obj.offsetParent;
			
			while(objParent.tagName.toUpperCase() != 'BODY') 
			{	objLeft  += objParent.offsetLeft;
		        objTop   += objParent.offsetTop;
		        objParent = objParent.offsetParent;
			}
			
			objHeight = obj.offsetHeight;
			objWidth  = obj.offsetWidth;
			
			if((overDiv.offsetLeft + overDiv.offsetWidth) <= objLeft);
			else if((overDiv.offsetTop + overDiv.offsetHeight) <= objTop);
			else if(overDiv.offsetTop >= (objTop + objHeight));
			else if(overDiv.offsetLeft >= (objLeft + objWidth));
			else { obj.style.visibility = 'hidden';		    }
		}
	}
}

function qh_showElement(elmID) 
{	if(document.all) 
	{	for(i = 0; i < document.all.tags( elmID ).length; i++) 
		{	obj = document.all.tags(elmID)[i];
			if(!obj || !obj.offsetParent) continue;
			obj.style.visibility = '';
		}
	}
}

function checkDomain(searchForm)
{	var canSubmit = false;
	var searchValue;
	if (searchForm.domainToCheck)
	{	searchValue = searchForm.domainToCheck.value;
		if (searchValue != '')
		{	var regExInvalidChars = /[^a-zA-Z0-9-\s.]+/;
			if (regExInvalidChars.test(searchValue))
			{	alert('Invalid character in domain.\n\nOnly letters, numbers or hyphens are allowed.')
			}else
			{	canSubmit = true;
			}
		}
	}
	if (canSubmit) 
	{	return true;				}
	else
	{	return false;				}
}

function execute_code(response)
{	
	eval(response);
}

function setCookie(c_name,value,expiredays)
{	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function build_content(url, callback_function, return_xml, st_return_mode) 			// return mode, c
{	var http_request = false; 
	if (window.XMLHttpRequest) 
	{	// Mozilla, Safari,... 
		http_request = new XMLHttpRequest(); 
		if (http_request.overrideMimeType) 
		{	http_request.overrideMimeType('text/xml'); 		} 
	} else if (window.ActiveXObject) 
	{	// IE 
		try 
		{	http_request = new ActiveXObject("Msxml2.XMLHTTP"); 
		} catch (e) 
		{ 	try 
			{ 	http_request = new ActiveXObject("Microsoft.XMLHTTP"); 
			} catch (e) {} 
		} 
	} 

	if (!http_request) 
	{	alert('Unfortunatelly you browser doesn\'t support this feature.'); 
		return false; 
	} 
	http_request.onreadystatechange = function() 
	{ 	if (http_request.readyState == 4) 
		{	if (http_request.status == 200) 
			{	
//				if (return_xml == true) 
//				{	eval(callback_function + '(http_request.responseXML)'); 
//               	} else 
//               	{	eval(callback_function + '(http_request.responseText)'); 
//				} 
				
				if (st_return_mode == 'VARIABLE')		// st_return_mode == 'VARIABLE'
				{	if (return_xml == true) 
					{	eval(callback_function + ' = (http_request.responseXML)'); 
	               	} else 
	               	{	eval(callback_function + ' = (http_request.responseText)'); 
					} 
				}else									// st_return_mode == 'CALLBACK-FUNCTION'
				{	if (return_xml == true) 
					{	eval(callback_function + '(http_request.responseXML)'); 
	               	} else 
	               	{	eval(callback_function + '(http_request.responseText)'); 
					} 
				}
			} else 
			{ 
               alert('There was a problem with the request.(Code: ' + http_request.status + ')'); 
			} 
       } 
   } 
   http_request.open('GET', url, true); 
   http_request.send(null); 
}

// PAGEBUILDER INTEGRATION STARTS
function pbPreviewDocument()
{	// note, cannot preview stylesheets.
	var ob_pattern = new RegExp("Site Design");
	if (ob_pattern.test(document.getElementById('file_name').value) == true)
	{	st_site_design = document.getElementById('file_name').value; 
		st_site_design = st_site_design.replace("Site Design", "").replace("[", "").replace("]", "").replace(" ", "").replace(" ", "");
		docPreview = window.open(document.getElementById('default_page').value + "/vts/" + st_site_design + "/vtsaction/preview/", "docPreview", "", true);
	}else 
	{	docPreview = window.open(documentURL.replace("/documents/", "/viewer/").replace("//", "/") ,"docPreview", "", true);		}
	docPreview.focus();
}

function pbInsertNavigationBar()
{	winNavigationWin = window.open("/viewer/mgr.cp/pagebuilder.navigationWin.asd/vts/pagebuilder" ,"winNavigationWin","scrollbars=auto,resizable=yes",true);
	winNavigationWin.focus();
}

function pbInsertTextGroup()
{	winInsertTextGroup = window.open("/viewer/mgr.cp/pagebuilder.insertTextGroup.asd/vts/pagebuilder" ,"winInsertTextGroup","scrollbars=auto,resizable=yes",true);
	winInsertTextGroup.focus();
}

function pbInsertTextFieldTemplateObject()
{	winInsertTemplateItem = window.open("/viewer/mgr.cp/pagebuilder.insertTemplateItem.asd/vts/pagebuilder" ,"winInsertTemplateItem","scrollbars=yes,resizable=yes",true);
	winInsertTemplateItem.focus();
}

function pbInsertAccessControlObject()
{	winInsertAccessControlObject = window.open("/viewer/mgr.cp/pagebuilder.insertAccessControlObject.asd/vts/pagebuilder" ,"winInsertAccessControlObject","scrollbars=auto,resizable=yes",true);
	winInsertAccessControlObject.focus();
}

function pbInsertMemberProfileFieldObject()
{	winInsertMemberProfileField = window.open("/viewer/mgr.cp/pagebuilder.insertMemberProfileField.asd/vts/pagebuilder" ,"winInsertMemberProfileField","scrollbars=auto,resizable=yes",true);
	winInsertMemberProfileField.focus();
}

function pbInsertConfigurationFieldObject()
{	winInsertConfigurationField = window.open("/viewer/mgr.cp/pagebuilder.insertConfigurationField.asd/vts/pagebuilder" ,"winInsertConfigurationField","scrollbars=yes,resizable=yes",true);
	winInsertConfigurationField.focus();
}

function pbInsertPhotoAlbumObject()
{	winInsertPhotoAlbumObject = window.open("/viewer/mgr.cp/pagebuilder.insertPhotoAlbumObject.asd/vts/pagebuilder" ,"winInsertPhotoAlbumObject","scrollbars=auto,resizable=yes",true);
	winInsertPhotoAlbumObject.focus();
}

function pbInsertSearchEngineObject()
{	winInsertSearchEngineObject = window.open("/viewer/mgr.cp/pagebuilder.insertSearchEngineObject.asd/vts/pagebuilder" ,"winInsertSearchEngineObject","scrollbars=auto,resizable=yes",true);
	winInsertSearchEngineObject.focus();
}

function pbGetStatusBoardObject()
{	var d = "\n";
	d += "<input name='PageBuilderObject' pbotype='status-board' "
	d += "type='button' style='border=0; background-color: #FFFEC2; font-weight:normal; font-size:10px; font-family: Verdana; color: Black; text-align: center;' value='\n";
	d += "Status Board Object (DO NOT EDIT)\n";
	d += "'>";
	return d;
}

function pbGetGuestbookObject()
{	var d = "\n";
	d += "<input name='PageBuilderObject' pbotype='guestbook' "
	d += "type='button' style='border=0; background-color: #FFFEC2; font-weight:normal; font-size:10px; font-family: Verdana; color: Black; text-align: center;' value='\n";
	d += "Guest Book Object (DO NOT EDIT)\n";
	d += "'>";
	return d;
}

function pbInsertGuestBookFieldTemplateObject()
{	winInsertGuestBookField = window.open("/viewer/mgr.cp/pagebuilder.insertGuestBookField.asd/vts/pagebuilder" ,"winInsertGuestBookField","scrollbars=yes,resizable=yes",true);
	winInsertGuestBookField.focus();
}

function pbGetRecordStartObject()
{	var d = "\n";
	d += "<input name='PageBuilderObject' pbotype='record-start' "
	d += "type='button' style='border=0; background-color: #FFFEC2; font-weight:normal; font-size:10px; font-family: Verdana; color: Black; text-align: center;' value='\n";
	d += "Record Start Object\n(DO NOT EDIT)\n";
	d += "'>";
	return d;
}

function pbGetRecordEndObject()
{	var d = "\n";
	d += "<input name='PageBuilderObject' pbotype='record-end' "
	d += "type='button' style='border=0; background-color: #FFFEC2; font-weight:normal; font-size:10px; font-family: Verdana; color: Black; text-align: center;' value='\n";
	d += "Record End Object\n(DO NOT EDIT)\n";
	d += "'>";
	return d;
}

function pbInsertLinkFieldTemplateObject()
{	winInsertLinkTemplateItem = window.open("/viewer/mgr.cp/pagebuilder.insertLinkTemplateItem.asd/vts/pagebuilder" ,"winInsertLinkTemplateItem","scrollbars=yes,resizable=yes",true);
	winInsertLinkTemplateItem.focus();
}

function pbInsertNewsletterFieldObject()
{	winInsertNewsletterField = window.open("/viewer/mgr.cp/pagebuilder.insertNewsletterField.asd/vts/pagebuilder" ,"winInsertNewsletterField","scrollbars=yes,resizable=yes",true);
	winInsertNewsletterField.focus();
}

function pbInsertNewsletterObject()
{	winInsertNewsletterObject = window.open("/viewer/mgr.cp/pagebuilder.insertNewsletterObject.asd/vts/pagebuilder" ,"winInsertNewsletterObject","scrollbars=auto,resizable=yes",true);
	winInsertNewsletterObject.focus();
}

function pbInsertUpdateMemberProfileObject()
{	winInsertUpdateMemberProfileObject = window.open("/viewer/mgr.cp/pagebuilder.insertUpdateMemberProfileObject.asd/vts/pagebuilder" ,"winInsertUpdateMemberProfileObject","scrollbars=auto,resizable=yes",true);
	winInsertUpdateMemberProfileObject.focus();
}

function pbInsertWebsiteLogo()
{	winSiteLogoObject = window.open("/viewer/mgr.cp/pagebuilder.insertSiteLogoObject.asd/vts/pagebuilder" ,"winSiteLogoObject","scrollbars=auto,resizable=yes",true);
	winSiteLogoObject.focus();
}

function pbInsertDateObject()
{	winCurrentDateObject = window.open("/viewer/mgr.cp/pagebuilder.insertCurrentDateObject.asd/vts/pagebuilder" ,"winCurrentDateObject","scrollbars=1,resizable=yes",true);
	winCurrentDateObject.focus();
}

function pbInsertCopyrightObject()
{	winInsertCopyrightObject = window.open("/viewer/mgr.cp/pagebuilder.insertCopyrightObject.asd/vts/pagebuilder" ,"winInsertCopyrightObject","scrollbars=auto,resizable=yes",true);
	winInsertCopyrightObject.focus();
}

function pbInsertAudioHyperlink(editor)
{	winInsertPlayMusicLink = window.open("/viewer/mgr.cp/pagebuilder.insertPlayMusicLink.asd/vts/pagebuilder" + ((editor != null)? "/editor/" + editor : "") ,"winInsertPlayMusicLink","scrollbars=auto,resizable=yes",true);
	winInsertPlayMusicLink.focus();
}

function pbInsertVideoHyperlink(editor)
{	winInsertPlayVideoLink = window.open("/viewer/mgr.cp/pagebuilder.insertPlayVideoLink.asd/vts/pagebuilder" + ((editor != null)? "/editor/" + editor : "") ,"winInsertPlayVideoLink","scrollbars=auto,resizable=yes",true);
	winInsertPlayVideoLink.focus();
}

function pbPublishGenericContent(editor)
{	winPublishGenericContent = window.open("/viewer/mgr.cp/pagebuilder.insertGenericContent.asd/vts/pagebuilder" + ((editor != null)? "/editor/" + editor : "") ,"winPublishGenericContent","scrollbars=auto,resizable=yes",true);
	winPublishGenericContent.focus();
}

function pbInsertFlashMovie()
{	winInsertFlashObject = window.open("/viewer/mgr.cp/pagebuilder.insertFlashObject.asd/vts/pagebuilder" ,"winInsertFlashObject","scrollbars=auto,resizable=yes",true);
	winInsertFlashObject.focus();
}

function pbInsertForm()
{	winInsertFormObject = window.open("/viewer/mgr.cp/pagebuilder.insertFormObject.asd/vts/pagebuilder" ,"winInsertFormObject","scrollbars=auto,resizable=yes",true);
	winInsertFormObject.focus();
}

function pbInsertRSSFeed()
{	winInsertRSSFeed = window.open("/viewer/mgr.cp/pagebuilder.insertRSSFeed.asd/vts/pagebuilder" ,"winInsertRSSFeed","scrollbars=auto,resizable=yes",true);
	winInsertRSSFeed.focus();
}

function pbGetPageViewObject()
{	var d = "\n";
	d += "<input name='PageBuilderObject' pbotype='page-view' "
	d += "type='button' style='height=250; width=250; border=0; background-color: #FFFEC2; font-weight:normal; font-size:10px; font-family: Verdana; color: Black; text-align: center;' value='\n";
	d += "Page View Object (DO NOT EDIT)\n\n";
	d += "The page view is the part of the page\n";
	d += "that changes from page to page on the\n";
	d += "the site.\n";
	d += "'>";
	return d;
}

function pbGetStoreAdd2CartButton()
{   var d = "\n";
    d += "<FORM action=/viewer/mgr.shop/shoppingcart.asd/scaction/add method=post style='display: inline;'><INPUT style='WIDTH: 79px; HEIGHT: 22px' type=hidden size=9 value=PRODUCT_ID name=scspid><INPUT class=button type=submit value='Add to Cart'></FORM>";
    return d;
}

function pbGetStoreAdd2CartButtonWithQuantityOptions()
{   var d = "\n";
    d += "<FORM action=/viewer/mgr.shop/shoppingcart.asd/scaction/add method=post style='display: inline;'><INPUT style='WIDTH: 79px; HEIGHT: 22px' type=hidden size=9 value=PRODUCT_ID name=scspid>Qty: <INPUT style='WIDTH: 23px; HEIGHT: 22px' type=text size=1 value=1 name=qty><INPUT class=button type=submit value='Add to Cart'></FORM>";
    return d;
}

function pbGetStoreAdd2CartButtonWithListPricesOptions()
{   var d = "\n";
    d += "<FORM action=/viewer/mgr.shop/shoppingcart.asd/scaction/add method=post style='display: inline;'><select name=scspid><option value='0'>-- Make Selection --</option><option value='PRODUCT_ID_1'>DESCRIPTION1</option><option value='PRODUCT_ID_2'>DESCRIPTION2</option><option value='PRODUCT_ID_3'>DESCRIPTION3</option></select><INPUT class=button type=submit value='Add to Cart'></FORM>";
    return d;
}

function pbInsertAccountLoginObject()
{	winInsertLoginObject = window.open("/viewer/mgr.cp/pagebuilder.insertLoginObject.asd/vts/pagebuilder" ,"winInsertLoginObject","scrollbars=auto,resizable=yes",true);
	winInsertLoginObject.focus();
}

function pbInsertAccountRegistrationObject()
{	winInsertRegisterObject = window.open("/viewer/mgr.cp/pagebuilder.insertRegisterObject.asd/vts/pagebuilder" ,"winInsertRegisterObject","scrollbars=auto,resizable=yes",true);
	winInsertRegisterObject.focus();
}

function pbInsertNewPasswordObject()
{	winInsertNewPasswordObject = window.open("/viewer/mgr.cp/pagebuilder.insertNewPasswordObject.asd/vts/pagebuilder" ,"winInsertNewPasswordObject","scrollbars=auto,resizable=yes",true);
	winInsertNewPasswordObject.focus();
}

function pbInsertChangePasswordObject()
{	winInsertChangePasswordObject = window.open("/viewer/mgr.cp/pagebuilder.insertChangePasswordObject.asd/vts/pagebuilder" ,"winInsertChangePasswordObject","scrollbars=auto,resizable=yes",true);
	winInsertChangePasswordObject.focus();
}

function pbInsertGetPasswordObject()
{	winInsertGetPasswordObject = window.open("/viewer/mgr.cp/pagebuilder.insertGetPasswordObject.asd/vts/pagebuilder" ,"winInsertGetPasswordObject","scrollbars=auto,resizable=yes",true);
	winInsertGetPasswordObject.focus();
}

function methodX00017()
{	winOpenWebDoc = window.open("/viewer/mgr.cp/pagebuilder.openWebDoc.asd/vts/pagebuilder" ,"winOpenWebDoc","scrollbars=auto,resizable=yes",true);
	winOpenWebDoc.focus();
}

function methodX00018()
{	winOpenWebImage = window.open("/viewer/mgr.cp/pagebuilder.openWebImage.asd/vts/pagebuilder" ,"winOpenWebImage","scrollbars=auto,resizable=yes",true);
	winOpenWebImage.focus();
}

function methodX00019()
{	document.pagebuilder_form.file_name.value = pbReturnNewDocumentDefaultName();					
	document.pagebuilder_form.page_title.value = document.pagebuilder_form.page_description.value = document.pagebuilder_form.page_keywords.value = "";			
}

function pbInsertEmailHyperlink()
{	pageBuilder_linkwin = window.open("/viewer/mgr.cp/pagebuilder.insertEmailLink.asd/vts/pagebuilder" ,"pageBuilder_linkwin","scrollbars=auto,resizable=yes",true); 	
	pageBuilder_linkwin.focus();
}

function pbReturnNewDocumentDefaultName()
{	return "new_document.asd";			}

function pbSetEditorFileName(filename)
{	document.pagebuilder_form.file_name.value = filename; 		}

function pbInsertInsertImage() 
{	var winSelectImage = window.open("/viewer/mgr.cp/pagebuilder.selectImage.asd/vts/pagebuilder" ,"winSelectImage","scrollbars=yes,resizable=yes,status=1");
	winSelectImage.focus();
}

function pbGetCurrentDocumentFilename()
{	return escape(document.pagebuilder_form.file_name.value);	}

function pbOpenDocument()
{	var winOpenDoc = window.open("/viewer/mgr.cp/pagebuilder.openDoc.asd/vts/pagebuilder","winOpenDoc","scrollbars=yes,resizable=yes,status=1", true);
	winOpenDoc.focus();
}

function pbSaveCurrentDocument(newdoc)
{	if (newdoc == null) newdoc = 0;
	var	winSaveDoc = window.open("/viewer/mgr.cp/pagebuilder.saveDoc.asd/vts/pagebuilder?newdoc=" + newdoc + "&fn=" + pbGetCurrentDocumentFilename(),"winSaveDoc","scrollbars=yes,resizable=yes,status=1", true);
	winSaveDoc.focus();
}

function pbInsertHTMLContent(obWindow, editor_name, contents)
{	if (editor_name == null) editor_name = 'pagebuilder';
	var oEditor = obWindow.FCKeditorAPI.GetInstance(editor_name);
	oEditor.InsertHtml(contents);
}

function methodX00043() 
{	var	winHelp = window.open("/viewer/mgr.cp/pagebuilder.aboutDialog.asd/vts/pagebuilder","winHelp","scrollbars=no,width=330,height=150,resizable=no");		}

function ASDWSA_PageBuilderPrettyPrint(st_code)
{	st_code_buffer = st_code;
	in_tab_count = in_previous_tabcount = 0;
	st_A = "";
	st_tag = st_previous_tag = "";
	st_tagSetA = "TABLE,TBODY,TR,TD,SCRIPT,OBJECT,EMBED,PARAM,FORM,SELECT,OPTION,OL,UL,";	// tags that must be open on a new line
	st_tagSetBA = "TABLE,TBODY,TR,FORM,SELECT,UL,OL,";								// tags that increment the indent count
	st_tagSetC = "TABLE,DIV,P,FORM,SELECT,UL,OL,LI,!--,";								// tags that must be closed on a new line
	st_tagSetD = "TABLE,TBODY,TR,TD,SCRIPT,OBJECT,EMBED,PARAM,FORM,SELECT,OPTION,LI,P,DIV,INPUT,";	// tags that must be indented
	st_tagSetE = "SCRIPT,!--,";																// tags that we will not pretty print
	st_tagSetF = "FORM,TD,DIV,P,";														// tags that can contain other tag blocks
	

	// find all the HTML tags in the code
	in_opening_pos = 0;
	// alert(st_code_buffer);
	while (in_opening_pos != -1)
	{	in_previous_tabcount = in_tab_count;
		// find the position of the key elements
		in_opening_pos = parseInt(st_code_buffer.search("<"));
		while (in_opening_pos != 0 && in_opening_pos != -1)
		{	// alert(st_code_buffer.substr(0, in_opening_pos));
			st_A += st_code_buffer.substr(0, in_opening_pos);
			// alert(st_A); 
			st_code_buffer = st_code_buffer.substr(in_opening_pos, st_code_buffer.length - in_opening_pos);
			// alert(st_code_buffer); // return "";
			in_opening_pos = parseInt(st_code_buffer.search("<"));
		}
		in_space_pos = parseInt(st_code_buffer.search(" "));
		in_closing_pos = parseInt(st_code_buffer.search(">"));	
		// alert(in_opening_pos + "," + in_space_pos + "," + in_closing_pos + "," + st_code_buffer.length); // return "";
		if (in_opening_pos == -1) 			// nothing found
		{	st_A += st_code_buffer; 		}
		else if (in_opening_pos >= 0)
		{	if (in_space_pos > in_closing_pos || in_space_pos < 0)
			{	st_tag = st_code_buffer.substr(in_opening_pos + 1, in_closing_pos - in_opening_pos - 1).toUpperCase();	}
			else
			{	st_tag = st_code_buffer.substr(in_opening_pos + 1, in_space_pos - in_opening_pos - 1).toUpperCase();	}
			st_tag_alone = st_tag;					// save the tag by itself without the delimiter
			st_full_tag = st_tag += ",";			// tag delimiter - required to match a tag
			if (st_full_tag == "!--,")
			alert("'" + st_full_tag +  "' TAB # P=" + in_previous_tabcount + " # C=" + in_tab_count); 	// return false;
			if (st_tag.charAt(0) == "/")			// this is a closing tag
			{	st_tag = st_tag.substr(1);			// remove the / from the tag name
				if (st_tagSetBA.search(st_tag) != -1) in_tab_count = in_tab_count - 1;
				st_A 	+= 	((st_tagSetA.search(st_tag) != -1)? "\n" : "") 
						+	((st_tagSetD.search(st_tag) != -1)? ASDWSA_PageBuilderPrettyPrint_Indent(in_tab_count) : "")  
						+	st_code_buffer.substr(in_opening_pos, in_closing_pos - in_opening_pos + 1)
						+ 	((st_tagSetC.search(st_tag) != -1)? "\n\n" : "");
			}else if (st_tagSetE.search(st_tag) != -1)
			{	// alert(st_tag_alone);
				if (st_tag_alone == "!--")	{	st_closing_tag = "-->"; 							}
				else 						{	st_closing_tag = "</" + st_tag_alone + ">"; 		}
				// alert(st_closing_tag);
				in_closing_pos = parseInt(st_code_buffer.search(st_closing_tag)) + st_closing_tag.length;	
				st_A 	+= 	((st_tagSetA.search(st_tag) != -1)? "\n" : "") 
						+	((st_tagSetD.search(st_tag) != -1)? ASDWSA_PageBuilderPrettyPrint_Indent(in_tab_count) : "")  
						+	st_code_buffer.substr(in_opening_pos, in_closing_pos - in_opening_pos + 1);
			}else									// this is an opening tag
			{	st_A 	+= 	((st_tagSetA.search(st_tag) != -1)? "\n" : "") 
						+	((st_tagSetD.search(st_tag) != -1)? ASDWSA_PageBuilderPrettyPrint_Indent(in_tab_count) : "")  
						+	st_code_buffer.substr(in_opening_pos, in_closing_pos - in_opening_pos + 1);
				if (st_tagSetBA.search(st_tag) != -1) in_tab_count = in_tab_count + 1;
			}
			in_tab_count = ((in_tab_count < 0)? 0 : in_tab_count);
			if (st_full_tag == ",") 
			{	alert("'" + st_full_tag +  "' TAB # P=" + in_previous_tabcount + " # C=" + in_tab_count); 	// return false;
				// alert(in_opening_pos + "," + in_space_pos + "," + in_closing_pos + "," + st_code_buffer.length); // return "";
				// alert(st_A);
				// alert(st_code_buffer);
			}
			st_code_buffer = st_code_buffer.substr(in_closing_pos + 1, st_code_buffer.length - in_closing_pos);
			st_previous_tag = st_tag;
		}
	}
	st_code_buffer = st_A;
	
	// insert the line returns on the <br> tags	
	var re = /((<br>)+)/ig;
	re.multiline = true;
	st_code_buffer = st_code_buffer.replace(re, "$1\n");
	
	return st_code_buffer;
}

function ASDWSA_PageBuilderPrettyPrint_Indent(in_indent_count)
{	st_pads_buffer = "";
	st_pads_tab = "     ";
	for (i = 0; i <= in_indent_count-1; i++)
	{	st_pads_buffer += st_pads_tab;		}
	return st_pads_buffer;
}

function pbGetCurrentEditorContents(obWindow, editor_name)
{	if (editor_name == null) editor_name = 'pagebuilder';
	var oEditor = obWindow.FCKeditorAPI.GetInstance(editor_name);
	return escape(oEditor.GetHTML());		
}

function pbSetCurrentEditorContents(obWindow, editor_name, contents)
{	if (editor_name == null) editor_name = 'pagebuilder';
	var oEditor = obWindow.FCKeditorAPI.GetInstance(editor_name);
	oEditor.SetHTML(contents);
}

function pbGetCurrentTextAreaEditorContents(obWindow)
{	ob_object = obWindow.document.getElementById('pagebuilder_textarea');
	return escape(ob_object.value);		
}

function pbInsertHyperlink() 
{	pageBuilder_linkwin = window.open("/viewer/mgr.cp/pagebuilder.insertHyperlink.asd/vts/pagebuilder" ,"pageBuilder_linkwin","scrollbars=auto,resizable=yes",true);
	pageBuilder_linkwin.focus();
}

function pbGetWebpageURL(url)
{	return url.replace("/documents/", "/viewer/");				}

function pbCreateHyperLink(href, target, name) 
{	var href = "<a href='" + href + "' target='" + target + "'>" + name + "</a>";
	return href;
}

function function_name(f)
{	var s = f.toString().match(/function (\w*)/)[1];
	if ((s == null) || (s.length == 0)) return "anonymous";
	else return s;
}

function stacktrace()
{	var s = "";
	
	for (var a  = arguments.caller; a != null; a = a.caller)
	{	s += function_name(a.callee) + "\n";
		if (a.caller == a) break;
	}
	return s;
}

function resize_browser_to_limits()
{	this.resizeTo(window.screen.availWidth, window.screen.availHeight);		}

function addslashes(st_string)
{	st_string = st_string.replace(/\"/g, "\\\"").replace(/\(/g, "\\\(").replace(/\)/g, "\\\)");			
	st_string = st_string.replace(/\[/g, "\\\[").replace(/\]/g, "\\\]");			
	return st_string;
}

function save_pagebuilder_data()
{	// saves the content of the editor to disk / repository for backup.
	// alert('Saving page builder content');
	if (location.search.replace(/\?/, "").search(/st_object_to_edit/i) != -1)		// this is an object text
	{	winPageBuilderSaver = window.open('/viewer/mgr.cp/pagebuilder.autosave.asd/vts/pagebuilder', 'winPageBuilderSaver', 'width=100,height=40,menubar=no,scrollbars=no,status=no,toolbar=no,location=no,resizable=yes'); window.focus()
		winPageBuilderSaver.document.file.value = location.search.replace(/\?/, "").slice(location.search.replace(/\?/, "").search(/\./i)+1);
		winPageBuilderSaver.document.data.value = (deactivate_pagebuilder_object_code(pbGetCurrentEditorContents()));
		winPageBuilderSaver.document.frmTrigger.submit();
	}else if (document.file_name.value.search(/pagebuilder.backup/i) == -1)		// no need to backup the backup files
	{	winPageBuilderSaver = window.open('/viewer/mgr.cp/pagebuilder.autosave.asd/vts/pagebuilder', 'winPageBuilderSaver', 'width=100,height=40,menubar=no,scrollbars=no,status=no,toolbar=no,location=no,resizable=yes'); window.focus()
		winPageBuilderSaver.document.file.value = document.file_name.value;
		winPageBuilderSaver.document.data.value = (deactivate_pagebuilder_object_code(pbGetCurrentEditorContents()));
		winPageBuilderSaver.document.frmTrigger.submit();
	}
}

function reactivate_pagebuilder_object_code(st_file_data)
{	st_working_copy = st_file_data;
	var ar_pagebuilder_objects = new Array();
	var ob_pattern = new RegExp("SKIP");
	var ar_tags = [	"\\\[RECORD-START\\\]", "\\\[RECORD-END\\\]", "(\\\[GUESTBOOK:)(.*?)(\\\])",
					"(\\\[MEMBER PROFILE:)(.*?)(\\\])", "(\\\[CONFIGURATION:)(.*?)(\\\])", 
					"(\\\[TEXT:)(.*?)(\\\])", "(\\\[LINK:)(.*?)(\\\])", "(\\\[NEWSLETTER:)(.*?)(\\\])"
				];
	// find all the object functions, strip them away
	for (in_A = 1; in_A <= ar_tags.length; in_A++)
	{	ob_pattern.compile(ar_tags[in_A-1], "g");
		// alert(ob_pattern);
		while (ob_pattern.test(st_working_copy) == true)
		{	// alert(st_working_copy.replace(ob_pattern, ""));
			st_working_copy = st_working_copy.replace(ob_pattern, "");
		}
	}
	st_file_data = st_working_copy;									// save a copy of the clean data
	ob_pattern.compile("(<INPUT)(.*?)(name='?\"?PageBuilderObject'?\"?)(.*?)(>|\/>)", "i");
	while (ob_pattern.test(st_working_copy) == true)
	{	ar_A = st_working_copy.match(ob_pattern);
		index = ar_pagebuilder_objects.length;
		// make sure this object is not already in the array
		if (index > 0)
		{	for (bo_already_in_array = false, in_A = 1; in_A <= index; in_A++)
			{	if (ar_pagebuilder_objects[in_A-1] == ar_A[0]) bo_already_in_array = true;		}
			if (bo_already_in_array == true) 
			{	st_working_copy = st_working_copy.replace(ar_A[0], "");
				continue;											// skip this object
			}
		}
		ar_pagebuilder_objects[index] = ar_A[0]; 
		st_working_copy = st_working_copy.replace(ar_pagebuilder_objects[index], "");
	}
	st_working_copy = st_file_data;									// get a working copy of the data
	for (in_A = 1; in_A <= ar_pagebuilder_objects.length; in_A++)
	{	ob_pattern.compile(addslashes("<!--" + ar_pagebuilder_objects[in_A-1] + "-->"), "g");
		st_working_copy = st_working_copy.replace(ob_pattern, ar_pagebuilder_objects[in_A-1]);
	}
	return st_working_copy;
}

function deactivate_pagebuilder_object_code(st_file_data)
{	// scan the whole text for PageBuilderObject tags, process each tag.
	st_working_copy = st_file_data;									// get a working copy of the data
	var ar_pagebuilder_objects = new Array();
	var ob_pagebuilder_pattern = new RegExp("(<INPUT)(.*?)(name='?\"?PageBuilderObject'?\"?)(.*?)(>|\/>)", "i"); 	// alert(ob_pagebuilder_pattern);
	while (ob_pagebuilder_pattern.test(st_working_copy) == true)
	{	ar_A = st_working_copy.match(ob_pagebuilder_pattern);
		index = ar_pagebuilder_objects.length;
		// make sure this object is not already in the array
		if (index > 0)
		{	for (bo_already_in_array = false, in_A = 1; in_A <= index; in_A++)
			{	if (ar_pagebuilder_objects[in_A-1] == ar_A[0]) bo_already_in_array = true;		}
			if (bo_already_in_array == true) 
			{	st_working_copy = st_working_copy.replace(ar_A[0], "");
				continue;											// skip this object
			}
		}
		ar_pagebuilder_objects[index] = ar_A[0]; 	// alert(ar_A[0]);
		st_working_copy = st_working_copy.replace(ar_pagebuilder_objects[index], "");
	}
	// next process each object, and replace code with appropriate PHP equivalent
	st_working_copy = st_file_data;									// get a working copy of the data
//	alert(ar_pagebuilder_objects.length);
	for (in_A = 1; in_A <= ar_pagebuilder_objects.length; in_A++)
	{	// now we create the replacement code; first determine type of object
		st_object_code = ar_pagebuilder_objects[in_A-1];
		ob_pagebuilder_pattern.compile(addslashes(st_object_code), "g");
		if (/(pbotype='?"?record-start'?"?)/i.test(st_object_code) == true)
		{	st_repacement_code = "<!--" + st_object_code + "-->" + "[RECORD-START]";
			st_working_copy = st_working_copy.replace(ob_pagebuilder_pattern, st_repacement_code);
		}else if (/(pbotype='?"?record-end'?"?)/i.test(st_object_code) == true)
		{	st_repacement_code = "<!--" + st_object_code + "-->" + "[RECORD-END]";
			st_working_copy = st_working_copy.replace(ob_pagebuilder_pattern, st_repacement_code);
		}else if (/pbotype='?"?form-object:(.*)('?"?)/i.test(st_object_code) == true)
		{	ar_A = st_object_code.match(/pbohashkey='?"?(.*[^'"])'?"?/i);
			// alert(ar_A[1]);
			st_repacement_code = "<!--" + st_object_code + "-->" + "<? echo @publish_form('" + ar_A[1]() + "'); ?>";
			st_working_copy = st_working_copy.replace(ob_pagebuilder_pattern, st_repacement_code);
		}else
		{	ar_A = st_object_code.match(/pbotype='?"?([\w\:\-\ ]*)'?"?/i);
			// alert(ar_A[1]); 
			st_repacement_code = "<!--" + st_object_code + "-->" + "[" + ar_A[1].toUpperCase() + "]";
			st_working_copy = st_working_copy.replace(ob_pagebuilder_pattern, st_repacement_code);
		}

	}
	return st_working_copy;
}
// PAGEBUILDER INTEGRATION ENDS


function doRedirectMenu(menu) 
{	window.location = menu.options[menu.selectedIndex].value;
}


// TREE LIB INTEGRATION
var _id = 0, _pid = 0, _lid = 0, _pLayer;
var _mLists = new Array();
var image_plus = "/images/admin/plus1.gif";
var image_minus = "/images/admin/minus1.gif";

document.lists = _mLists;
var isNav4, isIE4;
if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
  isNav4 = (navigator.appName == "Netscape") ? true : false;
  isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
}
function expandG(nd)
{	expand(nd.id);
	
	for (i=1;i<_mLists.length;i++)
	{	_mLists[i].visible = false;
	}
}

function displayListNone(list, str, bgColor, layer) 
{	expandG(list.id);
	addList(list, str, bgColor, layer);
}

function List(visible, width, height, bgColor) {
  this.setIndent = setIndent;
  this.addItem = addItem;
  this.addList = addList;
  this.displayListNone = displayListNone;
  this.build = build;
  this.rebuild = rebuild;
  this.setFont = _listSetFont;
  this._writeList = _writeList;
  this._showList = _showList;
  this._updateList = _updateList;
  this._updateParent = _updateParent;
  this.onexpand = null; 
  this.postexpand = null;
  this.lists = new Array(); // sublists
  this.items = new Array(); // layers
  this.types = new Array(); // type
  this.strs = new Array();  // content
  this.x = 0;
  this.y = 0;
  this.visible = visible;
  this.id = _id;
  this.i = 18;
  this.space = true;
  this.pid = 0;
  this.fontIntro = false;
  this.fontOutro = false;
  this.width = width || 350;
  this.height = height || 22;
  this.parLayer = false;
  this.built = false;
  this.shown = false;
  this.needsUpdate = false;
  this.needsRewrite = false;
  this.parent = null;
  this.l = 0;
  if(bgColor) this.bgColor = bgColor;
  else this.bgColor = null;
  _mLists[_id++] = this;
}
function _listSetFont(i,j) {
  this.fontIntro = i;
  this.fontOutro = j;
}
function setIndent(indent) { this.i = indent; if(this.i < 0) { this.i = 0; this.space = false; } }
function setClip(layer, l, r, t, b) {
  if(isNav4) {
    layer.clip.left = l; layer.clip.right = r;
    layer.clip.top = t;  layer.clip.bottom = b;
  } else {
    layer.style.pixelWidth = r-l;
    layer.style.pixelHeight = b-t;
    layer.style.clip = "rect("+t+","+r+","+b+","+l+")";
  }
}
function _writeList() {
  self.status = "List: Writing list...";
  var layer, str, clip;
  for(var i = 0; i < this.types.length; i++) { 
    layer = this.items[i];
    if(isNav4) layer.visibility = "hidden";
    else layer.style.visibility = "hidden";
    str = "";
    if(isNav4) layer.document.open();
    str += "<TABLE WIDTH="+this.width+" BORDER=0 CELLPADDING=0 CELLSPACING=0><TR>";
    if(this.types[i] == "list") {
      str += "<TD WIDTH=15><A TARGET='_self' HREF=\"javascript:expand("+this.lists[i].id+");\"><IMG BORDER=0 SRC=\"../../images/minus1.gif\" NAME=\"_img"+this.lists[i].id+"\"></A></TD>";
      _pid++;
    } else if(this.space)
      str += "<TD WIDTH=15 NOWRAP>&nbsp;</TD>";
    if(this.l>0 && this.i>0) str += "<TD WIDTH="+this.l*this.i+" NOWRAP>&nbsp;</TD>";
    str += "<TD HEIGHT="+(this.height-3)+" WIDTH="+(this.width-15-this.l*this.i)+" VALIGN=MIDDLE ALIGN=LEFT>";
    if(this.fontIntro) str += this.fontIntro;
    str += this.strs[i];
    if(this.fontOutro) str += this.fontOutro;
    str += "</TD></TABLE>";
    if(isNav4) {
      layer.document.writeln(str);
      layer.document.close();
    } else layer.innerHTML = str;
    if(this.types[i] == "list" && this.lists[i].visible)
      this.lists[i]._writeList();
  }
  this.built = true;
  this.needsRewrite = false;
  self.status = '';
}
function _showList() {
  var layer;
  for(var i = 0; i < this.types.length; i++) { 
    layer = this.items[i];
    setClip(layer, 0, this.width, 0, this.height-1);
    var bg = layer.oBgColor || this.bgColor;
    if(isIE4) {
      if((bg == null) || (bg == "null")) bg = "";
      layer.style.backgroundColor = bg;
    } else layer.document.bgColor = bg;
    if(this.types[i] == "list" && this.lists[i].visible)
      this.lists[i]._showList();
  }
  this.shown = true;
  this.needsUpdate = false;
}
function _updateList(pVis, x, y) {
  var currTop = y, layer;
  for(var i = 0; i < this.types.length; i++) { 
    layer = this.items[i];
    if(this.visible && pVis) {
      if(isNav4) {
        layer.visibility = "visible";
        layer.top = currTop;
        layer.left = x;
      } else {
        layer.style.visibility = "visible";
        layer.style.pixelTop = currTop;
        layer.style.pixelLeft = x;
      }
      currTop += this.height;
    } else {
      if(isNav4) layer.visibility = "hidden";
      else layer.style.visibility = "hidden";
    }
    if(this.types[i] == "list") {
      if(this.lists[i].visible) {
        if(!this.lists[i].built || this.lists[i].needsRewrite) this.lists[i]._writeList();
        if(!this.lists[i].shown || this.lists[i].needsUpdate) this.lists[i]._showList();
        if(isNav4) layer.document.images[0].src = "http://sc01.ajiboye.com/images/admin/minus1.gif";
        else eval('document.images._img'+this.lists[i].id+'.src = image_minus');
      } else {
        if(isNav4) layer.document.images[0].src = "http://sc01.ajiboye.com/images/admin/plus1.gif";
        else eval('document.images._img'+this.lists[i].id+'.src = image_plus');
      }
      if(this.lists[i].built)
        currTop = this.lists[i]._updateList(this.visible && pVis, x, currTop);
    }
  }
  return currTop;
}
function _updateParent(pid, l) {
  var layer;
  if(!l) l = 0;
  this.pid = pid;
  this.l = l;
  for(var i = 0; i < this.types.length; i++)
    if(this.types[i] == "list")
      this.lists[i]._updateParent(pid, l+1);
}
function expand(i) {
  _mLists[i].visible = !_mLists[i].visible;
  if(_mLists[i].onexpand != null) _mLists[i].onexpand(_mLists[i].id);
  _mLists[_mLists[i].pid].rebuild();
  if(_mLists[i].postexpand != null) _mLists[i].postexpand(_mLists[i].id);
}
function build(x, y) {
  this._updateParent(this.id);
  this._writeList();
  this._showList();
  this._updateList(true, x, y);
  this.x = x; this.y = y;
}
function rebuild() { this._updateList(true, this.x, this.y); }
function addItem(str, bgColor, layer) {
  var testLayer = false;
  if(!document.all) document.all = document.layers;
  if(!layer) {
    if(isIE4 || !this.parLayer) testLayer = eval('document.all.lItem'+_lid);
    else {
      _pLayer = this.parLayer;
      testLayer = eval('_pLayer.document.layers.lItem'+_lid);
    }
    if(testLayer) layer = testLayer;
    else {
      if(isNav4) {
        if(this.parLayer) layer = new Layer(this.width, this.parLayer);
        else layer = new Layer(this.width);
      } else return;
    }
  }
  if(bgColor) layer.oBgColor = bgColor;
  this.items[this.items.length] = layer;
  this.types[this.types.length] = "item";
  this.strs[this.strs.length] = str;
  _lid++;
}
function addList(list, str, bgColor, layer) {
  var testLayer = false;
  if(!document.all) document.all = document.layers;
  if(!layer) {
    if(isIE4 || !this.parLayer) testLayer = eval('document.all.lItem'+_lid);
    else {
      _pLayer = this.parLayer;
      testLayer = eval('_pLayer.document.layers.lItem'+_lid);
    }
    if(testLayer) layer = testLayer;
    else {
      if(isNav4) {
        if(this.parLayer) layer = new Layer(this.width, this.parLayer);
        else layer = new Layer(this.width);
      } else return;
    }
  }
  if(bgColor) layer.oBgColor = bgColor;
  this.lists[this.items.length] = list;
  this.items[this.items.length] = layer;
  this.types[this.types.length] = "list";
  this.strs[this.strs.length] = str;
  list.parent = this;
  _lid++;
}

if(!window.saveInnerWidth) {
  window.onresize = resize;
  window.saveInnerWidth = window.innerWidth;
  window.saveInnerHeight = window.innerHeight;
}

function resize() {
    if (saveInnerWidth < window.innerWidth || 
        saveInnerWidth > window.innerWidth || 
        saveInnerHeight > window.innerHeight || 
        saveInnerHeight < window.innerHeight ) 
    {
        window.history.go(0);
    }
}

function stop_website_music()
{
	if ( navigator.appName == "Netscape")
	{	parent.frames.frame1.winplayer.Stop(); 
	} else 
	{	parent.frmMusicPlayer.winplayer.Stop(); }
}

jquery_api = $;

function selectStoreDescriptionTab(in_tab_number)
{	if (in_tab_number != null) 
	{	descriptionTabs.selectTab(in_tab_number-1); location.href = '#FullProductDesccriptionTabsTop';			}
}