var isIE4 = false; // Microsoft internet explorer
var isNS4 = false; // Netscape 4+
var isW3C = false; // W3C compliant (inc NS6)
var isUnknown = true; // in case something else comes along

	if (document.getElementById) {
	isW3C = true ;	// NS6, MSIE 5+, Mozilla, Opera 6 in Opera (W3C) mode
	isUnknown = false;
	}
	if (isW3C != true && document.all) {
	isIE4 = true ;	// MSIE (all versions) and Opera 6 in MSIE 5 mode
	isUnknown = false;
	}
	if (document.layers) {
	isNS4 = true ;	// NS 4
	isUnknown = false;
	}
	
if(isUnknown == true) { location.href = "http://www.screen-time.com/shop_cart/alternate_pricing.php" }

function showDs(id) 
{
	if (isNS4){
	block = document.layers[id];
	block.visibility = "visible";		
	}
	else if (isIE4) {
  	block = document.all[id];
	block.style.visibility = "visible";
	}
	else if (isW3C) {
  	block = document.getElementById(id);
	block.style.visibility = "visible";
	document.getElementById(id).style.display = '';
	}

}


function hideDs(id) {

	if (isNS4){
  	 block = document.layers[id];
	block.visibility = "hidden";
	}
	else if (isIE4) {
  	block = document.all[id];
	block.style.visibility = "hidden";
	}
	else if (isW3C) {
  	block = document.getElementById(id);
	block.style.visibility = "hidden";
	document.getElementById(id).style.display = 'none';
	}
}

function showHide(elementid)
{
	if (document.getElementById(elementid).style.display == 'none')
	{
		document.getElementById(elementid).style.display = '';
	}
		 else
		 {
			document.getElementById(elementid).style.display = 'none';
		}
}


function format(exp, decplaces)
{ 
	if ( isNaN(exp) == false ) 
	{
		var str = "" + Math.round (eval(exp) * Math.pow(10,decplaces))
		while (str.length <= decplaces) 
		{
		str = "0" + str
		}
		var decpoint = str.length - decplaces ;
		str = str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
		str = addCommas(str); 
		return str ;
	}
}

function addCommas(nStr)
{
 nStr += '';
  x = nStr.split('.');
  x1 = x[0];
  x2 = x.length > 1 ? '.' + x[1] : '';
  var rgx = /(\d+)(\d{3})/;
  while (rgx.test(x1)) {
    x1 = x1.replace(rgx, '$1' + ',' + '$2');
  }
  return x1 + x2;
}


var win=null;
function popup(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random")
	{
	LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
	TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center")
	{
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null)
	{
	LeftPosition=0;TopPosition=20
	}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes'; 
win=window.open(mypage,myname,settings);
win.focus() ;
} 

function noenter() // prevents users from submitting a form with a cr
{
  return !(window.event && window.event.keyCode == 13); 
 }

function showDate()
{
	// it's in the external js file but ie6(mac) doesn't seem to like it.
	var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	
	// Array of month Names
	var monthNames = new Array(
	"January","February","March","April","May","June","July","August","September","October","November","December");
	
	var now = new Date();
	var showIt = (dayNames[now.getDay()] + ", " + 
	monthNames[now.getMonth()] + " " + 
	now.getDate() + ", " + now.getFullYear());
	
	return showIt
}

function format (exp, decplaces)
{ 
	if ( isNaN(exp) == false ) 
	{
		var str = "" + Math.round (eval(exp) * Math.pow(10,decplaces))
		while (str.length <= decplaces) 
		{
		str = "0" + str
		}
		var decpoint = str.length - decplaces ;
		return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
	}
}

function setImageUrl(pic,url)
{
	eval("document." + pic + ".src = url")
}
//netscape css fix

if (document.layers) onresize=doReload 
	function doReload(){ 
	document.location=document.location 
}