var loadedobjects=""
var rootdomain="http://"+window.location.hostName
var message="You may not right mouse click this page.";
var sURL = unescape(window.location.pathname);
var uniquepageid=window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, "") //get current page path and name, used to uniquely identify this page for persistence feature

function contentone(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}
function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}
function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

if (navigator.appName == 'Microsoft Internet Explorer'){
function NOclickIE(e) {
if (event.button == 2 || event.button == 3) {
alert(message);
return false;
}
return true;
}
document.onmousedown=NOclickIE;
document.onmouseup=NOclickIE;
window.onmousedown=NOclickIE;
window.onmouseup=NOclickIE;
}
else {
function NOclickNN(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}}}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=NOclickNN; }
document.oncontextmenu=new Function("alert(message);return false")
}
var rotate_delay = 3000; // delay in milliseconds (5000 = 5 secs)
current = 0;

function next() {
if (document.slideform.slide[current+1]) {
document.images.show.src = document.slideform.slide[current+1].value;
document.slideform.slide.selectedIndex = ++current;
ShowNumber();
if (current==0) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==1) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==2) {
	collapsesev1.slidedown();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==3) {
	collapsesev1.slidedown();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==13) {
	collapsesev1.slideup();
	collapsesev2.slidedown();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==14) {
	collapsesev1.slideup();
	collapsesev2.slidedown();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==15) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slidedown();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==16) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slidedown();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==25) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slidedown();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==26) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slidedown();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==31) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slidedown();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==32) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slidedown();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==33) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slidedown();
	collapsesev7.slideup();
}
if (current==34) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slidedown();
	collapsesev7.slideup();
}
if (current==35) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slidedown();
}
}
else first();
}
function gal1() {
current = 0;
document.images.show.src = document.slideform.slide[0].value;
document.slideform.slide.selectedIndex = 0;
ShowNumber();
   }
function gal2() {
current = 1;
document.images.show.src = document.slideform.slide[1].value;
document.slideform.slide.selectedIndex = 1;
ShowNumber();
  }
function gal3() {
current = 2;
document.images.show.src = document.slideform.slide[2].value;
document.slideform.slide.selectedIndex = 2;
ShowNumber();
   }
function gal4() {
current = 3;
document.images.show.src = document.slideform.slide[3].value;
document.slideform.slide.selectedIndex = 3;
ShowNumber();
   }
function gal5() {
current = 4;
document.images.show.src = document.slideform.slide[4].value;
document.slideform.slide.selectedIndex = 4;
ShowNumber();
   }
function gal6() {
current = 5;
document.images.show.src = document.slideform.slide[5].value;
document.slideform.slide.selectedIndex = 5;
ShowNumber();
   }
function gal7() {
current = 6;
document.images.show.src = document.slideform.slide[6].value;
document.slideform.slide.selectedIndex = 6;
ShowNumber();
   }
function gal8() {
current = 7;
document.images.show.src = document.slideform.slide[7].value;
document.slideform.slide.selectedIndex = 7;
ShowNumber();
   }
function gal9() {
current = 8;
document.images.show.src = document.slideform.slide[8].value;
document.slideform.slide.selectedIndex = 8;
ShowNumber();
   }
function gal10() {
current = 9;
document.images.show.src = document.slideform.slide[9].value;
document.slideform.slide.selectedIndex = 9;
ShowNumber();
   }
function gal11() {
current = 10;
document.images.show.src = document.slideform.slide[10].value;
document.slideform.slide.selectedIndex = 10;
ShowNumber();
   }
