﻿// JScript File
function ShowHideDIV(theDIV)
{
    // Setup image variable
    var image = document.getElementById(theDIV + '_ExpandCollapse_Image');
    if (image == null) {
        image = document.getElementById('ctl00_ctl00__MainContent__MainColumnContent_' + theDIV + '_ExpandCollapse_Image');
    }
    // Setup container
    var container = document.getElementById(theDIV + '_Panel');
    if (container == null) {
        container = document.getElementById('ctl00_ctl00__MainContent__MainColumnContent_' + theDIV + '_Panel');
    }
	if (container.style.display == 'none')
	{
		container.style.display = '';
		if (image != null) {	
		    image.src = GetFileDirectory(image.src) + '/ice_panel_show.png';		
		    image.alt = 'Collapse';
		}
		document.getElementById('ctl00_ctl00__MainContent__MainColumnContent_' + theDIV + '_Div').title = 'Click to collapse this section';
		
	}
	else
	{
		container.style.display = 'none';
	    if (image != null) {
		    image.src = GetFileDirectory(image.src) + '/ice_panel_collapsed.png';
		    image.alt = 'Expand';
		}
		document.getElementById('ctl00_ctl00__MainContent__MainColumnContent_' + theDIV + '_Div').title = 'Click to expand this section';
	}
}
function ShowDiv(theDIV)
{
    // Setup image variable
    var image = document.getElementById(theDIV + '_ExpandCollapse_Image');
    if (image == null) {
        image = document.getElementById('ctl00_ctl00__MainContent__MainColumnContent_' + theDIV + '_ExpandCollapse_Image');
    }
    // Setup container
    var container = document.getElementById(theDIV + '_Cell_Container');
    if (container == null) {
        container = document.getElementById('ctl00_ctl00__MainContent__MainColumnContent_' + theDIV + '_Panel');
    }
    
    document.getElementById(theDIV).style.display = '';
	if (image != null) {	
	    image.src = GetFileDirectory(image.src) + '/ice_panel_show.png';		
	    image.alt = 'Collapse';
	}
	if (container != null) {
	    container.title = 'Click to collapse this section';
	}
}

function HideControl(ctrl)
{
    document.getElementById(ctrl).style.display = 'none';
}
function ShowControl(ctrl)
{
    document.getElementById(ctrl).style.display = '';
}

function GetFileDirectory(path)
{
    // Returns the directory for a file
    // path = '../../Images/someimagefile.jpg' returns '../../Images/
    var index = path.lastIndexOf('/');
    return path.substring(0, index);
}
