<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

/*****************************************************
* the followng two functions “menuToggleOff” and     *
* “menuToggleOn” are used for the top drop down menu *
*****************************************************/
//check for IE
var IE=(navigator.userAgent.toLowerCase().indexOf("msie")!=-1);
//

var preloadedLinkOver=new Image();
preloadedLinkOver.src="images/sbho.gif";

function menuToggleOff(parentNode, sub){
	if(arguments.length==1){
		parentNode.style.backgroundColor="transparent"; 
		parentNode.parentNode.style.borderBottom="none";
		var tempNode;
		var firstTime=true;
		for(var i=0; tempNode=parentNode.parentNode.childNodes[i]; i++){
			if(tempNode.tagName=="DIV"){
				if(firstTime) firstTime=false;
				else{
					tempNode.style.visibility="hidden";
					tempNode.style.display="none";
				}
			}
		}
	}
	else{
		parentNode.style.backgroundColor="#F0F0FC"; 
		menuToggleOff(document.getElementById(sub));
	}
}

function menuToggleOn(parentNode, sub){
	if(arguments.length==1){
		parentNode.style.backgroundColor="#3D4C5B";
		var tempNode;
		var firstTime=true;
		var i=0;
		var ip=0;
		for(i=0; tempNode=parentNode.parentNode.childNodes[i]; i++){
			if(tempNode.tagName=="DIV"){
				if(firstTime) firstTime=false;
				else {
					tempNode.style.visibility="visible";
					tempNode.style.display="block";
				}
				ip++;
			}
		}
		if(ip > 1)
			parentNode.parentNode.style.borderBottom="1px solid #CACACC";
	}
	else{
		parentNode.style.backgroundColor="#FDFDFF";
		menuToggleOn(document.getElementById(sub));
	}
}
//display description of itin in sideBar

function linkOver(str, top, left){
	divIn("blackBody", 40, 10);
    var display;
    var shadow;
    var holder;
	if(	(display=document.getElementById("displayDescription")) &&
    	(shadow=document.getElementById("displayShadow")) && 
    	(holder=document.getElementById("holder")) )
    {
		display.innerHTML=str;
		shadow.style.width=(display.offsetWidth-6)+"px";
		top+=document.getElementById("topHolder").offsetHeight;
		display.style.top=(top)+"px";
		shadow.style.top=(top+27)+"px";
		display.style.left=(left+210)+"px";
		shadow.style.left=(left+217)+"px";
		if(holder.offsetHeight < (display.offsetHeight+top) )
			display.style.height=(holder.offsetHeight-top-52) + "px";
		shadow.style.height=(display.offsetHeight-31)+"px";
		display.style.visibility="visible";
		shadow.style.visibility="visible";
	}
}
function linkOff(){
	divOut("blackBody", 70, 10);
    var display=document.getElementById("displayDescription");
    display.style.visibility="hidden";
    display.innerHTML="";
    var shadow=document.getElementById("displayShadow");
    shadow.style.visibility="hidden";
    shadow.innerHTML="";
}

//
var fadingIn=false;
var maxFade=100;
var fadeRate=1000;
var currentOpacity=0.0;
var fadeTimeOut;

function divIn(divName, maxFadeValue, fadeSpeed){
	fadingOut=false;
	fadingIn=true;
	fadeInDiv(divName, maxFadeValue, fadeSpeed);
}
function fadeInDiv(divName, maxFadeValue, fadeSpeed){
	if(fadingIn){
		//grab target div
		var targetDiv=document.getElementById(divName);
		targetDiv.style.display="block";
		targetDiv.style.visibility="visible";
		//grab current value, this is necessary because you cannot retrieve opacity value from div
		currentValue=currentOpacity;
		//descrease max opacitiy by power of 100
		maxFadeValue=maxFadeValue/100;
		//determine increment to increase opacity
		var increment=maxFadeValue/fadeSpeed;
		//increase current value
		currentValue+=increment;
		//if new value is above max, set new value to max
		if(currentValue >= maxFadeValue)
			currentValue=maxFadeValue;
		//upadate div
		targetDiv.style.opacity=currentValue.toString(); //firefox
		targetDiv.style.filter='alpha(opacity: ' + currentValue*100 + ')'; //IE
		currentOpacity=currentValue;
		//if below limit repeat step
		if(currentValue < maxFadeValue)
			fadeTimeOut=setTimeout("fadeInDiv('"+divName+"', "+(maxFadeValue*100)+", "+fadeSpeed+")", 1);
		else{
			fadingIn=false;
	//		fadeOutDiv(divName, (maxFadeValue*100), fadeSpeed);
		}
	}
}

