// Functions
// Author:                Mathew Gritt
// Contributors:          Nathan Young
function switchid(id){    
    hideallids();
    showdiv(id);
}
function hideallids(){
    //loop through the array and hide each element by id
    for (var i=0;i<ids.length;i++){
        hidediv(ids[i]);
    }          
}
function hidediv(id) {
    //safe function to hide an element with a specified id
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'none';
    }
    else {
        if (document.layers) { // Netscape 4
            document.layers[id].style.display = 'none';
        }
        else { // IE 4
            document.all.id.style.display = 'none';
        }
    }
}
function showdiv(id) {
    //safe function to show an element with a specified id
          
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'block';
    }
    else {
        if (document.layers) { // Netscape 4
            document.layers[id].style.display = 'block';
        }
        else { // IE 4
            document.all.id.style.display = 'block';
        }
    }
}


var gAutoPrint = true; // Tells whether to automatically call the print function

function printSpecial(DivID)
{
if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';

if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName("head");
var titleHeader = document.getElementsByTagName("title")

if (headTags.length > 0)
html += '<title>' + titleHeader[0].innerHTML + '</title>';
html += '<link rel="stylesheet" type="text/css" href="/font-00.css" media="all" title="f00" />'
html += '<link rel="stylesheet" type="text/css" href="/print.css" media="all"  />'

}

html += '\n</HEAD>\n<BODY>\n';

var printReadyElem = document.getElementById(DivID);
var strBody = printReadyElem.innerHTML;

//remove script tags.
var scriptList = printReadyElem.getElementsByTagName("script")


var x
for (x in scriptList) {
	strBody = strBody.replace(scriptList[x].src,"");
	strBody = strBody.replace(scriptList[x].text,"");
}

strBody = strBody.replace("<SCRIPT src=\"\" type=text/javascript></SCRIPT>","");
strBody = strBody.replace("<SCRIPT src=\"\" type=text/javascript></SCRIPT>","");
strBody = strBody.replace("<SCRIPT language=JavaScript src=\"\" type=text/javascript></SCRIPT>","");





if (printReadyElem != null)
{
html += strBody;
}
else
{

alert("Cannot find print function");

}

html += '\n</BO>\n</HT>';

var printWin = window.open("","printSpecial");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();

if (gAutoPrint)
printWin.print();
}
else
{
alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
}
}


