// JavaScript Document
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
var oldTab = 'tab1';
var tabButton = 'button_tab1_welcome';
var oldSub1 = 'subtab_welcome';
var oldSub2 = 'subtab_overview';
function showTab(tab)
	{
	if(oldTab == tab) return false;
	//alert('Old: '+oldTab);
	//alert('New: '+tab);
	if(tab == 'tab1')
		{
		html = document.getElementById('mainTab2').innerHTML;
		html = html.replace('On.gif','Off.gif');
		document.getElementById('mainTab2').innerHTML = html;
		
		html = document.getElementById('mainTab1').innerHTML;
		html = html.replace('Off.gif','On.gif');
		document.getElementById('mainTab1').innerHTML = html;
		showSubSection('subtab_welcome', document.getElementById('button_tab1_welcome'));
		oldSub1 = 'subtab_welcome';
		}
	else if(tab == 'tab2')
		{
		html = document.getElementById('mainTab1').innerHTML;
		html = html.replace('On.gif','Off.gif');
		document.getElementById('mainTab1').innerHTML = html;
		
		html = document.getElementById('mainTab2').innerHTML;
		html = html.replace('Off.gif','On.gif');
		document.getElementById('mainTab2').innerHTML = html;
		showSubSection('subtab_overview', document.getElementById('button_tab2_overview'));
		oldSub1 = 'subtab_overview';
		}
	else
		{
		
		}
		
	document.getElementById(tab).className = "mastheadFullBackground_visible";
	document.getElementById(oldTab).className = "mastheadFullBackground_hidden";
	oldTab = tab;
	}
function doSubSelection(subSection, id)
	{
	
	}
	
function showSubSection(subSection, elem)
	{
	//alert(oldSub1);
	id = elem.id;
	elem = document.getElementById(id);
	//alert("oldSub1 = "+oldSub1+", subSection = "+subSection+", elem.id = "+elem.id+", tabButton = "+tabButton);
	if(oldSub1 == subSection || elem.id == tabButton) return true;
	
	// Change background of new image
	html = elem.innerHTML
	html = html.replace('Off.gif','On.gif');
	elem.innerHTML = html;
	//alert(html);
	// Change background of old image
	// alert(tabButton);
	html = document.getElementById(tabButton).innerHTML;
	html = html.replace('On.gif','Off.gif');
	document.getElementById(tabButton).innerHTML = html;
	// Send new one to top
	//alert(subSection);
	newSec = document.getElementById(subSection);
	newSec.className = "subtab_visible";
	// move it down
	//moveDown(subSection, -300, 0, 300);
	
	oldSec = document.getElementById(oldSub1);
	//moveDown(oldSub1, 0, 300, 300);
	
	//document.getElementById(subSection).className = "subtab_visible";
	oldSec.className = "subtab_hidden";
	oldSub1 = subSection;
	tabButton = elem.id;
	}

function showSubscribe(status)
	{
	if(status == true)
		{
		document.getElementById('subscribeBox').style.display = 'block';
		}
	else
		{
		document.getElementById('subscribeBox').style.display = 'none';
		}
	}

function getParentNode(node)
	{
	var node = node;
	var parent = node.parentNode;
	if(!parent) return false;
	tag = parent.tagName;
	tagLower = tag.toLowerCase();
	if(tagLower == 'body'){document.getElementById("testDisplay").innerHTML = parent;}
	theID = parent.id;
	if(theID == 'subscribeBox'){document.getElementById("testDisplay").innerHTML = parent;}
	getParentNode(parent);
	}

function whichElement(e)
	{
	var targ
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
	   targ = targ.parentNode;
	var tname;
	tname=targ.id;
	//getParentNode(targ);
	//document.getElementById("testDisplay").innerHTML = status;
	}

function delay(onOff) {
if(onOff == 'off') {
var k = window.setTimeout('hideBox(\'subscribeWrapper\')',2000);
}
if(onOff == 'on') {
clearTimeout(k);	
}
}

function showBox(id) {
	//safe function to show an element with a specified id
	
		  
	if(document.getElementById) { // DOM3 = IE5, NS6
	
		document.getElementById(id).style.display = "block";
		document.getElementById('email').style.background = '#fff url(\'/lib/images/global/backgroundSignup.gif\') no-repeat top left';
		document.getElementById('rss').style.background = '#fff url(\'/lib/images/global/backgroundSignup.gif\') no-repeat top right';
		document.getElementById('rssLink').style.color = '#333';
		document.getElementById('emailLink').style.color = '#333';
	}
	else {
		if(document.layers) { // Netscape 4
			document.id.display = "block";
			document.email.background = '#fff url(\'/lib/images/global/backgroundSignup.gif\') no-repeat top left';
			document.rss.background = '#fff url(\'/lib/images/global/backgroundSignup.gif\') no-repeat top right';
			document.rssLink.color = '#333';
			document.emailLink.color = '#333';
		}
		else { // IE 4
			document.all.id.style.display = "block";
			document.all.email.style.background = '#fff url(\'/lib/images/global/backgroundSignup.gif\') no-repeat top left';
			document.all.rss.style.background = '#fff url(\'/lib/images/global/backgroundSignup.gif\') no-repeat top right';
			document.all.rssLink.color = '#333';
			document.all.emailLink.color = '#333';
		}
	}
}

function hideBox(id) {
	//safe function to show an element with a specified id
		  
	if(document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = "none";
		document.getElementById('email').style.background = '#455560';
		document.getElementById('rss').style.background = '#455560';
		document.getElementById('rssLink').style.color = '#fff';
		document.getElementById('emailLink').style.color = '#fff';
	}
	else {
		if(document.layers) { // Netscape 4
			document.id.display = "none";
			document.email.background = '#455560';
			document.rss.background = '#455560';
			document.rssLink.color = '#fff';
			document.emailLink.color = '#fff';
		}
		else { // IE 4
			document.all.id.style.display = "none";
			document.all.email.style.background = '#455560';
			document.all.rss.style.background = '#455560';
			document.all.rssLink.color = '#fff';
			document.all.emailLink.color = '#fff';
		}
	}
}

function validate(whatFields) {
var theFields = whatFields.split(',');
thevalue = document.offerForm.theFields[0];
alert(thevalue.value);
return false;
}


var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight){
	
	closeWin();
	
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 10;
	}
	
	var tools="";
	if (type == "standard") tools = "resizable=yes,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "fullScreen") tools = "resizable=yes,toolbar=no,location=no,menubar=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=0,top=0";
	if (type == "console1") tools = "resizable=yes,toolbar=no,location=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=0,top=0";
        if (type == "console2") tools = "resizable=yes,toolbar=yes,location=no,menubar=yes,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=0,top=0";
        if (type == "console3") tools = "resizable=no,toolbar=no,location=no,menubar=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