var fadingOut=false;
function divOut(divName, maxFadeValue, fadeSpeed){
	fadingIn=false;
	fadingOut=true;
	setTimeout("fadeOutDiv('"+divName+"', "+maxFadeValue+", "+fadeSpeed+")", 200);
}
function fadeOutDiv(divName, maxFadeValue, fadeSpeed){
	if(fadingOut){
		clearTimeout(fadeTimeOut);
		//grab target div
		var targetDiv=document.getElementById(divName);
		//if neither fading in or out set initial values for div
		//grab current value, this is necessary because you cannot retrieve opacity value from div
		currentValue=currentOpacity;
		//descrease max opacitiy by power of 100
		maxFadeValue=maxFadeValue/100;
		//determine increment to increase opacity
		var increment=maxFadeValue/fadeSpeed;
		//increase current value
		currentValue-=increment;
		//if new value is above max, set new value to max
		if(currentValue <= 0)
			currentValue=0;
		//upadate div
		targetDiv.style.opacity=currentValue.toString(); //firefox
		targetDiv.style.filter='alpha(opacity: ' + currentValue*100 + ')'; //IE
		currentOpacity=currentValue;
		//if below limit repeat step
		if(currentValue > 0)
			setTimeout("fadeOutDiv('"+divName+"', "+(maxFadeValue*100)+", "+fadeSpeed+")", 1);
		else{
			targetDiv.style.visibility="hidden";
			targetDiv.style.display="none";
			fadingOut=false;
		}
	}
}
/********************************************************
* formatMenu() will parse through the array “menu items”*
* (which should be populated by id) and evenly space    *
* the items horizontally accross the screen starting at *
* the left value of “startLeft” and with “gap” pixels   *
* between each item                                     *
********************************************************/
var menuItems;
var lastInh;
var maximumGap=30;
var documentIsLoaded=false;
var bw = new lib_bwcheck();
function formatMenu(isOfaType){
    bw = new lib_bwcheck();
    if(bw.ff2){
        if(document.getElementById("homeDrop")) document.getElementById("homeDrop").style.top="76px";
        if(document.getElementById("africanDrop")) document.getElementById("africanDrop").style.top="76px";
        if(document.getElementById("aboutDrop")) document.getElementById("aboutDrop").style.top="76px";
        if(document.getElementById("worldwideDrop")) document.getElementById("worldwideDrop").style.top="76px";
        var typeDrop;
        for(i=0; typeDrop=document.getElementById("typeDrop"+i); i++)
            typeDrop.style.top="76px";
    }
    //find the lastInh, called frequently
    var inh;
    var i;
    for(i=0; inh=document.getElementById("inh"+i); i++){ 
        //do nothing 
    }
    i--;
    if(i>-1) lastInh=document.getElementById("inh"+i);
    else lastInh=false;
    //the below lines set the height of holder to be at least the height of the browser window
    var holder;
    var holderHeight=0;
    var bottomPadding=25;
    if(holder=document.getElementById("holder"))
        holderHeight=holder.offsetHeight;
    var documentInfo=documentSize();
    var lastInhPosition=getPosition(lastInh);
    if(holderHeight<(documentInfo.offsetHeight-bottomPadding) && lastInh){
           if(arguments.length > 0 && i > 0){
                var oldInh=lastInh;
                lastInh=document.getElementById("inh"+(i-1));
           }
           var inhInfo=getPosition(lastInh);
           var targetHeight=documentInfo.offsetHeight-bottomPadding;
           lastInh.style.height=(targetHeight-inhInfo.offsetTop-33)+"px";
           if(arguments.length > 0 && i > 0)
                lastInh=oldInh;
    }
    //the below lines determine the height of the black transparent backround for linkOverSide etc
    var blackBody; var scroller;
    if( (blackBody=document.getElementById("blackBody")) && (scroller=document.getElementById("scroller")) )
      blackBody.style.height=scroller.offsetHeight+"px";

    //the below lines figure out the format of the topbar menu
    var gap=10;
    var targetItem;
    var totalWidth=0;
    for(var i=menuItems.length-1; i>=0; i--){
        if(targetItem=document.getElementById(menuItems[i])){
            totalWidth+=targetItem.offsetWidth;
        }
    }
    var tmb;
    var padding=5;
    if(tmb=document.getElementById('tmbContent')){
        var startLeft=tmb.offsetWidth;
        var fitWidth=startLeft-(padding*2);
        gap=fitWidth-totalWidth;
        gap=gap/(menuItems.length-1);
        //if gap is greater than maximum gap make gap equal to maxium and split home and about us
        var stopParse=0;
        if(gap>(maximumGap+10)){
            splitLinks=true;
            gap=maximumGap;
            stopParse=2;
        }
        var firstTime=true;
        for(var i=menuItems.length-1; i>=stopParse; i--){
    //        alert(menuItems[i]);
            if(targetItem=document.getElementById(menuItems[i])){
                if(firstTime){
                    firstTime=false;
                    startLeft-=(padding+targetItem.offsetWidth);
                    targetItem.style.left=Math.floor(startLeft)+"px";
                }
                else {
                    startLeft-=(gap+targetItem.offsetWidth);
                    targetItem.style.left=Math.floor(startLeft)+"px";
                }
            }
        }
        tmb.style.visibility="visible";
    } 
    if( (locationViewer=document.getElementById("locationViewer")) && (mainHolder=document.getElementById("holder"))
                                            && (fullBlack=document.getElementById("fullBlack"))
                                            && (locationViewerHeader=document.getElementById("locationViewerHeader")) 
                                            && (locationNav=document.getElementById("locationNav")) 
                                            && (loader=document.getElementById("loader")) ){

        locationViewerHeader.style.left=locationViewer.style.left=(Math.ceil((documentInfo.offsetWidth-820)/2)<0)?
            "0px": Math.ceil((documentInfo.offsetWidth-820)/2)+"px";
        loader.style.left=(Math.ceil((documentInfo.offsetWidth-820)/2)<0)?
            "1px": (Math.ceil((documentInfo.offsetWidth-820)/2)+1)+"px";
        loader.style.top=locationViewer.style.top=( ((documentInfo.offsetHeight-521)/2) + documentInfo.offsetTop )+"px";
        locationViewerHeader.style.height=(locationNav.offsetHeight)+"px";
        if( (locationViewer.offsetTop-(locationViewerHeader.offsetHeight)) < 5){
            locationViewerHeader.style.top="5px";
            loader.style.top=locationViewer.style.top=(5+locationViewerHeader.offsetHeight)+"px";
        }
        else locationViewerHeader.style.top=(locationViewer.offsetTop-(locationViewerHeader.offsetHeight))+"px";
    }
    documentIsLoaded=true;
    var targetSubLink;
    if(openLinks){
        if(targetSubLink=document.getElementById('0_0'))
            openSubLinks(targetSubLink);
    }
    if(openRequested)
        ratesOpen(openWindowSrc, opentType, openOrigin);
}