function gal12() {
current = 11;
document.images.show.src = document.slideform.slide[11].value;
document.slideform.slide.selectedIndex = 11;
ShowNumber();
   }
   function gal13() {
current = 12;
document.images.show.src = document.slideform.slide[12].value;
document.slideform.slide.selectedIndex = 12;
ShowNumber();
   }
   function gal14() {
current = 13;
document.images.show.src = document.slideform.slide[13].value;
document.slideform.slide.selectedIndex = 13;
ShowNumber();
   }
   function gal15() {
current = 14;
document.images.show.src = document.slideform.slide[14].value;
document.slideform.slide.selectedIndex = 14;
ShowNumber();
   }
   function gal16() {
current = 15;
document.images.show.src = document.slideform.slide[15].value;
document.slideform.slide.selectedIndex = 15;
ShowNumber();
   }
   function gal17() {
current = 16;
document.images.show.src = document.slideform.slide[16].value;
document.slideform.slide.selectedIndex = 16;
ShowNumber();
   }
   function gal18() {
current = 17;
document.images.show.src = document.slideform.slide[17].value;
document.slideform.slide.selectedIndex = 17;
ShowNumber();
   }
   function gal19() {
current = 18;
document.images.show.src = document.slideform.slide[18].value;
document.slideform.slide.selectedIndex = 18;
ShowNumber();
   }
   function gal20() {
current = 19;
document.images.show.src = document.slideform.slide[19].value;
document.slideform.slide.selectedIndex = 19;
ShowNumber();
   }
   function gal21() {
current = 20;
document.images.show.src = document.slideform.slide[20].value;
document.slideform.slide.selectedIndex = 20;
ShowNumber();
   }
   function gal22() {
current = 21;
document.images.show.src = document.slideform.slide[21].value;
document.slideform.slide.selectedIndex = 21;
ShowNumber();
   }
   function gal23() {
current = 22;
document.images.show.src = document.slideform.slide[22].value;
document.slideform.slide.selectedIndex = 22;
ShowNumber();
   }
   function gal24() {
current = 23;
document.images.show.src = document.slideform.slide[23].value;
document.slideform.slide.selectedIndex = 23;
ShowNumber();
   }
   function gal25() {
current = 24;
document.images.show.src = document.slideform.slide[24].value;
document.slideform.slide.selectedIndex = 24;
ShowNumber();
   }
   function gal26() {
current = 25;
document.images.show.src = document.slideform.slide[25].value;
document.slideform.slide.selectedIndex = 25;
ShowNumber();
   }
   function gal27() {
current = 26;
document.images.show.src = document.slideform.slide[26].value;
document.slideform.slide.selectedIndex = 26;
ShowNumber();
   }
   function gal28() {
current = 27;
document.images.show.src = document.slideform.slide[27].value;
document.slideform.slide.selectedIndex = 27;
ShowNumber();
   }
   function gal29() {
current = 28;
document.images.show.src = document.slideform.slide[28].value;
document.slideform.slide.selectedIndex = 28;
ShowNumber();
   }
   function gal30() {
current = 29;
document.images.show.src = document.slideform.slide[29].value;
document.slideform.slide.selectedIndex = 29;
ShowNumber();
   }
   function gal31() {
current = 30;
document.images.show.src = document.slideform.slide[30].value;
document.slideform.slide.selectedIndex = 30;
ShowNumber();
   }
   function gal32() {
current = 31;
document.images.show.src = document.slideform.slide[31].value;
document.slideform.slide.selectedIndex = 31;
ShowNumber();
   }
   function gal33() {
current = 32;
document.images.show.src = document.slideform.slide[32].value;
document.slideform.slide.selectedIndex = 32;
ShowNumber();
   }
   function gal34() {
current = 33;
document.images.show.src = document.slideform.slide[33].value;
document.slideform.slide.selectedIndex = 33;
ShowNumber();
   }
   function gal35() {
current = 34;
document.images.show.src = document.slideform.slide[34].value;
document.slideform.slide.selectedIndex = 34;
ShowNumber();
   }
   function gal36() {
current = 35;
document.images.show.src = document.slideform.slide[35].value;
document.slideform.slide.selectedIndex = 35;
ShowNumber();
   }
   function gal37() {
current = 36;
document.images.show.src = document.slideform.slide[36].value;
document.slideform.slide.selectedIndex = 36;
ShowNumber();
   }
   function gal38() {
current = 37;
document.images.show.src = document.slideform.slide[37].value;
document.slideform.slide.selectedIndex = 37;
ShowNumber();
   }
   function gal39() {
current = 38;
document.images.show.src = document.slideform.slide[38].value;
document.slideform.slide.selectedIndex = 38;
ShowNumber();
   }
   
