function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function showDiv(divid) {
   if (document.layers) document.layers[divid].visibility="show";
   else document.getElementById(divid).style.visibility="visible";
}
function hideDiv(divid) {
   if (document.layers) document.layers[divid].visibility="hide";
   else document.getElementById(divid).style.visibility="hidden";
}
function openWindow(url, name) {
	var left = Math.floor( (screen.width - 730) / 2);
	var top = Math.floor( (screen.height - 487) / 2);
	var winParms = "top=" + top + ",left=" + left + ",height=" + 487 + ",width=" + 730 + ",resizable=0,scrollbars=0,status=0";
	var win = window.open(url, name, winParms);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	return win;
}
function activeTab(tabid, maxtab) {
	var filler = "";
	var mid = "";
	if (tabid == 1) {
		document.getElementById('lCap').className="productTabLcapUp";
	} else {
		document.getElementById('lCap').className="productTabLcapDown";
	}
	if (tabid == maxtab) {
		document.getElementById('rCap').className="productTabRcapUp";
	} else {
		document.getElementById('rCap').className="productTabRcapDown";
	}
	for (inx=1; inx <= maxtab; inx = inx + 1) {
		filler = 'filler'+inx;
		midb = 'mid'+(inx-1);
		mid = 'mid'+inx;
		if (tabid == inx) {
			document.getElementById(filler).className="productTabFillerUp";
			if (inx > 1) {
				document.getElementById(midb).className="productTabMidDown";
			}
			if (inx < maxtab) {
				document.getElementById(mid).className="productTabMidUp";
			}
		} else {
			document.getElementById(filler).className="productTabFillerDown";
			if (inx < maxtab) {
				document.getElementById(mid).className="productTabMidMid";
			}
		}
	}
}
function swapTab(id) {
	alert(id);
	var id2 = id + 1;
	var tabx = 'tab' + id;
	var tab2x = 'tab' + id2;
	document.getElementById('tab1').className="btnLTabDown";
	document.getElementById('tab2').className="btnTabDown";
	document.getElementById('tab3').className="btnTabDown";
	document.getElementById('tab4').className="btnTabDown";
	document.getElementById('tab5').className="btnTabDown";
	document.getElementById('tab6').className="btnTabDown";
	document.getElementById('tab7').className="btnTabmDown";
	if(id = 1) {
		document.getElementById('tab1').className="btnLTabUp";
		document.getElementById('tab2').className="btnTabMid";
	} else if (id = 6) {
		document.getElementById('tab6').className="btnTabUp";
		document.getElementById('tab7').className="btnTabmMid";
	} else if (id = 7) {
		document.getElementById('tab7').className="btnTabmUp";
	} else {
		document.getElementById(tabx).className="btnTabUp";
		document.getElementById(tab2x).className="btnTabMid";
	}
}