var openLinks=false;
var morePages=false;
function formatIt(){
	//find last inh
	var targetINH;
	var i;
	for(i=0; document.getElementById("inh"+i); i++){
		targetINH=document.getElementById("inh"+i);
	}
	//if end position of targetINH is less than sideBar height
	var sideBar=document.getElementById("sideBar");
	var targetHeight=sideBar.offsetHeight;
	if((targetINH.offsetHeight+targetINH.offsetTop) < targetHeight){
		if(morePages) document.getElementById("inh"+(i-2)).style.height=(targetHeight-targetINH.offsetTop)+"px";
		else targetINH.style.height=(targetHeight-targetINH.offsetTop)+"px";
	}
	//if new total is less then desired height resize
	var minHeight=486;
	if((targetINH.offsetHeight+targetINH.offsetTop) < minHeight) {
		if(morePages) document.getElementById("inh"+(i-2)).style.height=(minHeight-document.getElementById("inh"+(i-2)).offsetTop)+"px";
		else targetINH.style.height=(minHeight-targetINH.offsetTop)+"px";
	}
	//if resized then resize sidebar
	sideBarTargetHeight=targetINH.offsetTop+targetINH.offsetHeight-8;
	if(sideBar.offsetHeight < sideBarTargetHeight)
		sideBar.style.height=sideBarTargetHeight+"px";
}

//returns false if a text field if empty
function fieldCheck(aTextField) {
   return (!(aTextField.value.length==0) &&
           (aTextField.value!=null) && 
           !whiteCheck(aTextField.value) );
}	

//returns true if string is whitespace only
function whiteCheck(str){
    return /^( |\n|\r\s)+$/.test(str);
}

//takes an array and checks if fields are empty
var originalLabelColor="#0D1C4B";
function verifySubmit(checkFields, checkFieldNames, formIndex){
    var verified=true;
    var focusSwitched=false;
    //default form index
    if(arguments.length < 3)
        formIndex=0;
    for(i in checkFields){
        if(document.forms[formIndex][checkFields[i]]){
            if( ((document.forms[formIndex][checkFields[i]].tagName=="SELECT") && document.forms[formIndex][checkFields[i]].selectedIndex==0)
                   || !fieldCheck(document.forms[formIndex][checkFields[i]])){
                verified=false;
                var checkFieldName=checkFields[i];
                if(arguments.length>1 && checkFieldNames[i])
                    checkFieldName=checkFieldNames[i];
	                alert("Please enter a '"+checkFieldName+"'");
                if(!focusSwitched){
                    document.forms[0][checkFields[i]].focus();
                    focusSwitched=true;
                }
                var targetLabel;
                if(targetLabel=document.getElementById(checkFields[i]+'Label')){
					targetLabel.innerHTML=targetLabel.innerHTML.replace(/^\*/, "");
                    targetLabel.style.color="#993333";
                    targetLabel.innerHTML="*"+targetLabel.innerHTML;
                }
            }
            else if( ((document.forms[formIndex][checkFields[i]].tagName=="SELECT") && document.forms[formIndex][checkFields[i]].selectedIndex!=0)
                   || fieldCheck(document.forms[formIndex][checkFields[i]])){
                var targetLabel;
                if(targetLabel=document.getElementById(checkFields[i]+'Label')){
					targetLabel.style.color=originalLabelColor;
					targetLabel.innerHTML=targetLabel.innerHTML.replace(/^\*/, "");
                }
            }
        }
	}
	return verified;
}

function generatePassword (length)
{
	if(arguments.length==0)
		length=16;
	// start with a blank password
	var password = "";
	
	// define possible characters
	var possible = "0123456789abcdfghjkmnpqrstvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"; 
	
	// add random characters to $password until $length is reached
	for (i=0; i < length; i=i) { 
		
		// pick a random character from the possible ones
		var char = possible.substr(Math.floor(Math.random() * possible.length), 1);
		// we don't want this character if it's already in the password
		if (i==0 || password.indexOf(char)==-1) { 
			password += char;
			i++;
		}
		
	}
	
	// done!
	return password;
	
}