function previous() {
if (current-1 >= 0) {
document.images.show.src = document.slideform.slide[current-1].value;
document.slideform.slide.selectedIndex = --current;
ShowNumber();
   }
else last();
}
function first() {
current = 0;
document.images.show.src = document.slideform.slide[0].value;
document.slideform.slide.selectedIndex = 0;
ShowNumber();
}
function last() {
current = document.slideform.slide.length-1;
document.images.show.src = document.slideform.slide[current].value;
document.slideform.slide.selectedIndex = current;
ShowNumber();
}
function ap(text) {
document.slideform.slidebutton.value = (text == "Stop") ? "AutoPlay" : "Stop";
rotate();
}
function change() {
current = document.slideform.slide.selectedIndex;
document.images.show.src = document.slideform.slide[current].value;
}
function rotate() {
if (document.slideform.slidebutton.value == "Stop") {
current = (current == document.slideform.slide.length-1) ? 0 : current+1;
document.images.show.src = document.slideform.slide[current].value;
document.slideform.slide.selectedIndex = current;
window.setTimeout("rotate()", rotate_delay);
ShowNumber();
if (current==0) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==1) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==2) {
	collapsesev1.slidedown();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==3) {
	collapsesev1.slidedown();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==13) {
	collapsesev1.slideup();
	collapsesev2.slidedown();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==14) {
	collapsesev1.slideup();
	collapsesev2.slidedown();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==15) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slidedown();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==16) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slidedown();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==25) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slidedown();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==26) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slidedown();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==31) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slidedown();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==32) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slidedown();
	collapsesev6.slideup();
	collapsesev7.slideup();
}
if (current==33) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slidedown();
	collapsesev7.slideup();
}
if (current==34) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slidedown();
	collapsesev7.slideup();
}
if (current==35) {
	collapsesev1.slideup();
	collapsesev2.slideup();
	collapsesev3.slideup();
	collapsesev4.slideup();
	collapsesev5.slideup();
	collapsesev6.slideup();
	collapsesev7.slidedown();
}
   }
}
function refresh()
{
    //  This version does NOT cause an entry in the browser's
    //  page view history.  Most browsers will always retrieve
    //  the document from the web-server whether it is already
    //  in the browsers page-cache or not.
    //  
    window.location.replace( sURL );
}

function animatedcollapse(divId, animatetime, persistexpand, initstate){
	this.divId=divId
	this.divObj=document.getElementById(divId)
	this.divObj.style.overflow="hidden"
	this.timelength=animatetime
	this.initstate=(typeof initstate!="undefined" && initstate=="block")? "block" : "contract"
	this.isExpanded=animatedcollapse.getCookie(uniquepageid+"-"+divId) //"yes" or "no", based on cookie value
	this.contentheight=parseInt(this.divObj.style.height)
	var thisobj=this
	if (isNaN(this.contentheight)){ //if no CSS "height" attribute explicitly defined, get DIV's height on window.load
		animatedcollapse.dotask(window, function(){thisobj._getheight(persistexpand)}, "load")
		if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes" && this.isExpanded!="") //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
			this.divObj.style.visibility="hidden" //hide content (versus collapse) until we can get its height
	}
	else if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes" && this.isExpanded!="") //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
		this.divObj.style.height=0 //just collapse content if CSS "height" attribute available
	if (persistexpand)
		animatedcollapse.dotask(window, function(){animatedcollapse.setCookie(uniquepageid+"-"+thisobj.divId, thisobj.isExpanded)}, "unload")
}

animatedcollapse.prototype._getheight=function(persistexpand){
	this.contentheight=this.divObj.offsetHeight
	if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes"){ //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
		this.divObj.style.height=0 //collapse content
		this.divObj.style.visibility="visible"
	}
	else //else if persistence is enabled AND this content should be expanded, define its CSS height value so slideup() has something to work with
		this.divObj.style.height=this.contentheight+"px"
}


animatedcollapse.prototype._slideengine=function(direction){
	var elapsed=new Date().getTime()-this.startTime //get time animation has run
	var thisobj=this
	if (elapsed<this.timelength){ //if time run is less than specified length
		var distancepercent=(direction=="down")? animatedcollapse.curveincrement(elapsed/this.timelength) : 1-animatedcollapse.curveincrement(elapsed/this.timelength)
	this.divObj.style.height=distancepercent * this.contentheight +"px"
	this.runtimer=setTimeout(function(){thisobj._slideengine(direction)}, 10)
	}
	else{ //if animation finished
		this.divObj.style.height=(direction=="down")? this.contentheight+"px" : 0
		this.isExpanded=(direction=="down")? "yes" : "no" //remember whether content is expanded or not
		this.runtimer=null
	}
}


animatedcollapse.prototype.slidedown=function(){
	if (typeof this.runtimer=="undefined" || this.runtimer==null){ //if animation isn't already running or has stopped running
		if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
			alert("Please wait until document has fully loaded then click again")
		else if (parseInt(this.divObj.style.height)==0){ //if content is collapsed
			this.startTime=new Date().getTime() //Set animation start time
			this._slideengine("down")
		}
	}
}

animatedcollapse.prototype.slideup=function(){
	if (typeof this.runtimer=="undefined" || this.runtimer==null){ //if animation isn't already running or has stopped running
		if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
			alert("Please wait until document has fully loaded then click again")
		else if (parseInt(this.divObj.style.height)==this.contentheight){ //if content is expanded
			this.startTime=new Date().getTime()
			this._slideengine("up")
		}
	}
}

