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_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

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_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];}
}

function openWin(winwidth, winheight, position, url){
	if(position){
		posleft=(screen.width-winwidth)/2
		postop=(screen.height-winheight-40)/2
	}else{
		posleft=0
		postop=0
	}
	if(postop<0){postop=0}
	remote = window.open(url,"win","left="+posleft+",top="+postop+",width="+winwidth+",height="+winheight+",directories=no,scrollbars=no,status=no,toolbar=no,menubar=no,location=left,resizable=no");
	if (remote.opener == null){
		remote.opener = window;
	}else{
		remote.focus();
	}
	remote.opener.name = "opener";
}

var htmlCodeFlash1 = new String()
var htmlCodeFlash2 = new String()
var htmlCodeFlash3 = new String()
htmlCodeFlash1 = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='600' height='258'>\n"
htmlCodeFlash1 += "<param name='movie' value='flash/"
htmlCodeFlash2 = "'>\n<param name=quality value=high>\n<param name='BGCOLOR' value='#000000'>\n<embed src='flash/"
htmlCodeFlash3 = "' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='600' height='258'></embed>\n"
htmlCodeFlash3 += "</object><br>"

var mainIdVal;

//myflash = new Array("n22-fl.swf","n5-save.swf","n25-gas.swf");
//flashlength = myflash.length

function playFlash(thisFlash)
{
	layerName = "flashro"
//	if(thisAd == flashlength)thisAd = 0

	myflash = "main-banner9.swf"
	if(thisFlash){
		myflash = "MAIN-MIN-" + thisFlash + ".swf"
	}
	
	if (!thisFlash) {
		mainIdVal = setTimeout("switchFlash(myflash)", 5);
	}
	else {
		clearTimeout(mainIdVal);
		idval = setTimeout("switchFlash(myflash)", 1);
	}
}

function switchFlash(myflash)
{
	//alert(myflash);
	
	htmlCode = htmlCodeFlash1 + myflash + htmlCodeFlash2 + myflash + htmlCodeFlash3
	if (document.getElementById) // Netscape 6 and IE 5.x
	{
		if (window.HTMLElement) // Netscape 6 has this
		{
			spanNode = document.getElementById(layerName);
			
			while (spanNode.hasChildNodes()) 
			{
				spanNode.removeChild(spanNode.lastChild);
			}
				
			var range = document.createRange();
			
			range.selectNodeContents(spanNode);
			spanNode.appendChild(range.createContextualFragment(htmlCode));
		}
		else // otherwise, it's IE
		{
			document.all(layerName).innerHTML = htmlCode;
		}
	}
	else if (document.layers) // Netscape 4.x
	{
		var layer = document.layers[layerName];
		
		layer.document.open();
		layer.document.write(htmlCode);
		layer.document.close();
	}
	else if (document.all) // IE 4.x
	{
		document.all[layerName].innerHTML = htmlCode;
	}
}

function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v>=5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.min = (this.ns||this.ie)
}

function findcenter(){
	is = new BrowserCheck();
	
	if(is.ns) {
		f_width=innerWidth-16;
	}
	else if(is.ie) {
		f_width=document.body.clientWidth;
	}
	
	f_left = f_width/2 - 392;
	if (f_left < 0) {
		f_left = 0
	}
	
	return f_left;
}

var btnLastOnButton;

function btnTurnAllOff() {
	// Sets all the navigation buttons to their default off state.
	
	// Find which button is currently on and turn it off. Remember
	// the button that was turned on before.
	var regExpObj = /-r.gif/;
	if (document.n1.src.match(regExpObj) ) {
		btnLastOnButton = document.n1.name;
		document.n1.src = 'graphics/p-b1-single-u.gif';
	}
	else if (document.n2.src.match(regExpObj) ) {
		btnLastOnButton = document.n2.name;
		document.n2.src = 'graphics/p-b2-multi-u.gif';
	}
	else if (document.n3.src.match(regExpObj) ) {
		btnLastOnButton = document.n3.name;
		document.n3.src = 'graphics/p-b3-pail-u.gif';
	}
	else if (document.n4.src.match(regExpObj) ) {
		btnLastOnButton = document.n4.name;
		document.n4.src = 'graphics/p-b4-pall-u.gif';
	}
	else if (document.n5.src.match(regExpObj) ) {
		btnLastOnButton = document.n5.name;
		document.n5.src = 'graphics/p-b5-depall-u.gif';
	}
	else if (document.n6.src.match(regExpObj) ) {
		btnLastOnButton = document.n6.name;
		document.n6.src = 'graphics/p-b6-conye-u.gif';
	}
	else if (document.n7.src.match(regExpObj) ) {
		btnLastOnButton = document.n7.name;
		document.n7.src = 'graphics/p-b7-rinse-u.gif';
	}
	else if (document.n8.src.match(regExpObj) ) {
		btnLastOnButton = document.n8.name;
		document.n8.src = 'graphics/p-b8-label-u.gif';
	}
	else if (document.n9.src.match(regExpObj) ) {
		btnLastOnButton = document.n9.name;
		document.n9.src = 'graphics/p-b9-staker-u.gif';
	}
	else if (document.n10.src.match(regExpObj) ) {
		btnLastOnButton = document.n10.name;
		document.n10.src = 'graphics/p-b10-palet-u.gif';
	}
	else if (document.n11.src.match(regExpObj) ) {
		btnLastOnButton = document.n11.name;
		document.n11.src = 'graphics/p-b11-case-u.gif';
	}
}

function btnRestore() {
	// Restores all the navigation buttons to their values before
	// the user rolled-over the last button.
	
	if (document.n1.name == btnLastOnButton ) {
		document.n1.src = 'graphics/p-b1-single-r.gif';
	}
	else if (document.n2.name == btnLastOnButton ) {
		document.n2.src = 'graphics/p-b2-multi-r.gif';
	}
	else if (document.n3.name == btnLastOnButton ) {
		document.n3.src = 'graphics/p-b3-pail-r.gif';
	}
	else if (document.n4.name == btnLastOnButton ) {
		document.n4.src = 'graphics/p-b4-pall-r.gif';
	}
	else if (document.n5.name == btnLastOnButton ) {
		document.n5.src = 'graphics/p-b5-depall-r.gif';
	}
	else if (document.n6.name == btnLastOnButton ) {
		document.n6.src = 'graphics/p-b6-conye-r.gif';
	}
	else if (document.n7.name == btnLastOnButton ) {
		document.n7.src = 'graphics/p-b7-rinse-r.gif';
	}
	else if (document.n8.name == btnLastOnButton ) {
		document.n8.src = 'graphics/p-b8-label-r.gif';
	}
	else if (document.n9.name == btnLastOnButton ) {
		document.n9.src = 'graphics/p-b9-staker-r.gif';
	}
	else if (document.n10.name == btnLastOnButton ) {
		document.n10.src = 'graphics/p-b10-palet-r.gif';
	}
	else if (document.n11.name == btnLastOnButton ) {
		document.n11.src = 'graphics/p-b11-case-r.gif';
	}
}
function beepIt(){
	document.getElementById('mySound').src="sound15.mp3";
}

i=Math.floor(Math.random()*4)+1
document.write("<style>")
document.write(".randombg { background-image: url('graphics/p-bkgd-"+i+".jpg'); background-repeat: no-repeat; background-color: #FFFFFF}")
document.write("</style>")