function togglePicture(targetLink, targetToggle, invis, vis, itemName){
	if(document.forms[0][targetToggle].value==0){
		document.forms[0][targetToggle].value=1;
		targetLink.innerHTML="use original";
		document.getElementById(vis).style.visibility="hidden";
		document.getElementById(vis).style.display="none";
		document.getElementById(invis).style.display="block";
		document.getElementById(invis).style.visibility="visible";
		formatIt();
	}
	else {
		document.forms[0][targetToggle].value=0;
		targetLink.innerHTML=(itemName=="imageToo")? "change banner": "change picture";
		document.getElementById(vis).style.visibility="visible";
		document.getElementById(vis).style.display="block";
		document.getElementById(invis).style.display="none";
		document.getElementById(invis).style.visibility="hidden";
		formatIt();
	}
	targetLink.blur();
	return false;
}

function mktime() {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: baris ozdil
    // +      input by: gabriel paderni 
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: FGFEmperor
    // *     example 1: mktime( 14, 10, 2, 2, 1, 2008 );
    // *     returns 1: 1201871402
    
    var no, ma = 0, mb = 0, i = 0, d = new Date(), argv = arguments, argc = argv.length;
    d.setHours(0,0,0); d.setDate(1); d.setMonth(1); d.setYear(1972);
 
    var dateManip = {
        0: function(tt){ return d.setHours(tt); },
        1: function(tt){ return d.setMinutes(tt); },
        2: function(tt){ set = d.setSeconds(tt); mb = d.getDate() - 1; return set; },
        3: function(tt){ set = d.setMonth(parseInt(tt)-1); ma = d.getFullYear() - 1972; return set; },
        4: function(tt){ return d.setDate(tt+mb); },
        5: function(tt){ return d.setYear(tt+ma); }
    };
    
    for( i = 0; i < argc; i++ ){
        no = parseInt(argv[i]);
        if(no && isNaN(no)){
            return false;
        } else if(no){
            // arg is number, let's manipulate date object
            if(!dateManip[i](no)){
                // failed
                return false;
            }
        }
    }
 
    return Math.floor(d.getTime()/1000);
}

function popup(mylink, windowname, width, height, origin)
{
	if(arguments.length==5) origin.blur();
	if (! window.focus)return true;
		var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
   		href=mylink.href;
	window.open(href, windowname, 'width='+width+',height='+height+',scrollbars=yes,status=0,toolbar=0,location=0,menubar=0,directories=0');
	return false;
}


function urlencode(str) {
	return encodeURIComponent(str);
}

function urldecode(str) {
	return decodeURIComponent(str);
}

function smartBreak(targetID, breakString, targetWidth, includeBreaks){
	var target;
	if(target=document.getElementById(targetID)){
		//set up defaults
		if(arguments.length < 5) padding=20;
		if(arguments.length < 4) includeBreaks=false;
		if(arguments.length < 3){
			if(target.style.width) targetWidth=parseInt(target.style.width);
			else return false;	
		}
		if(arguments.length < 2) breakString='<!--break-->';
		var segment=target.innerHTML.split(breakString);
		target.innerHTML="";
		var lastLoop;
		//create an empty table
		var virtualTable=document.createElement('table');
		virtualTable.style.padding="0px !important";
		virtualTable.style.width=null;
		var tbody=document.createElement('tbody');
		var tr=document.createElement('tr');
		var targetCell=document.createElement('td');
		tr.appendChild(targetCell);
		tbody.appendChild(tr);
		virtualTable.appendChild(tbody);
		target.appendChild(virtualTable);
		virtualTable.style.visibility="hidden";
		var regularHeight;
		for(i in segment){
			lastLoop=targetCell.innerHTML;
			if(includeBreaks && (i < segment.length-1) && (i!=0) ) targetCell.innerHTML+=breakString;
			targetCell.innerHTML+=segment[i];
			if(i==0) regularHeight=targetCell.offsetHeight;
			if((targetCell.offsetWidth > targetWidth) || (regularHeight<targetCell.offsetHeight) ){
				regularHeight=targetCell.offsetHeight;
				targetCell.innerHTML=lastLoop;
				if(i!=0) targetCell.innerHTML+="<br />";
				targetCell.innerHTML+=segment[i];
			}
		}
		target.innerHTML=targetCell.innerHTML;
		target.style.width=targetWidth+"px";
	}
	return true;
}

	

function verifyEmail(formIndex, emailIndex, confirmIndex){
	if(arguments.length < 3) confirmIndex="email2";
	if(arguments.length < 2) emailIndex="email1";
	if(arguments.length==0) formIndex=0;
	var status = false;     
	var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
     if (document.forms[formIndex]['emailIndex'].value.search(emailRegEx) == -1) {
          alert("Please enter a valid email address.");
     }
     else if (document.forms[formIndex]['emailIndex'].value != document.forms[formIndex]['confirmIndex'].value) {
          alert("Email addresses do not match.  Please retype them to make sure they are the same.");
     }
     else status = true;
     return status;
}

function verifyEmail(formIndex, firstField, matchField){
	if(arguments.length==0) formIndex=0;
	if(arguments.length < 2) firstField="email";
	if(arguments.length < 3) matchField=firstField;
	var status = false;     
	var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
     if (document.forms[formIndex][firstField].value.search(emailRegEx) == -1) {
          alert("Please enter a valid email address.");
     }
     else if (document.forms[formIndex][firstField].value != document.forms[formIndex][matchField].value) {
          alert("Email addresses do not match.  Please retype them to make sure they are the same.");
     }
     else status = true;
     return status;
}


	function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
