/* ***********************Begin drop down menu*********************** */
activateMenu = function(nav) {

    /* currentStyle restricts the Javascript to IE only */
	if (document.all && document.getElementById(nav) && document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */
        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
            
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {                       
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}
window.onload= function(){
    /* pass the function the id of the top level UL */
    /* remove one, when only using one menu */
    activateMenu('mainnavul'); 
    return;
    if (document.all != null) {
    	var tabs = document.all.tabslink1.childNodes[0].getElementsByTagName("li");
    	for (var i=0;i<tabs.length;i++) {
    		var tab = tabs[i].getElementsByTagName("a");  
    		if (tab[0].attachEvent) {  	
    			tab[0].attachEvent('onclick',toggledivs2);
    		} else if (tab[0].addEventListener) {
    			tab[0].addEventListener('click',toggledivs2, false);
    		}
    		
    	}
    }
    if (document.getElementById) {
    	var tabs = document.getElementById('tabslink1').childNodes[0].getElementsByTagName("li");
    	for (var i=0;i<tabs.length;i++) {
    		var tab = tabs[i].getElementsByTagName("a");  
    		if (tab[0].attachEvent) {  	
    			tab[0].attachEvent('onclick',toggledivs2);
    		} else if (tab[0].addEventListener) {
    			tab[0].addEventListener('click',toggledivs2, false);
    		}
    		
    	}
    }

}
/* ***********************end drop down menu*********************** */

/* ***********************begin toggle div tags***********************  */
function toggledivs() {
  var inc, endInc=arguments.length;
  for (inc=0; inc<endInc; inc+=2) {
    var id = arguments[inc];
    if (arguments[inc+1] == 'none') param = "none";
    else if(arguments[inc+1]=='block') param = "block";
    if (document.layers) document.layers['container'].layers[id].visibility = param;
    else if (document.all) eval("document.all." + id + ".style.display = \"" + param + "\"");
    else if (document.getElementById) eval("document.getElementById(id).style.display = \"" + param + "\"");
  }
}

function toggletabs(caller) {
}
function toggledivs2(e) {
	
	var caller = e;//.srcElement;//this.event.srcElement;
	var uls = caller.parentNode.parentNode;
	var tabs = uls.parentNode.parentNode.parentNode;
	var tabcontents = findChild(tabs,"tabs-content");
	if (tabcontents == null) {
		tabcontents = findChildByClass(tabs, "tabs-content");
	}
	//var tablinks = tabcontents.getElementsByTagName("div");
	var alltablinks = tabcontents.childNodes;
	var tablinks = new Array();
	var ctr = 0;
	for (var i=0;i<alltablinks.length;i++) {
		if (alltablinks[i].tagName == "DIV") {
			tablinks[ctr] = alltablinks[i];
			ctr = ctr + 1;
		}
	}
	
	ctr = 0;
	for(var i=0;i<uls.childNodes.length;i++) {		
		if (uls.childNodes[i].tagName == "LI") {
			 
			 	var tabid =tablinks[ctr].id;
			 	ctr = ctr + 1;
				if (uls.childNodes[i] == caller.parentNode) {
						uls.childNodes[i].className="on";
						toggledivs(tabid,"block");
				} else {
					uls.childNodes[i].className=null;
					toggledivs(tabid,"none");
				}
			 
		}
	}
}

function findChild(parentNode, childName) {
	for (var i=0;i < parentNode.childNodes.length;i++) {
			if (parentNode.childNodes[i].id==childName) {
				return parentNode.childNodes[i];
			}
	}
	return null;
}

function findChildByClass(parentNode, childName) {
	for (var i=0;i < parentNode.childNodes.length;i++) {
			if (parentNode.childNodes[i].className == childName) {
				return parentNode.childNodes[i];
			}
	}
	return null;
}

function togglevisibility() {
  var inc, endInc=arguments.length;
  for (inc=0; inc<endInc; inc+=2) {
    var id = arguments[inc];
    if (arguments[inc+1] == 'hidden') param = "hidden";
    else if(arguments[inc+1]=='visible') param = "visible";
    if (document.layers) document.layers['container'].layers[id].visibility = param;
    else if (document.all) eval("document.all." + id + ".style.visibility = \"" + param + "\"");
    else if (document.getElementById) eval("document.getElementById(id).style.visibility = \"" + param + "\"");
  }
}
/* ***********************end toggle div tags***********************  */

/* ***********************Begin siteurl*********************** */
var siteurl = '/';
// string to look for in the url
var keyword = 'devsite/';
// get the starting position of the string
var keywordPos = location.href.indexOf(keyword);
// gather everything in the url up to and including the keyword
if (keywordPos != -1) siteurl = location.href.substr(0, keywordPos+keyword.length);
/* ***********************end siteurl*********************** */

/* ***********************Begin Flash*********************** */
function activateFlash(swfURL) {
	if ( plugin ) {   
				var width = '901';
				var height = '74';
				var bgcolor = '#FFF';
				document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" id="flash_ad" width="' + width + '" height="' + height + '">');
			 	document.write('<param name="movie" value="' + swfURL + '" />');
				document.write('<param name="quality" value="autohigh" />');
				document.write('<param name="menu" value="false" />');
				document.write('<param name="wmode" value="transparent" />');
				document.write('<param name="bgcolor" value="' + bgcolor + '" />');
				document.write('<embed src="' + swfURL + '" quality="autohigh" swLiveConnect="false" width="' + width + '" height="' + height + '"  wmode="transparent" bgcolor="' + bgcolor + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" menu="false"></embed>');
				document.write('</object>');
			}
			else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)){
				document.write('<img src="images/ui02/home/customers.gif" alt="" />');
			}
}
/* ***********************End Flash*********************** */

/* ***********************BEGIN Compensation Calculator*********************** */
// Start date used for compensation payment calculations
var calculationStartDate = new Date(2006, 1, 1);
// Save the jQuery object once we get it to run faster
var $compensationSpan = null;

// Take a date and determine how many dollars of compensation
// have been payed out since then.
var dollarsToDate = function(aDate)
{
  if (!aDate)
    aDate = new Date();
  
  var msDiff = aDate.getTime() - calculationStartDate.getTime();
  return Math.round(0.2610225183 * msDiff + 18681129742);
};


// Add commas to a long number to make it more readable.
var addCommas = function(aNumber)
{
  // Convert our number to an array and reverse it so that
  // we can easily work from most significant digits down
  // to least significant
  var bitsR = (aNumber.toString().split('')).reverse();
  for (var i = bitsR.length - 1; i>2; i--)
    if (i % 3 == 0)
      bitsR.splice(i, 0, ',');
  // Return our array with commas added back to the proper order
  // for display on the screen.
  return bitsR.reverse().join('');
};

// Update the compensation value displayed on the screen.
// This is wrapped in its own function to make it easier
// to call on an interval
var updateCompensation = function()
{
  // Creating an array and joining is faster than string concatenation
  $compensationSpan.html(['US $', addCommas(dollarsToDate())].join(''));
};

// Only run if jQuery is available
if (window.jQuery)
{
  $(function() {
    // Save the jQuery object for faster access later
    $compensationSpan = $('#CompensationCounter span');
    // Initial display of information
    updateCompensation();
    // Periodic update to refresh the number in milliseconds
    setInterval(updateCompensation, 50);
  });  
}
/* ***********************END Compensation Calculator*********************** */

/* ***********************BEGIN Platform Graphic*********************** */
// Fix background image flickering in IE
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) { }

// Only run if jQuery is available
if (window.jQuery)
{
  $(function() {	
  	$('area.nolink').click(function() { return false; });
  });
}
/* ***********************END Platform Graphic*********************** */
