/*
	tableruler()
	written by Chris Heilmann for alistapart.
	enables a rollover of rows for each table with the classname "hlrows"
*/

function tableruler()
{
	if (document.getElementById && document.createTextNode)
	{
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++)
		{
			if(tables[i].className=='contenttable')
			{
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++)
				{
					if(trs[j].parentNode.nodeName=='TBODY')
					{
						trs[j].onmouseover=function(){this.className='ruled-2';return false}
						trs[j].onmouseout=function(){this.className='bottomborder-2';return false}
					}
				}
			}
		}
	}
}

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 flevDivPositionValue(sDivID, sPositionProperty) { // v1.0, Marja Ribbers-de Vroed  
    var sPositionValue;
	// ***** W3C Compatible DOM (NN6, Mozilla 16, etc.) ***** 
    if (document.getElementById && !document.all) { //W3C DOM compliant 
       var docObj = document.getElementById(sDivID); 
		if (document.defaultView != null) { // NS6+ alike 
			sPositionValue = document.defaultView.getComputedStyle(docObj, "").getPropertyValue(sPositionProperty); 
			} 
		else { // Opera 5 alike 
			if (sPositionProperty == "height") { sPositionValue = docObj.style.pixelHeight; } 
			else if (sPositionProperty == "width") { sPositionValue = docObj.style.pixelWidth; } 
			else { sPositionValue = eval("docObj.style." + sPositionProperty); } 
			} 
		if(sPositionValue == "" || sPositionValue == undefined) { sPositionValue = "0"; }
    	} 
    // ***** Netscape Navigator 4+ DOM ***** 
    else if (document.layers) { //NS4+ DOM compliant 
		var docObj = eval("MM_findObj('" + sDivID + "')"); 
		if ((sPositionProperty == "width") || (sPositionProperty == "height")) { sPositionValue = eval("docObj.clip." + sPositionProperty); } 
		else { sPositionValue = eval("docObj." + sPositionProperty); } 
		if(sPositionValue == "" || sPositionValue == undefined) { sPositionValue = "0"; }
    	} 
    // ***** Internet Explorer 4+ DOM ***** 
    else if (document.all) { //IE4+ DOM compliant 
		if (sPositionProperty == "width") { sPositionValue = eval(sDivID + ".offsetWidth"); } 
		else if (sPositionProperty == "height") { sPositionValue = eval(sDivID + ".offsetHeight"); } 
		else if (sPositionProperty == "top") { sPositionValue = eval(sDivID + ".offsetTop"); } 
		else if (sPositionProperty == "left") { sPositionValue = eval(sDivID + ".offsetLeft"); } 
		if(sPositionValue == "" || sPositionValue == undefined) {
			sDiv = document.getElementById(sDivID);
			if (sPositionProperty == "width") { sPositionValue = sDiv.offsetWidth; } 
			else if (sPositionProperty == "height") { sPositionValue = sDiv.offsetHeight; } 
			else if (sPositionProperty == "top") { sPositionValue = sDiv.offsetTop; } 
			else if (sPositionProperty == "left") { sPositionValue = sDiv.offsetLeft; } 
			if(sPositionValue == "" || sPositionValue == undefined) {
				sPositionValue = "0";
				//if (sPositionProperty == "top") { alertonce(sDivID+"-"+document.getElementById(sDivID).offsetTop); } 
				}			
			}
    	} 
	if (isNaN(sPositionValue)) { if (sPositionValue.indexOf('px') > 0) { sPositionValue = sPositionValue.substring(0,sPositionValue.indexOf('px')); } } 
	return parseInt(sPositionValue); 
}

var alerted = false
function alertonce(msg){
	if(!alerted) {
		alerted = true;
		alert(msg);
	}
}

function flevMoveDiv(sDivID, sLeft, sTop){ // v1.0, Marja Ribbers-de Vroed 
	if(document.getElementById && document.getElementById(sDivID).style != undefined){
		document.getElementById(sDivID).style.top = sTop;
		document.getElementById(sDivID).style.left = sLeft;
	} else{
		var	docObj = eval("MM_findObj('" + sDivID + "')"); 
		if (document.layers) { // NS4.x 
			eval("docObj.top = '" + sTop + "'"); 
			eval("docObj.left = '" + sLeft + "'"); 
		} else { // all others 
			eval("docObj.style.top = '" + sTop + "'"); 
			eval("docObj.style.left = '" + sLeft + "'"); 
		} 
	}
}

function flevAutoScrollDivs() { // v1.0, Marja Ribbers-de Vroed   
	var iArgs = flevAutoScrollDivs.arguments.length;   
	var sContainerDivID = 'AutoScrollContainer';   
	var sContentDivID = 'AutoScrollContent';
  
	if(document.getElementById(sContentDivID) == false) return false;    
	if(MM_findObj(sContentDivID) == null) return false;

	var iStartScrolling = (iArgs > 0) ? parseInt(flevAutoScrollDivs.arguments[0]) : 1;  
	var iPixels = (iArgs > 1) ? parseInt(flevAutoScrollDivs.arguments[1]) : 1;   
	var iDelay = (iArgs > 2) ? parseInt(flevAutoScrollDivs.arguments[2]) : 35;   
	var iCurrentTop = flevDivPositionValue(sContentDivID, 'top');   
	var iScrollTop = (-1 * flevDivPositionValue(sContentDivID, 'height'));   
	var iScrollBottom = flevDivPositionValue(sContainerDivID, 'height');   
	var iCurrentLeft = flevDivPositionValue(sContentDivID, 'left');  
	if (iStartScrolling) {   
		if (iCurrentTop != iScrollTop) {flevMoveDiv(sContentDivID, String(iCurrentLeft), String(iCurrentTop-iPixels));}	// Continue scrolling   
		else {flevMoveDiv(sContentDivID, String(iCurrentLeft), String(iScrollBottom));}	// Re-position scrolling layer at bottom of containing layer  
		flevTimeoutID = setTimeout("flevAutoScrollDivs(" + iStartScrolling + "," + iPixels + "," + iDelay + ")", iDelay);   
	}   
	else if (flevTimeoutID != null) {clearTimeout(flevTimeoutID);}
}

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_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_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];}
}