//		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
//		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
//		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
//		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
//		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
//		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
//		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}


/*Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
}; */

	function iInArray(ar, value){
		var i;
		for(i=0; i < ar.length; i++){
			if(ar[i].toLowerCase()==value.toLowerCase())
				return true;
		}
		return false;
	}
	
	function iInArrayIndex(ar, value){
		var i;
		for(i=0; i < ar.length; i++){
			if(ar[i].toLowerCase()==value.toLowerCase())
				return i;
		}
		return false;
	}

	function inArray(ar, value){
		var i;
		for(i=0; i < ar.length; i++){
			if(ar[i]==value)
				return true;
		}
		return false;
	}

var alreadyOpening=false;
function openSubLinks(origin){
    origin.childNodes[0].blur();
    origin.blur();
    if(documentIsLoaded){
        if(!alreadyOpening){
            alreadyOpening=true;
            var listIndex=(origin.id.substring(0, origin.id.indexOf("_")));
            var parentIndex=(origin.id.substring(origin.id.indexOf("_")+1)) * 1;
            //check to see if visible
            var targetCell; var targetImage;
            var linkIndex=0;
            var reverse=false;
            if((document.getElementById(listIndex+"_"+parentIndex+"_"+linkIndex)) && (targetCell=document.getElementById(listIndex+"_"+parentIndex+"_"+linkIndex).parentNode)){    
                if(targetCell.style.visibility && targetCell.style.visibility=="visible"){
                    reverse=true;
                    //find the last one
                    var i;
                    for(i=0; ((document.getElementById(listIndex+"_"+parentIndex+"_"+i)) && (targetCell=document.getElementById(listIndex+"_"+parentIndex+"_"+i).parentNode)); i++ ){
                    }
                    i--;
                    linkIndex=i;
                    origin.style.fontWeight="500";
    //                origin.style.textDecoration="none";
                    if(targetImage=document.getElementById(listIndex+"_"+parentIndex+"_plus"))
                        targetImage.src="images/triangle.gif";
                }
                else{
                    origin.style.fontWeight="800";
      //              origin.style.textDecoration="underline";
                    if(targetImage=document.getElementById(listIndex+"_"+parentIndex+"_plus"))
                        targetImage.src="images/triangle_down.gif";
                }
            }
            else{
                origin.style.fontWeight="800";
                if(targetImage=document.getElementById(listIndex+"_"+parentIndex+"_plus"))
                    targetImage.src="images/triangle_down.gif";
            }
            //grab initial height of scroller
            var holder;
            if(holder=document.getElementById("holder")){
                holderHeight=holder.offsetHeight;
            }
            makeVisible(listIndex, parentIndex, linkIndex, 0, reverse);
        }
        return false;
    }
}
var holderHeight=0;

function makeVisible(listIndex, parentIndex, linkIndex, visibleDelay, reverse){
    var targetCell;
    if((document.getElementById(listIndex+"_"+parentIndex+"_"+linkIndex)) && (targetCell=document.getElementById(listIndex+"_"+parentIndex+"_"+linkIndex).parentNode)){    
        if(targetCell.style.visibility && targetCell.style.visibility=="visible"){
            targetCell.style.visibility="hidden";
            targetCell.parentNode.parentNode.parentNode.style.visibility="hidden";
            targetCell.style.display="none";
            targetCell.parentNode.parentNode.parentNode.style.display="none";
        }
        else{
            targetCell.style.visibility="visible";
            targetCell.parentNode.parentNode.parentNode.style.visibility="visible";
            targetCell.style.display="block";
            targetCell.parentNode.parentNode.parentNode.style.display="block";
        }


        if(reverse) linkIndex--;
        else linkIndex++;
        newDelay=visibleDelay+1;
        setTimeout('makeVisible('+listIndex+', '+parentIndex+', '+linkIndex+','+newDelay+', '+reverse+')', visibleDelay);
    }
    else alreadyOpening=false;
}

