
var oMenu = false;

String.prototype.replaceAll = function(s,r) // extends String object to allow complete replace (rather than first found replace)
	{
	var changed = false; var v1, v2; v1 = this;
	for (var i=0; i<this.length; i++)
		{ do { v2 = v1.replace(s,r); changed = (v1!=v2); v1 = v2; }
			while (changed); };
	return(v2);
	}

function init()
	{
	//alert("offpar of page title = "+par.id+" ("+par.tagName+")");
	if((YAHOO.widget)&&(YAHOO.widget.Logger)) { YAHOO.widget.Logger.enableBrowserConsole(); }
	doRes();
	YAHOO.util.Event.addListener(window,"resize",doRes);
	setInterval(doRes,20);
	if(typeof(pageInit)=="function") pageInit(page);
	if(typeof(userBoxInit)=="function") userBoxInit();
	if(typeof(collAllInit)=="function") collAllInit();
	if(page=="Go") learnInit();
	};

function learnInit()
	{
	var inps = YAHOO.util.Dom.getElementsByClassName("learnLink");
	for(var i=0; i<inps.length; i++)
		{
		//YAHOO.util.Event.addListener(inps[i], "click", obPlay);
		}
	}
	
function obPlay(loid)
	{
	var multi = true;
	var h = 500;
	var w = 870;//was 770

	var diff = 4;
	h = 40 + (5*diff) + h;
	if (multi>1) w = w + 240 + (diff);
	var uto = "preview.asp?loid="+loid;
	//alert("going to "+uto);
	var prevWin = window.open(uto, 'prevWin', 'width='+w+',height='+h+',resizable=yes,status=yes,menubar=yes');
	if(prevWin)
		{		
		prevWin.focus();
	}
	//YAHOO.util.Event.preventDefault(e);
	return(false);
	}

function doRes()
	{
	var bg = document.getElementById("bg");
	var col = document.getElementById("colBlock");
	if((!bg)||(!col)) return(false);
	//bg.style.height = (YAHOO.util.Dom.getViewportHeight()-(bg.offsetTop+col.offsetHeight))+"px";
	bg.style.top = (col.offsetHeight+col.offsetTop)+"px";
	}

function doFlash()
	{
	var so = new SWFObject("/downloads/paving/Intro.swf", "intro", "320", "256", "6", "#000000");
	so.write("flashcontent");
	};

function node(txt,par,expand)
	{
	var newN = new YAHOO.widget.TextNode(txt,par,(expand==true));
	newN.hasIcon = true;
	return(newN);
	};
	
function auth()
	{
	var theForm = document.getElementById("loginForm");
	if (theForm.elements['XtUserID'].value=='')
		{alert('Please enter your user ID');
		theForm.elements['XtUserID'].focus();
		return (false);
		}
	if (theForm.elements['XtPassword'].value=='')
		{alert('Please enter your password');
		theForm.elements['XtPassword'].focus();
		return (false);
		}
	if (window.screen)
		{
		theForm.elements['winheight'].value= window.screen.height;
		theForm.elements['winwidth'].value= window.screen.width;
		}
		else
			{
			if (window.innerHeight)
				{
				theForm.elements['winheight'].value= window.innerHeight;
				theForm.elements['winwidth'].value= window.innerWidth;
				}
			}
	if (navigator.userLanguage)
		theForm.elements['userlang'].value= navigator.userLanguage;
	if (navigator.language)
		theForm.elements['userlang'].value= navigator.language;
	
	return (true);
	}

var oAnim;

var popUpWin=0;
function popUp(URLStr)
	{
	if(popUpWin)
		{
		if(!popUpWin.closed) popUpWin.close();
		}
	var aLeft = 100;
	var aTop = 100; 
	var aWidth = 640;
 	var aHeight = 493;
	popUpWin = open(URLStr, 'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,width='+aWidth+',height='+aHeight+',left='+aLeft+', top='+aTop+',screenX='+aLeft+',screenY='+aTop+'');
	};

