<!--

//////////////////// Create/Manage Buttons functions ///////////////////////////
function doMouseOver(btnID){
	document.getElementById(btnID).style.color="#555";
	document.getElementById(btnID).style.cursor="pointer"
}

function doMouseOut(btnID){
	document.getElementById(btnID).style.color="#000";
}

//function CreateBtn(btnText, btnAction, btnColor, btnSize, btnStatus)
//btnText - text on the button
//btnAction - function or action to perform when button pressed
//btnColor - 'blue' or 'grey'
//btnSize - in pixels
//btnStatus - 'Active' or 'Disabled'
function CreateBtn(btnText, btnAction, btnColor, btnSize, btnStatus){
	
	btnColor = btnColor.toLowerCase()
	
	if (btnColor == "blue"){ 
		imgLeft = "/_img/btn/btn-blue-left.gif";
		imgBack = "/_img/btn/btn-blue-back.gif";
		imgRight = "/_img/btn/btn-blue-right.gif";
	}
	if (btnColor == "grey"){ 
		imgLeft = "/_img/btn/btn-gr-left.gif"; 
		imgBack = "/_img/btn/btn-gr-back.gif";
		imgRight = "/_img/btn/btn-gr-right.gif";
	}
	
	// left and right borders = 6px
	btnSize = btnSize - 12;
	
	// replace all spaces in the btnText
	var btnID = btnText
	var expr = / /g
	btnID = btnID.replace(expr, "")+Math.random();

	btnStatus = btnStatus.toLowerCase()

	if (btnStatus == "active"){
		html = ""+
		"<table cellpadding=0 cellspacing=0 border=0>"+
		"<tr onmouseover=doMouseOver('"+btnID+"') onmouseout=doMouseOut('"+btnID+"') onclick="+btnAction+">"+
			"<td><img src="+ imgLeft +" width=6 border=0></td>"+
			"<td background="+ imgBack +" width=" + btnSize + " class=btn-text id=" + btnID + ">" + btnText + "</td>"+
			"<td><img src="+ imgRight +" height=18 width=6 border=0></td>"+
		"</tr>"+
		"</table>";
	} else {
		html = ""+
		"<table cellpadding=0 cellspacing=0 border=0>"+
		"<tr>"+
			"<td><img src="+ imgLeft +" width=6 border=0></td>"+
			"<td background="+ imgBack +" width=" + btnSize + " class=btn-text style='color:#555' id=" + btnID + ">" + btnText + "</td>"+
			"<td><img src="+ imgRight +" height=18 width=6 border=0></td>"+
		"</tr>"+
		"</table>";
	}
	
	document.write(html)	
}

//////////////////// Open new window function ///////////////////////////
// opens new window and centers it on the screen
function openWin(winURL, winName, winWidth, winHeight, scrollBars)
{
	var topVal = Math.floor(screen.height/2 - winHeight/2);
	var leftVal = Math.floor(screen.width/2 - winWidth/2);
	window.open(winURL,winName.replace(/ /g),'width='+winWidth+',height='+winHeight+',location=no,menubar=no,status=yes,toolbar=no,scrollbars='+scrollBars+',resizable=yes,top='+topVal+',left='+leftVal+';');
}