function linkOverSide(header, header2, description, origin, isSub){
    if(documentIsLoaded){
        clearTimeout(offInterval);
        if(lOrigin && lOrigin!=origin){
            if(arguments.length<5) linkOffSide();
            else linkOffSide(true)
        }
        if(arguments.length < 4){
            origin=description;
            description=header2;
            header2=false;
        }
        else if(arguments.length==4 && typeof origin=='boolean'){
            origin=description;
            description=header2;
            header2=false;
        }
        var realPositions=getPosition(origin);
        var top=realPositions.offsetTop-document.getElementById("holderToo").offsetTop-origin.parentNode.offsetHeight;
        left=origin.offsetLeft;
        if(arguments.length > 4) left-=10;
        divIn("blackBody", 40, 10);
        var display;
        var shadow;
        var holder;
        if(	(display=document.getElementById("displayDescription")) &&
            (shadow=document.getElementById("displayShadow")) && 
            (holder=document.getElementById("holder")) )
        {
            
            if(origin.id.indexOf("_", origin.id.indexOf("_")+1)!==-1)
                origin.parentNode.style.backgroundColor='#F2F3F5';
            else
                origin.parentNode.style.backgroundColor='#DEE1E3';
            str='<table cellpadding="0" cellspacing="0" class="dDtableHeader">'+
                    '<tr>'+
                        '<td>'+
                            '<img src="../images/sbul.gif" />'+
                        '</td>'+
                        '<td align="left" class="dTableHeaderCell">'+
                            '<strong>'+header+'</strong>'+
                        '</td>';
            if(header2!==false) str+='<td align="right" style="padding-right: 5px; padding-left: 15px; " class="dTableHeaderCell">'+
                            '<i>'+header2+'</i>'+
                         '</td>';
            str+=        '<td>'+
                            '<img src="../images/sbur.gif" />'+
                         '</td>'+
                    '</tr>'+
                '</table>'+
                '<div class="ddDescription">'+
                    description+
                '</div>';
            display.style.visibility="visible";
            shadow.style.visibility="visible";
            display.style.display="block";
            shadow.style.display="block";
            top+=document.getElementById("topHolder").offsetHeight;
            display.style.top=(top)+"px";
            display.style.left=(left+241)+"px";
            shadow.style.left=(left+248)+"px";
            display.innerHTML=str;
            shadow.style.width=(display.offsetWidth-6)+"px";
            //check that is not bleeding off of bottom page
            var windowInfo=documentSize();
            windowInfo.offsetHeight-=10;
            var minTop=document.getElementById("topHolder").offsetHeight + document.getElementById("topHolder").offsetTop+7;
            var scroller;
            var holder;
            if(holder=document.getElementById("holder")){
                if(holder.offsetHeight < windowInfo.offsetHeight) windowInfo.offsetHeight=holder.offsetHeight-8;
                if( (top+display.offsetHeight) > (windowInfo.offsetTop+windowInfo.offsetHeight) ) {
                    if(display.offsetHeight > windowInfo.offsetHeight)  top=windowInfo.offsetTop;
                    else top=(windowInfo.offsetTop+windowInfo.offsetHeight)-display.offsetHeight;
                    if(top < minTop) top=minTop;
                        display.style.top=(top)+"px";
                        shadow.style.top=(top+27)+"px";
                }
            }
            shadow.style.top=(top+27)+"px";
            
            shadow.style.height=(display.offsetHeight-31)+"px";
        }
    }
}

var offInterval;
var lOrigin;

function timeOff(origin, isSub){
    clearTimeout(offInterval);
    lOrigin=origin;
    offInterval=(arguments.length > 1) ? setTimeout("linkOffSide('true')", 100) : 
                                        setTimeout("linkOffSide()", 100);
}

var fTime=true;

function linkOffSide(isSub){
    if(lOrigin){
        origin=lOrigin;
        var display;
        var shadow;
        if(	(display=document.getElementById("displayDescription")) &&
            (shadow=document.getElementById("displayShadow"))  )
        {
            divOut("blackBody", 70, 10);
            if(origin.id.indexOf("_", origin.id.indexOf("_")+1)!==-1)
                origin.parentNode.style.backgroundColor='#EEE6E8';
            else
                origin.parentNode.style.backgroundColor='#F7F8FA';
            display.style.visibility="hidden";
            display.style.display="none";
            display.innerHTML="";
            shadow.style.visibility="hidden";
            shadow.style.display="none";
            shadow.innerHTML="";
        }
        clearTimeout(offInterval);
        fTime=false;
        var offInterval;
    } 
}

function changeHeaderBack(origin){
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}


function documentSize() {
    var myWidth = 0; var myHeight = 0; var myScrollY=0; var myScrollX=0;
    if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
        myScrollX = window.pageXOffset;
        myScrollY = window.pageYOffset;
    }
    else{
        if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
            myWidth = document.documentElement.clientWidth;
            myHeight = document.documentElement.clientHeight;
            myScrollX = document.documentElement.scrollLeft;
            myScrollY = document.documentElement.scrollTop;
        }
        else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
            myWidth = document.body.clientWidth;
            myHeight = document.body.clientHeight;
            myScrollX = document.body.scrollLeft;
            myScrollY = document.body.scrollTop;
        }
    }
    var returnInfo=new Object();
    returnInfo.offsetWidth=myWidth;
    returnInfo.offsetHeight=myHeight;
    returnInfo.offsetLeft=myScrollX;
    returnInfo.offsetTop=myScrollY;
    return returnInfo;
}


moz=document.getElementById&&!document.all
function getPosition(cell_el){
    if(typeof cell_el == 'string') cell_el=document.getElementById(cell_el);
    cell_left_pos = cell_el.offsetLeft;
    cell_top_pos = cell_el.offsetTop;
    parent_el = cell_el.offsetParent;
    while (parent_el != null){
        if(parent_el.tagName == "TD"){ // if parent a table cell, include cell border width
            if(!moz){
                cell_left_pos += parent_el.clientLeft
                cell_top_pos += parent_el.clientTop
            }
            else{
                if(parent_el.tagName == "TABLE"){ // if parent is a table, get its border as a number
                    nParBorder = parseInt(parent_el.border)
                    if(nParBorder > 0){ // if a border width is specified
                        nLeftPos += nParBorder  // append the border width to counter
                    }
                }
            }
        }
        cell_left_pos += parent_el.offsetLeft // add left offset of parent
        cell_top_pos += parent_el.offsetTop // add top offset of parent
        
        parent_el = parent_el.offsetParent; // move up the elements until no more offset parents exist
    }
    var returnObject=new Object();
    returnObject.offsetTop=cell_top_pos;
    returnObject.offsetLeft=cell_left_pos;
    return returnObject;
}

