﻿// JScript File
var sh_ShowImg = "/graphics/plus.gif";
var sh_HideImg = "/graphics/minus.gif";

function toggle(section)
  {
    object = document.getElementById(section);
    if (object.style.display=="none")
      object.style.display="block";
    else
      object.style.display="none";
  }

/* Used to Restrict the Length of TextAreas */
function sh_MaxLength(sh_field, sh_maximum)
{
  if (sh_field.value.length > sh_maximum + 1)
    alert('Your comment must contain fewer than ' + sh_maximum + ' characters.');
  if (sh_field.value.length > sh_maximum)
  {
    sh_field.value = sh_field.value.substring(0, sh_maximum);
  }
}

function sh_windowpopup(file, name, w, h){

	var xPos, yPos;
	var winProp;    

	xPos = (screen.width/2)-(w/2);
	yPos = (screen.height/2)-(h/2);

	winProp = "width=" + w + ",height=" + h + ",left=" + xPos + ",top=" + yPos +",resizable=1";     

	win = window.open(file, name, winProp); 
	win.focus();
}


function sh_ShowHide()
{
  groupname=arguments[0];
  rows=arguments[1];
  if(arguments.length > 2)
  {
    if (arguments[2]==1)
    {
      var currRow = document.getElementById(groupname);
  		currRow.style.display="";
  		document.getElementById(groupname+"img").src = sh_HideImg;
    }
    else if (arguments[2]==0)
    {
      var currRow = document.getElementById(groupname);
  		currRow.style.display="none";
  		document.getElementById(groupname+"img").src = sh_ShowImg;
    }
  }
  else
  {
    if (rows == 0) 
    { /* for a single item */
      sh_RowShowHide(groupname);
  	}
    else
    { /* for multiple rows of a table */
      for(i=1; i <= rows; i++)
      {
        var tempRow = groupname + "" + i;
        sh_RowShowHide(tempRow);
      }
    }
  }
}

function sh_RowShowHide(sh_RowID) {
	var currRow = document.getElementById(sh_RowID);
	if (currRow.style.display=="none") {
		currRow.style.display="";
		document.getElementById(sh_RowID+"img").src = sh_HideImg;
	} else {
		currRow.style.display="none";
		document.getElementById(sh_RowID+"img").src = sh_ShowImg;
	}	
}


