﻿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 allcomponents = document.getElementById("components");
        var items = allcomponents.getElementsByTagName("div");
        for (var i = 0; i < items.length; i++)
        {
                filter(("img"+items[i].id),'imgout');
                items[i].style.display = 'none';
        }
    }
}

function expandAll()
{
    if (document.getElementById)
    {
        var allcomponents = document.getElementById("components");
        var items = allcomponents.getElementsByTagName("div");
        for (var i = 0; i < items.length; i++)
        {
                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 limitText(limitField, limitNum)
{
	if (limitField != null && limitField.value.length > limitNum)
		limitField.value = limitField.value.substring(0, limitNum);
}