var charPerUpper=1.2;
var maxChars=33;
function testLength(inputName, formIndex){
    if(arguments.length < 2) formIndex=0;
    var testString=document.forms[formIndex][inputName].value;
    var numberOfUppers=countUpper(testString.substring(0, maxChars));
    var charCount=(maxChars-Math.ceil(numberOfUppers * charPerUpper)) + numberOfUppers;
    alert('In the side bar the above text will be displayed as: \n"'+ chopAtSpace(testString, maxChars)+'"');
    return false;
}   

function countUpper(str){
    return str.replace(/[^A-Z]/g, "").length;
}

function chopAtSpace(str, maxLength){
	var original=str;
	var lessLength=maxLength-5;
	if(str.length>maxLength){
		var offset=str.indexOf(" ", lessLength);
		if(offset>maxLength){
			for(var intOffset=maxLength; intOffset>0; intOffset-=5){
				offset=str.indexOf(" ", intOffset);
				if(offset<maxLength)
					break;
			}
			if(offset<=5)
				offset=maxLength;
		}
		str=str.substr(0, offset)+"...";
	}
	if(str.length==3)
		return original;
	return str;
}


function lib_bwcheck(){
	this.ver=navigator.appVersion;
	//this.vender = navigator.vender;
	this.product=navigator.product;
    this.agent=navigator.userAgent;
	this.moz= navigator.product == 'Gecko';
    if(this.moz){
        this.ff2=(this.agent.indexOf("Firefox/2")!=-1);
        this.ff3=(this.agent.indexOf("Firefox/3")!=-1);
    }        
	this.dom=document.getElementById?1:0;
	this.mac=this.agent.indexOf("Mac")>-1;
	this.opera5=window.opera?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	this.ie5mac=(this.ver.indexOf("MSIE 5.23")>-1 && !this.opera5 && this.mac)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
//	this.ie=this.ie4||this.ie5||this.ie6||this.ie7;
	this.ie=(this.ver.indexOf("MSIE")>-1 && this.dom && !this.opera5)?1:0;
	this.saf=this.agent.indexOf("Safari")>-1;
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.moz||this.ie5mac||this.saf||this.ie7||this.ie6||this.ie5||this.ie4||this.ns4||this.ns6 ||this.opera5);
	return this;
}

function winPop(windowSrc, type){
    if(type=="rates")
        return popup(windowSrc, "rates", 850, 620);
    else 
        return popup(windowSrc, "location", 870, 670);
}

function testFunction(){
    alert("test");
}

var locationNav;
var locationViewer;
var locationViewerHeader;
var mainHolder;
var fullBlack;
var lvTopPos;
var loader;
function positionLocationViewer(windowSrc, type){
    viewerOpen=true;
    if(type=="rates")
        locationViewer.onload=formatLocationViewer;
    else locationViewer.onload=formatLocationViewerToo;
    locationViewer.src=windowSrc;
    var locationViewerRef;
    if(locationViewerRef=document.getElementById("locationViewerRef")){
        locationViewerRef.windowSrc=windowSrc;
        locationViewerRef.type=type;
        locationViewerRef.onclick=function(){
            winPop(this.windowSrc, this.type);
            closeViewer();
            return false;
        }
    }
    document.body.style.overflow="hidden";
    var documentInfo=documentSize();
    fullBlack.style.height=(  (documentInfo.offsetHeight + documentInfo.offsetTop) > (mainHolder.offsetHeight+15) )?
                            (documentInfo.offsetHeight + documentInfo.offsetTop)+"px":
                            (mainHolder.offsetHeight+15)+"px";
    fullBlack.style.display="block";
    fullBlack.style.visibility="visible";
    divIn("fullBlack", 70, 5);
    locationViewer.style.left=(Math.ceil((documentInfo.offsetWidth-820)/2)<0)?
            "0px": Math.ceil((documentInfo.offsetWidth-820)/2)+"px";
    loader.style.left=(Math.ceil((documentInfo.offsetWidth-820)/2)<0)?
            "1px": (Math.ceil((documentInfo.offsetWidth-820)/2)+1)+"px";
//    locationViewer.style.width=(mainHolder.offsetWidth-30)+"px";
//    var targetHeight=Math.floor(documentInfo.offsetHeight*.75);
    var targetHeight=521;
//    locationViewer.style.height=targetHeight+"px";
//    locationViewer.style.height="521px";
    loader.style.top=locationViewer.style.top=( ((documentInfo.offsetHeight-targetHeight)/2) + documentInfo.offsetTop )+"px";
    windowTopPos=documentInfo.offsetTop;
    window.onscroll=repositionLocationViewer;
    locationViewerHeader.style.height=(locationNav.offsetHeight)+"px";
    loader.style.display="block";
    loader.style.visibility="visible";
    locationViewer.style.display="block";
    locationViewer.style.visibility="visible";
    locationViewerHeader.style.display="block";
    locationViewerHeader.style.visibility="visible";
    locationViewerHeader.style.height=(locationNav.offsetHeight)+"px";
    if( (locationViewer.offsetTop-(locationViewerHeader.offsetHeight)) < 5){
        locationViewerHeader.style.top="5px";
        loader.style.top=locationViewer.style.top=(5+locationViewerHeader.offsetHeight)+"px";
    }
    else locationViewerHeader.style.top=(locationViewer.offsetTop-(locationViewerHeader.offsetHeight))+"px";
}

