﻿imgout=new Image(16,16);
imgin=new Image(16,16);

/////////////////BEGIN USER EDITABLE///////////////////////////////
	imgout.src="App_Images/expand.gif";
	imgin.src="App_Images/collapse.gif";
///////////////END USER EDITABLE///////////////////////////////////

//this switches expand collapse icons
function filter(imagename,objectsrc)
{
	if (document.images)
		document.images[imagename].src=eval(objectsrc+".src");
}

function collapseAll() {
    if (document.getElementById) {
        var items = document.getElementsByTagName("div");
        for (var i = 0; i < items.length; i++) {
            if (items[i].id.substring(0, 4) == "Comp") {
                filter(("img" + items[i].id), 'imgout');
                items[i].style.display = 'none';
            }
        }
    }
}

function expandAll() {
    if (document.getElementById) {
        var items = document.getElementsByTagName("div");
        for (var i = 0; i < items.length; i++) {
            if (items[i].id.substring(0, 4) == "Comp") {
                filter(("img" + items[i].id), 'imgin');
                items[i].style.display = 'block';
            }
        }
    }
}


//show OR hide funtion depends on if element is shown or hidden
function shoh(id) {
    if (document.getElementById) { // DOM3 = IE5, NS6
        if (document.getElementById(id).style.display == "none") {
            document.getElementById(id).style.display = 'block';
            filter(("img" + id), 'imgin');
        }
        else {
            filter(("img" + id), 'imgout');
            document.getElementById(id).style.display = 'none';
        }
    }
    else {
        if (document.layers) {
            if (document.id.display == "none") {
                document.id.display = 'block';
                filter(("img" + id), 'imgin');
            }
            else {
                filter(("img" + id), 'imgout');
                document.id.display = 'none';
            }
        }
        else {
            if (document.all.id.style.visibility == "none")
                document.all.id.style.display = 'block';
            else {
                filter(("img" + id), 'imgout');
                document.all.id.style.display = 'none';
            }
        }
    }
}
var inPrintPreview = false;

function PrintPreviewMouseOver()
{
    if (document.images)
    {
        if (inPrintPreview)
            document.images["BtnPrintPreview"].src="App_Images/navigate_back_over.gif";
        else
            document.images["BtnPrintPreview"].src="App_Images/printpreview_over.gif";
    }
}

function PrintPreviewMouseOut()
{
    if (document.images)
    {
        if (inPrintPreview)
            document.images["BtnPrintPreview"].src="App_Images/navigate_back_off.gif";
        else
            document.images["BtnPrintPreview"].src="App_Images/printpreview_off.gif";
    }
}

function togglePrintPreview()
{
    var currCSS = document.getElementById('ctl00_printcss');
    if(currCSS.media == 'all')
    {
        inPrintPreview = false;
        currCSS.media = 'print';
    }
    else
    {
        inPrintPreview = true;
        currCSS.media = 'all';
    }
    PrintPreviewMouseOver();
}

function MakePrintReady()
{
    if (document.getElementById)
	{ // DOM3 = IE5, NS6
        document.getElementById('buttons').style.display = 'none';
	}
	else
	{
	    if (document.layers)
	        document.buttons.display = 'none';
	    else
	        document.all.buttons.style.display = 'none';
	}
	
    window.print();
    
    if (document.getElementById)
	{ // DOM3 = IE5, NS6
        document.getElementById('buttons').style.display = 'block';
	}
	else
	{
	    if (document.layers)
	        document.buttons.display = 'block';
	    else
	        document.all.buttons.style.display = 'block';
	}
}

function limitText(limitField, limitNum)
{
	if (limitField != null && limitField.value.length > limitNum)
		limitField.value = limitField.value.substring(0, limitNum);
}
