// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

//ns4 resize fix
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//set status bar
function setStatusBar(msgStr) { self.status = msgStr; }

// detect browser version
var ie4 = document.all;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all; 

// Example:
// var b = new BrowserInfo();
// alert(b.version); 
function BrowserInfo()
{
  this.name = navigator.appName;
  this.codename = navigator.appCodeName;
  this.version = navigator.appVersion.substring(0,4);
  this.platform = navigator.platform;
  this.javaEnabled = navigator.javaEnabled();
  this.screenWidth = screen.width;
  this.screenHeight = screen.height;
}


// * Dependencies * 
// this function requires the following snippet:
// JavaScript/readable_MM_functions/findObj
function setColor(objName, fg, bg)
{
  obj = findObj(objName);
  if (obj.style)
  {
    obj.style.color = fg;
    obj.style.backgroundColor = bg;
  }
}

//category navigation menu initial style and rollover
function catNav_over(objName)
{
  obj = findObj(objName);
  if (obj.style)
  {
    obj.style.color = '#FFFFFF';
    obj.style.backgroundColor = '#666666';
	obj.style.fontFamily = 'verdana,sans-serif';
	obj.style.fontWeight = 'bold';
	obj.style.fontSize = '10';
	obj.style.padding = '3 10 3 10';
	obj.style.margin = '0 0 0 0';
	obj.style.borderStyle = 'solid';
	obj.style.borderWidth = '0 1 1 0';
	obj.style.borderColor = '#CCCCCC';
	obj.style.cursor = 'hand';
  }
}

function catNav_init(objName)
{
  obj = findObj(objName);
  if (obj.style)
  {
    obj.style.color = '#666666';
    obj.style.backgroundColor = '#FFFFFF';
	obj.style.fontFamily = 'verdana,sans-serif';
	obj.style.fontWeight = 'bold';
	obj.style.fontSize = '10';
	obj.style.padding = '3 10 3 10';
	obj.style.margin = '0 0 0 0';
	obj.style.borderStyle = 'solid';
	obj.style.borderWidth = '0 1 1 0';
	obj.style.borderColor = '#CCCCCC';
	obj.style.cursor = 'hand';
  }
}
//end category navigation menu stuff

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 P7_HScroller(el,dr,tx,ox,spd) { //v1.6 by PVII
	var g;
	var gg;
	var fr;
	var sp;
	var pa = '';
	var slw = true;
	var m = false;
	var w;
	var ww;
	var lx;
	var rx;

	tx=parseInt(tx);
	if ((g = MM_findObj(el)) != null) {
		gg = (document.layers) ? g : g.style;
	} else {
		return;
	}
	if (dr == "Stop") {
		if (g.toMove) {
			clearTimeout(g.p7Magic);
		}
		g.toMove = false;
	}
	if ((parseInt(navigator.appVersion) > 4 || navigator.userAgent.indexOf("MSIE") > -1) && !window.opera) {
		pa = "px";
	}
	if (navigator.userAgent.indexOf("NT") > -1 || navigator.userAgent.indexOf("Windows 2000") > -1) {
		slw = false;
	}
	if (spd == "Slow") {
		sp = (slw) ? 2 : 1;
		fr = (slw) ? 40 : 30;
	} else if(spd=="Medium") {
		sp = (slw) ? 4 : 1;
		fr = (slw) ? 40 : 10;
	} else {
		//sp = (slw) ? 8 : 4;//original
		sp = (slw) ? 6 : 2;//lj-custom change to script
		fr = (slw) ? 40 : 10;
	}
	if (spd == "Warp") {
		sp = 5000;
	}
	var xx = parseInt(gg.left);
	if (isNaN(xx)) {
		if (g.currentStyle) {
			xx = parseInt(g.currentStyle.left);
		} else if(document.defaultView) {
			xx = parseInt(document.defaultView.getComputedStyle(g,"").getPropertyValue("left"));
		} else {
			xx=0;
		}
	}
	if (document.all || document.getElementById) {
		w = parseInt(g.offsetWidth);
		if (!w) {
			w = parseInt(g.style.pixelWidth);
		}
		if (g.hasChildNodes) {
			for (wx = 0; wx < g.childNodes.length; wx++) {
				ww = parseInt(g.childNodes[wx].offsetWidth);
				if (ww > w) {
					w = ww;
				}
			}
		}
	} else if(document.layers) {
		w = parseInt(g.clip.width);
	}
	lx = tx - w + parseInt(ox);
	rx = tx;
	if (dr == "Right"){
		if (xx > lx) {
			m = true;
			xx -= sp;
			if (xx < lx) {
				xx = lx;
			}
		}
	}
	if (dr == "Left") {
		if (xx < rx) {
			m = true;
			xx += sp;
			if (xx > rx) {
				xx = rx;
			}
		}
	}
	if (dr == "Reset") {
		gg.left = tx + pa;
		if (g.toMove) {
			clearTimeout(g.p7Magic);
		}
		g.toMove=false;
	}
	if (m) {
		gg.left = xx + pa;
		if (g.toMove) {
			clearTimeout(g.p7Magic);
		}
		g.toMove=true;
		eval("g.p7Magic=setTimeout(\"P7_HScroller('" + el + "','" + dr + "'," + tx + "," + ox + ",'" + spd + "')\"," + fr + ")");
	} else {
		g.toMove=false;
	}
}

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_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];}
}

