// -------------------------------------------------------
// BDDS Specific Functions
// -------------------------------------------------------

// Mobile/PDA detection
isMobile = 0;
if (	(navigator.appVersion.indexOf("Windows CE") > 0) ||
		(navigator.appVersion.indexOf("Palm OS") > 0) )
{
	isMobile = 1;
}


// URL builder for PDA
function mobileSearch () {
	window.location = "/ds/productCenter/" + document.SrchMobile.qtmobile.value + ".asp";
}


// Banner image rotation code
NumberOfImagesToRotate = 6;
FirstPart = '<td rowspan="2" height="87" width="583" style="background: url(\'/ds/images/imgheader-bg-right';
LastPart = '.jpg\')">&nbsp;</td>';

function writeRotatingImage() {
	var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
	document.write(FirstPart + r + LastPart);
}


// Expanding/collapsing sections of pages
function showTab(n)
{
	document.getElementById("d1").style.display = "none";
	document.getElementById("d2").style.display = "none";
	document.getElementById("d3").style.display = "none";
	document.getElementById("d4").style.display = "none";
	document.getElementById(n).style.display = "block";

}	

function toggleText(n)
{
	shortID = document.getElementById(n+"_short");
	fullID = document.getElementById(n+"_full");

  if (shortID.style.display == "none") {
     shortID.style.display = "block";
     fullID.style.display = "none";
  } else {
     shortID.style.display = "none";
     fullID.style.display = "block";
  } 	
}



// -------------------------------------------------------
// BD Global Functions
// -------------------------------------------------------

isLoaded = 0;

function rolloverbg(cellId,bgc) {
	cellId1 = cellId + "a";
	cellId2 = cellId + "b";
	if (document.getElementById) {
		document.getElementById(cellId1).style.background = bgc;
		document.getElementById(cellId2).style.background = bgc;
	} else if (document.all) {
		eval(cellId1).style.background = bgc;
		eval(cellId2).style.background = bgc;
	}
}

function printpage() {
	window.print();
}

function bookmarkpage(title, url) {
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	}
	else if (window.external) { // IE Bookmark
		window.external.AddFavorite(url, title);
	}
	else {
		alert("Your browser does not support this feature.  Please use the bookmark feature of your browser to save the location of this page.");
	}
	
}



function reDo(){ window.location.reload() }

if (document.layers) {
	origWidth=innerWidth;
	origHeight=innerHeight;
	onresize=function() { if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload() }
} else {
    window.onresize = reDo;
}

// Once page is loaded, set variable to allow DHTML menus to be activated
function pageLoaded() {
	isLoaded = 1; 
}

// Check that page is loaded, otherwise do nothing
function homeActivateLayers(div,act) {
	if (isLoaded == 1) {
		homeShowHideLayers(div,act)
	}
}

// DHTML Menu Functions
function homeSetHideTimeout() {
  if (this.hideTimer) { clearTimeout(this.hideTimer); }
  this.hideTimer = setTimeout('homeHideAllLayers()', 1000);
}

function homeClearHideTimeout() {
  if (this.hideTimer) clearTimeout(this.hideTimer);
}

function homeHideAllLayers() {
	if (document.getElementById) {
		if (document.getElementById('bdworldwide')) document.getElementById('bdworldwide').style.visibility="hidden";
	} else if (navigator.appName == 'Netscape' && document.layers != null) {
		if (document.layers['bdworldwide']) document.layers['bdworldwide'].visibility = 'hide';
    } else if (document.all != null) {
		if (document.all['bdworldwide']) document.all['bdworldwide'].style.visibility = 'hidden';
	}
}

function homeShowHideLayers() {
  homeClearHideTimeout();
  var i, visStr, args, theObj;
  args = homeShowHideLayers.arguments;
  for (i=0; i<(args.length-1); i+=2) {
    visStr   = args[i+1];
	if (document.getElementById) {
       if (visStr == 'show') visStr = 'visible';
       if (visStr == 'hide') visStr = 'hidden';
 	   document.getElementById(args[i]).style.visibility=visStr;
    } else if (navigator.appName == 'Netscape' && document.layers != null) {
       document.layers[args[i]].visibility = visStr;
    } else if (document.all != null) {
       if (visStr == 'show') visStr = 'visible';
       if (visStr == 'hide') visStr = 'hidden';
       document.all[args[i]].style.visibility = visStr;
  	}
  }
}

