function newImage(ID,file) {
	document.getElementById(ID).src='/images/'+file;
}

function open_window(URL,name,left,top,width,height,menubar){
	 rp=window.open(URL,name,"top="+top+",left="+left+",height="+height+",width="+width+",menubar="+menubar+",scrollbars=1,resizable=1,status=1");
	 rp.focus();
	 return(false);
}

/* generic functions start
sib = sibling
par = parameter
nod = node
[^\t\n\r] = whitespace regex
*/

function is_all_ws( nod )
{
    return !(/[^\t\n\r ]/.test(nod.data)); 
}

function is_ignorable( nod )
{
    return ( nod.nodeType == 8) || // A comment node
       ( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
}

function node_after( sib )
{
  while ((sib = sib.nextSibling)) {
    if (!is_ignorable(sib)) 
            return sib;
  }
  return null;
}				

function first_child( par )
{
  var res=par.firstChild;
  while (res) {
    if (!is_ignorable(res)) 
            return res;
    res = res.nextSibling;
  }
  return null;
}						

function checkforIE()
{
    if (navigator.appName == 'Microsoft Internet Explorer')
        return true;
}
// generic functions end


		
function ShowHide(obj, expandText, contractText)
{                       
    for (var i = obj.childNodes.length - 1; i >= 0; i--)
    {
        if (obj.childNodes[i].nodeType  == 1) {
            obj.childNodes[i].innerHTML = (obj.childNodes[i].innerHTML.indexOf("icn_x.gif")>0 ? "<a href=\"javascript:void(0);\" style=\"white-space: nowrap;\">" + expandText + "<img src=\"/images/icn_arrow_right.gif\" alt=\"\" /></a>" : "<a href=\"javascript:void(0);\" style=\"white-space: nowrap;\">" + contractText + "<img src=\"/images/icn_x.gif\" alt=\"\" /></a>");
            break;
        }
    }

    var objElement = node_after(obj);
    doShowHide (objElement.style);
    
    if(objElement.style.display == "block")
    obj.style.backgroundColor = "#E9F6FA";
}

function doShowHide(obj)
{
    if (checkforIE())
    {
        // the browser claims to be IE, and is not Opera
        obj.display = (obj.display == 'none' ? 'block':'none');
    }
    else
    {
        obj.display = (obj.display == 'none' ? 'table-row':'none');
    }
}



function changeTrColor(obj, mode)
{
    var objElement = node_after(obj);
    
    if (checkforIE())
    {
        if(mode == 'in' || node_after(obj).style.display == 'block')
        {
            obj.style.backgroundColor = '#E9F6FA';
            obj.style.cursor = 'pointer';
        }
        else
        {
            obj.style.backgroundColor = '';
            obj.style.cursor = 'default';
        }
    }
    else
    {
        if(mode == 'in' || node_after(obj).style.display == 'table-row')
        {
            obj.style.backgroundColor = '#E9F6FA';
            obj.style.cursor = 'pointer';
        }
        else
        {
            obj.style.backgroundColor = '';
            obj.style.cursor = 'default';
        }
    }
}

function navigateToListItem(expandText, contractText)
{
    if (location.hash != null && location.hash != "")
    {
        var element = document.getElementById(location.hash.replace("#",""));
        
        if (element != null && element.parentNode != null && element.parentNode.parentNode != null)
        {
            ShowHide(element.parentNode.parentNode, expandText, contractText);
        }
    }
}