function formatLocationViewerToo(){
    var inh;
    if(inh=window.frames[0].document.getElementById("inh0")){
        if(bw.ie6){
            locationViewer.scrolling="no";
        }
        inh.style.height=(bw.ie6)? "470px": "490px";
		inh.style.overflow="auto";
	}
    formatLocationViewer();
}
function formatLocationViewer(){
    loader.style.display="none";
    loader.style.visibility="hidden";
    var popBottomBar; var popHolder; var ratesHeader; var locationNavHeader; var inh;
    if( (popHolder=window.frames[0].document.getElementById("popHolder")) 
            && (popBottomBar=window.frames[0].document.getElementById("popBottomBar")) 
            && (ratesHeader=window.frames[0].document.getElementById("ratesHeader")) 
            && (locationNavHeader=document.getElementById("locationNavHeader")) ){
        window.frames[0].document.body.style.paddingTop="0px";
        popHolder.style.paddingTop="0px";
        locationNavHeader.innerHTML=ratesHeader.innerHTML;
        ratesHeader.style.display="none";
        popBottomBar.style.display="none";
        popHolder.style.visibility="visible";
		var sTTbody;
		if( (sTTbody=window.frames[0].document.getElementById("sTTbody"))
					&& (sTTbody.offsetHeight > 455) && !bw.ie )
			sTTbody.style.height="455px";
		if(bw.ie && sTTbody){
			sTTbody.style.height="auto";
		}
        locationNav.style.width=(popHolder.offsetWidth-32)+"px";
        locationNav.style.left=(popHolder.offsetLeft+0)+"px";
        locationViewerHeader.style.height=(locationNav.offsetHeight)+"px";
        if(popHolder.offsetHeight < (locationViewer.offsetHeight-12) ){
//            locationViewer.style.top=(locationViewer.offsetTop+Math.floor((locationViewer.offsetHeight-(popHolder.offsetHeight+15))/2) - Math.floor(locationViewerHeader.offsetHeight/2) )+"px";
  //          locationViewer.style.height=(popHolder.offsetHeight)+"px";
              popHolder.style.height=(locationViewer.offsetHeight-12)+"px";
        }
        if( (locationViewer.offsetTop-(locationViewerHeader.offsetHeight)) < 5){
            locationViewerHeader.style.top="5px";
            loader.style.top=locationViewer.style.top=(5+locationViewerHeader.offsetHeight)+"px";
        }
        else locationViewerHeader.style.top=(locationViewer.offsetTop-(locationViewerHeader.offsetHeight))+"px";
        locationViewerHeader.style.left=locationViewer.offsetLeft+"px";
        locationViewerHeader.style.width=(locationViewer.offsetWidth-2)+"px";
    }
}

function repositionLocationViewer(){
    var documentInfo=documentSize();
    loader.style.top=locationViewer.style.top=((documentInfo.offsetTop-windowTopPos)+locationViewer.offsetTop)+"px";
    locationViewerHeader.style.top=((documentInfo.offsetTop-windowTopPos)+locationViewerHeader.offsetTop)+"px";
    windowTopPos=documentInfo.offsetTop;
}

function closeViewer(){
    locationViewer.style.display="none";
    locationViewer.style.visibility="hidden";
    loader.style.display="none";
    loader.style.visibility="hidden";
    locationViewerHeader.style.display="none";
    locationViewerHeader.style.visibility="hidden";
    divOut("fullBlack", 70, 5);
    document.body.style.overflow="auto";
    return false;
    viewerOpen=false;
}
var viewerOpen=false;

var openRequested=false;
var openWindowSrc=false; var openType; var openOrigin;
function ratesOpen(windowSrc, type, origin){
    if(bw.opera5){
        if(type=="rates")
            return popup(windowSrc, "rates", 850, 620);
        else 
            return popup(windowSrc, "location", 870, 670);
    }
    else{
        if(documentIsLoaded) {
            origin.blur();
            positionLocationViewer(windowSrc, type);
        }
        else {
            openRequested=true;
            openWindowSrc=windowSrc;
            opentType=type;
            openOrigin=origin;
        }
    }
    return false;
}

function keyPressHandler(e) {
      var kC  = (window.event) ?    // MSIE or Firefox?
                 event.keyCode : e.keyCode;
      var Esc = (window.event) ?   
                27 : e.DOM_VK_ESCAPE // MSIE : Firefox
      if(kC==Esc && viewerOpen) {
         closeViewer();
      }
}

if (document.addEventListener){
    document.addEventListener('keypress', keyPressHandler, false);
} else if (document.attachEvent){
    document.attachEvent('onkeypress', keyPressHandler);
} 

//-->