//////////////// New Revision History Table HTML code //////////////////
// returns HTML code of the revision history table
function getNewRevHistoryHTML()
{
	var today = new Date;
	var mm = today.getMonth() + 1; if (mm < 10){ mm = "0" + mm; };
	var dd = today.getDate(); if (dd < 10){ dd = "0" + dd; };
	var yy = today.getYear();
	var sHTML = ''+
		'<P>&nbsp;'+ 
		'<TABLE style="WIDTH: 100%; BORDER-BOTTOM: #c9c9c9 1px solid; BORDER-COLLAPSE: collapse" cellPadding=0>'+
		'<TBODY>'+
		'<TR>'+
		'<TD style="PADDING-BOTTOM: 2px"><span style="font-size:7.5pt;"><b>REVISION HISTORY</b></span></TD>'+
		'</TR>'+
		'</TBODY>'+
		'</TABLE>'+
		'</P>'+
		
		'<TABLE style="BORDER: #c9c9c9 1px solid; BACKGROUND: #ffffff; WIDTH: 100%; BORDER-COLLAPSE: collapse" cellPadding=4>'+
		'<TBODY>'+
		'<TR>'+
		'<TD style="BACKGROUND: #ececec; VERTICAL-ALIGN: top; BORDER: #c9c9c9 1px solid;font-size:7.5pt;font-weight:bold;">'+
		'Rev.</TD>'+
		'<TD style="BACKGROUND: #ececec; VERTICAL-ALIGN: top; BORDER: #c9c9c9 1px solid;font-size:7.5pt;font-weight:bold;">'+
		'Description</TD>'+
		'<TD style="BACKGROUND: #ececec; VERTICAL-ALIGN: top; BORDER: #c9c9c9 1px solid;font-size:7.5pt;font-weight:bold;">'+
		'Date</TD>'+
		'<TD style="BACKGROUND: #ececec; VERTICAL-ALIGN: top; BORDER: #c9c9c9 1px solid;font-size:7.5pt;font-weight:bold;white-space:nowrap">'+
		'Approved</TD></TR>'+
		'<TR>'+
		'<TD style="BACKGROUND: #ffffff; VERTICAL-ALIGN: top; BORDER: #c9c9c9 1px solid;font-size:7.5pt;">'+
		'Preliminary</TD>'+
		'<TD style="VERTICAL-ALIGN: top; BORDER: #c9c9c9 1px solid;font-size:7.5pt;">'+
		'Initial Release</TD>'+
		'<TD style="VERTICAL-ALIGN: top; BORDER: #c9c9c9 1px solid;font-size:7.5pt;">'+mm+'/'+dd+'/'+yy+
		'</TD>'+
		'<TD style="BACKGROUND: #ffffff; VERTICAL-ALIGN: top; BORDER: #c9c9c9 1px solid;font-size:7.5pt;white-space:nowrap">'+
		'</TD></TR></TBODY></TABLE>'
	return sHTML;
}
//-->

//////////////// Gets coockie content //////////////////
function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=")
        if (c_start!=-1){ 
            c_start=c_start + c_name.length+1 
            c_end=document.cookie.indexOf(";",c_start)
            if (c_end==-1) c_end=document.cookie.length 
            return unescape(document.cookie.substring(c_start,c_end)) 
        } 
    }
    return null
}


/////////////// SOP: Displays children if the header clicked //////////////
//headerID - id of the header clicked, divID - id of the div to display children list
function displayChildren(headerID, divID)
{
	if (ob_hasChildren(document.getElementById("id"+headerID)))
	{
		var HTML = "<blockquote style='padding-top:10px;'>", id, list, i
		id = ob_getFirstChildOfNode(document.getElementById("id"+headerID)).id
		var sopN = parseInt(id.replace("id", "")) + 1000;
		
		HTML = HTML + "<a href=index.asp?id="+id+">" + document.getElementById("path_"+id).value + " " + 
		document.getElementById("title_"+id).value + " (SOP# " + sopN + ")</a><br>";
		
		for (i=0;i<ob_getChildCount(document.getElementById("id"+headerID))-1;i++)
		{
			id = ob_getNextSiblingOfNode(document.getElementById(id)).id
			var sopN = parseInt(id.replace("id", "")) + 1000;
			HTML = HTML + "<a href=index.asp?id="+id+">" + document.getElementById("path_"+id).value + " " +
			document.getElementById("title_"+id).value + " (SOP# " + sopN + ")</a><br>";
		}
		document.getElementById(divID).style.display = 'block';						
		document.getElementById(divID).innerHTML = HTML + "</blockquote>";
	}
}