function popBlank(URLStr)
	{
	if(popUpWin)
		{
		if(!popUpWin.closed) popUpWin.close();
		}
	var aLeft = 0;
	var aTop = 0; 
	var aWidth = 800;
 	var aHeight = 600;
	popUpWin = open(URLStr, 'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+aWidth+',height='+aHeight+',left='+aLeft+', top='+aTop+',screenX='+aLeft+',screenY='+aTop+'');
	};
	
function showDoc(URLStr)
	{
	if(popUpWin)
		{
		if(!popUpWin.closed) popUpWin.close();
		}
	var aLeft = 50;
	var aTop = 50; 
	var aWidth = 750;
 	var aHeight = 550;
	popUpWin = open("/inserts/"+URLStr+".asp", 'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width='+aWidth+',height='+aHeight+',left='+aLeft+', top='+aTop+',screenX='+aLeft+',screenY='+aTop+'');
	};

var specials = new Array();

	
/*
  YUIDomCollapse by Christian Heilmann
  Version 1.0 / May 2007
  License: http://creativecommons.org/licenses/by/3.0/
  Homepage: http://onlinetools.org/tools/yuidomcollapse/
*/
// YUI Namespace
YAHOO.namespace('otorg');
YAHOO.otorg.DomCollapse = {
  init:function()
  	{
	// shortcut for CSS properties
	var css = YAHOO.otorg.DomCollapse.css;
	if(typeof(css) !== 'undefined')
		{
		// get possible bookmark
		var bookmark = window.location.hash.replace('#','');
		// get all elements with the correct class
		var elms = YAHOO.util.Dom.getElementsByClassName(css.triggerClass);
		// loop over all the elements
		for(var i=0,j=elms.length;i<j;i++)
			{
			// get the ID from the href attribute
			var newID = elms[i].href.replace(/.*#/,'');
			// grab the connected element, or the next sibling in case
			// it doesn't exist
			var t = document.getElementById(newID) || YAHOO.otorg.DomCollapse.getNext(elms[i]);
			if(t !== null)
				{
				// re-set the href attribute to this element
				if(t.id !== newID)
					{
					newID = t.id;
					elms[i].setAttribute('href','#'+newID);
					};
				// if the ID is not the bookmark, hide the element
				// and add the parent class
				if(newID !== bookmark)
					{
					YAHOO.util.Dom.addClass(elms[i],css.parentClass);
					YAHOO.util.Dom.addClass(t,css.hideClass);
					// otherwise add the open class to the trigger
					} else {
					YAHOO.util.Dom.addClass(elms[i],css.openClass);
					// also check grandparent and make sure its open
					if(page&&(page=="FAQ")&&(YAHOO.util.Dom.hasClass(elms[i].parentNode,"faqQ")))
						{
						var trig = document.getElementById("Trig"+elms[i].parentNode.parentNode.id);
						if(trig) YAHOO.util.Dom.replaceClass(trig,css.parentClass,css.openClass);
						var trig = document.getElementById(elms[i].parentNode.parentNode.id);
						if(trig) YAHOO.util.Dom.removeClass(trig,css.hideClass);
						};
					};
				// add a click handler to the link pointing to toggle
				YAHOO.util.Event.on(elms[i], 'click', YAHOO.otorg.DomCollapse.toggle);
				};
			};
		};
	},
  // tool method to get the next sibling that is not a text node
  getNext:function(o){
    var t = o.nextSibling;
    if(t){
      while(t.nodeType !== 1 && t.nextSibling){
        t = t.nextSibling;
      }
    }
    return t;  
  },
  // method to toggle the showing and hiding of the next element
  toggle:function(e){
    // shortcut for CSS object
    var css = YAHOO.otorg.DomCollapse.css;
    // if the element has the trigger class it is a link, otherwise 
    // it is a generated link by init()
    var parent = YAHOO.util.Dom.hasClass(this,css.triggerClass) ? this : this.parentNode;
    // grab the ID the link points to from the href attribute and get the element
    var id = this.href.replace(/.*#/,'');
    var t = document.getElementById(id);
    if(t !== undefined){
      // if the element is hidden (has the hide class) remove the hide 
      // class and swap parent for open and vice versa
      if(YAHOO.util.Dom.hasClass(t,css.hideClass)){
        YAHOO.util.Dom.removeClass(t,css.hideClass);
        YAHOO.util.Dom.replaceClass(parent,css.parentClass,css.openClass);
      } else {
        YAHOO.util.Dom.addClass(t,css.hideClass);
        YAHOO.util.Dom.replaceClass(parent,css.openClass,css.parentClass);
        // don't follow the link when you hide the element
        YAHOO.util.Event.preventDefault(e);
      };
    };
  }    
};
// If the DOM is ready, go for it.
YAHOO.util.Event.onDOMReady(YAHOO.otorg.DomCollapse.init);

/*
  YUIDomCollapse fancy add-on by Christian Heilmann
  Version 1.0 / May 2007
  License: http://creativecommons.org/licenses/by/3.0/
  Homepage: http://onlinetools.org/tools/yuidomcollapse/
*/
// make sure the main script is available
if(YAHOO && YAHOO.otorg && YAHOO.otorg.DomCollapse && YAHOO.util && YAHOO.util.Anim)
	{
	// override toggle()
	YAHOO.otorg.DomCollapse.toggle = function(e)
		{
		// shortcut to CSS object
		var css = YAHOO.otorg.DomCollapse.css;
		// get the trigger element, which is the one clicked on if it has
		// the trigger class
		var parent = YAHOO.util.Dom.hasClass(this,css.triggerClass) ? this : this.parentNode;
		// retrieve the ID from the href attribute and make sure the element 
		// exists
		var id = this.href.replace(/.*#/,'');
		var t = document.getElementById(id);
		if(t !== undefined)
			{
			// get overflow style - elements need to have overflow hidden 
			// to animate smoothly
			var oldover = YAHOO.util.Dom.getStyle(t,'overflow');
			// set overflow to hidden
			YAHOO.util.Dom.setStyle(t,'overflow','hidden');
			// get the height and compare it to the offsetHeight, thus 
			// getting the real height + padding
			var height = YAHOO.util.Dom.getStyle(t,'height');
			if(height==='auto')
				{
				curHeight = t.offsetHeight;
				} else {          
				curHeight = Math.max(parseInt(height),t.offsetHeight);
				}
			var x = parseInt(curHeight);
			// if the element is currently hidden
			if(YAHOO.util.Dom.hasClass(t,css.hideClass))
				{
				// set its height and opacity to 0 and add the height class
				YAHOO.util.Dom.setStyle(t,'height',0+'px');
				YAHOO.util.Dom.removeClass(t,css.hideClass);
				YAHOO.util.Dom.setStyle(t,'opacity',0);
				// prepare the animation animate the element
				var a = new YAHOO.util.Anim(t, { opacity: {from:0,to: 1},height:{from:0,to:x} },.4,YAHOO.util.Easing.easeBoth);
				// re-set the overflow and set the appropriate class to the 
				// trigger element when the animation has finished
				a.onComplete.subscribe(function()
					{
					YAHOO.util.Dom.setStyle(t,'overflow',oldover);
					YAHOO.util.Dom.setStyle(t,'height','auto');
					YAHOO.util.Dom.replaceClass(parent,css.parentClass,css.openClass);
					});
			// animate the element
			a.animate();
			// if the element is currently visible
			} else {
			// prepare and start the animation
			var a = new YAHOO.util.Anim(t, { opacity: {from:1,to: 0} ,height:{from:x,to:0} },.4,YAHOO.util.Easing.easeBoth);
			a.animate();
			// when the animation is done, hide it with the right class, 
			// re-set its styles and replace the open with a parent class
			a.onComplete.subscribe(function()
				{
				YAHOO.util.Dom.addClass(t,css.hideClass);
				YAHOO.util.Dom.setStyle(t,'height',x+'px');
				YAHOO.util.Dom.setStyle(t,'opacity',1);
				YAHOO.util.Dom.setStyle(t,'overflow',oldover);
				YAHOO.util.Dom.replaceClass(parent,css.openClass,css.parentClass);
				});
			};
		};
		YAHOO.util.Event.preventDefault(e);
		};
	};
	
	if(YAHOO && YAHOO.otorg && YAHOO.otorg.DomCollapse)
		{
		YAHOO.otorg.DomCollapse.css = {
		triggerClass:'collTrigger',
		hideClass:'collHide',
		parentClass:'collParent',
		openClass:'collOpen'
		}
	};

function doHelp()
	{
	
	}