animatedcollapse.prototype.slideit=function(){
	if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
		alert("Please wait until document has fully loaded then click again")
	else if (parseInt(this.divObj.style.height)==0)
		this.slidedown()
	else if (parseInt(this.divObj.style.height)==this.contentheight)
		this.slideup()
}

// -------------------------------------------------------------------
// A few utility functions below:
// -------------------------------------------------------------------

animatedcollapse.curveincrement=function(percent){
	return (1-Math.cos(percent*Math.PI)) / 2 //return cos curve based value from a percentage input
}


animatedcollapse.dotask=function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
	var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false)
	else if (target.attachEvent)
		target.attachEvent(tasktype, functionref)
}

animatedcollapse.getCookie=function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

animatedcollapse.setCookie=function(name, value){
		document.cookie = name+"="+value
}

//** Tab Content script v2.0- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Updated Oct 7th, 07 to version 2.0. Contains numerous improvements:
//   -Added Auto Mode: Script auto rotates the tabs based on an interval, until a tab is explicitly selected
//   -Ability to expand/contract arbitrary DIVs on the page as the tabbed content is expanded/ contracted
//   -Ability to dynamically select a tab either based on its position within its peers, or its ID attribute (give the target tab one 1st)
//   -Ability to set where the CSS classname "selected" get assigned- either to the target tab's link ("A"), or its parent container
//** Updated Feb 18th, 08 to version 2.1: Adds a "tabinstance.cycleit(dir)" method to cycle forward or backward between tabs dynamically
//** Updated April 8th, 08 to version 2.2: Adds support for expanding a tab using a URL parameter (ie: http://mysite.com/tabcontent.htm?tabinterfaceid=0) 

////NO NEED TO EDIT BELOW////////////////////////

function ddtabcontent(tabinterfaceid){
	this.tabinterfaceid=tabinterfaceid //ID of Tab Menu main container
	this.tabs=document.getElementById(tabinterfaceid).getElementsByTagName("a") //Get all tab links within container
	this.enabletabpersistence=true
	this.hottabspositions=[] //Array to store position of tabs that have a "rel" attr defined, relative to all tab links, within container
	this.currentTabIndex=0 //Index of currently selected hot tab (tab with sub content) within hottabspositions[] array
	this.subcontentids=[] //Array to store ids of the sub contents ("rel" attr values)
	this.revcontentids=[] //Array to store ids of arbitrary contents to expand/contact as well ("rev" attr values)
	this.selectedClassTarget="link" //keyword to indicate which target element to assign "selected" CSS class ("linkparent" or "link")
}

ddtabcontent.getCookie=function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

ddtabcontent.setCookie=function(name, value){
	document.cookie = name+"="+value+";path=/" //cookie value is domain wide (path=/)
}

ddtabcontent.prototype={

	expandit:function(tabid_or_position){ //PUBLIC function to select a tab either by its ID or position(int) within its peers
		this.cancelautorun() //stop auto cycling of tabs (if running)
		var tabref=""
		try{
			if (typeof tabid_or_position=="string" && document.getElementById(tabid_or_position).getAttribute("rel")) //if specified tab contains "rel" attr
				tabref=document.getElementById(tabid_or_position)
			else if (parseInt(tabid_or_position)!=NaN && this.tabs[tabid_or_position].getAttribute("rel")) //if specified tab contains "rel" attr
				tabref=this.tabs[tabid_or_position]
		}
		catch(err){alert("Invalid Tab ID or position entered!")}
		if (tabref!="") //if a valid tab is found based on function parameter
			this.expandtab(tabref) //expand this tab
	},

	cycleit:function(dir, autorun){ //PUBLIC function to move foward or backwards through each hot tab (tabinstance.cycleit('foward/back') )
		if (dir=="next"){
			var currentTabIndex=(this.currentTabIndex<this.hottabspositions.length-1)? this.currentTabIndex+1 : 0
		}
		else if (dir=="prev"){
			var currentTabIndex=(this.currentTabIndex>0)? this.currentTabIndex-1 : this.hottabspositions.length-1
		}
		if (typeof autorun=="undefined") //if cycleit() is being called by user, versus autorun() function
			this.cancelautorun() //stop auto cycling of tabs (if running)
		this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]])
	},

	setpersist:function(bool){ //PUBLIC function to toggle persistence feature
			this.enabletabpersistence=bool
	},

	setselectedClassTarget:function(objstr){ //PUBLIC function to set which target element to assign "selected" CSS class ("linkparent" or "link")
		this.selectedClassTarget=objstr || "link"
	},

	getselectedClassTarget:function(tabref){ //Returns target element to assign "selected" CSS class to
		return (this.selectedClassTarget==("linkparent".toLowerCase()))? tabref.parentNode : tabref
	},

	urlparamselect:function(tabinterfaceid){
		var result=window.location.search.match(new RegExp(tabinterfaceid+"=(\\d+)", "i")) //check for "?tabinterfaceid=2" in URL
		return (result==null)? null : parseInt(RegExp.$1) //returns null or index, where index (int) is the selected tab's index
	},

	expandtab:function(tabref){
		var subcontentid=tabref.getAttribute("rel") //Get id of subcontent to expand
		//Get "rev" attr as a string of IDs in the format ",john,george,trey,etc," to easily search through
		var associatedrevids=(tabref.getAttribute("rev"))? ","+tabref.getAttribute("rev").replace(/\s+/, "")+"," : ""
		this.expandsubcontent(subcontentid)
		this.expandrevcontent(associatedrevids)
		for (var i=0; i<this.tabs.length; i++){ //Loop through all tabs, and assign only the selected tab the CSS class "selected"
			this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("rel")==subcontentid)? "selected" : ""
		}
		if (this.enabletabpersistence) //if persistence enabled, save selected tab position(int) relative to its peers
			ddtabcontent.setCookie(this.tabinterfaceid, tabref.tabposition)
		this.setcurrenttabindex(tabref.tabposition) //remember position of selected tab within hottabspositions[] array
	},

	expandsubcontent:function(subcontentid){
		for (var i=0; i<this.subcontentids.length; i++){
			var subcontent=document.getElementById(this.subcontentids[i]) //cache current subcontent obj (in for loop)
			subcontent.style.display=(subcontent.id==subcontentid)? "block" : "none" //"show" or hide sub content based on matching id attr value
		}
	},

	expandrevcontent:function(associatedrevids){
		var allrevids=this.revcontentids
		for (var i=0; i<allrevids.length; i++){ //Loop through rev attributes for all tabs in this tab interface
			//if any values stored within associatedrevids matches one within allrevids, expand that DIV, otherwise, contract it
			document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)? "block" : "none"
		}
	},

	setcurrenttabindex:function(tabposition){ //store current position of tab (within hottabspositions[] array)
		for (var i=0; i<this.hottabspositions.length; i++){
			if (tabposition==this.hottabspositions[i]){
				this.currentTabIndex=i
				break
			}
		}
	},

	autorun:function(){ //function to auto cycle through and select tabs based on a set interval
		this.cycleit('next', true)
	},

	cancelautorun:function(){
		if (typeof this.autoruntimer!="undefined")
			clearInterval(this.autoruntimer)
	},

	init:function(automodeperiod){
		var persistedtab=ddtabcontent.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
		var selectedtab=-1 //Currently selected tab index (-1 meaning none)
		var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
		this.automodeperiod=automodeperiod || 0
		for (var i=0; i<this.tabs.length; i++){
			this.tabs[i].tabposition=i //remember position of tab relative to its peers
			if (this.tabs[i].getAttribute("rel")){
				var tabinstance=this
				this.hottabspositions[this.hottabspositions.length]=i //store position of "hot" tab ("rel" attr defined) relative to its peers
				this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel") //store id of sub content ("rel" attr value)
				this.tabs[i].onclick=function(){
					tabinstance.expandtab(this)
					tabinstance.cancelautorun() //stop auto cycling of tabs (if running)
					return false
				}
				if (this.tabs[i].getAttribute("rev")){ //if "rev" attr defined, store each value within "rev" as an array element
					this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
				}
				if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
					selectedtab=i //Selected tab index, if found
				}
			}
		} //END for loop
		if (selectedtab!=-1) //if a valid default selected tab index is found
			this.expandtab(this.tabs[selectedtab]) //expand selected tab (either from URL parameter, persistent feature, or class="selected" class)
		else //if no valid default selected index found
			this.expandtab(this.tabs[this.hottabspositions[0]]) //Just select first tab that contains a "rel" attr
		if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){
			this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod)
		}
	} //END int() function

} //END Prototype assignment

function displayMessage(url)
{	
	messageObj.setSource(url);
	messageObj.setCssClassMessageBox(false);
	messageObj.setSize(600,500);
	messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
	messageObj.display();
	}
								
function closeMessage()
{
	messageObj.close();	
}	
