// Prevent people from submitting a form twice
var firsttime
function stopSecondSubmit(theForm)
{	if (firsttime == "Y")
  {	alert("Please wait... \n\nThe request has already been submitted\nand is currently being processed."); return (false); }
  firsttime = "Y";
  theForm.btnSubmit.value="Please Wait...";
  document.body.style.cursor = "wait";
  return (true);
}

// Show / Hide Content (Simple Version)
function toggleContentSimple(el) {

  var myelement = document.getElementById(el);
  var myimg = document.getElementById("btn-" + el);

  if( !myelement.style.display || myelement.style.display == "none" ) {
	myelement.style.display = "inline";
  } else {
    myelement.style.display = "none";
  }
}

// Show / Hide Content
function toggleContent(el) {

  var myelement = document.getElementById(el);
  var myimg = document.getElementById("btn-" + el);

  if( !myelement.style.display || myelement.style.display == "none" ) {
	myelement.style.display = "inline";
    myimg.src= "/img/icons/btnContract.gif";
  } else {
    myelement.style.display = "none";
    myimg.src= "/img/icons/btnExpand.gif";
  }
}

// Select/deselect all
function fnCheckAll(bState, sElementName) {
	var all = document.getElementsByName(sElementName);
	for (var iLoop=0; iLoop < all.length; iLoop++) all[iLoop].checked=bState
}


// Open in new window
function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


// Break out of a frameset
function breakFree() {
	if (parent.frames.length > 0) {
	    parent.location.href = self.document.location;
	}
}

// Jumpmenu script

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function ClearOptions(OptionList) {

   // Always clear an option list from the last entry to the first
   for (x = OptionList.length; x >= 0; x = x - 1) {
      OptionList[x] = null;
   }
}

function AddToOptionList(OptionList, OptionValue, OptionText) {
   // Add option to the bottom of the list
   OptionList[OptionList.length] = new Option(OptionText, OptionValue);
}

// Hide Container
function hideContainer(el) {
	var myelement = document.getElementById(el);
	myelement.style.display = "none";
}

// Show Container
function showContainer(el) {
	var myelement = document.getElementById(el);
	myelement.style.display = "inline";
}

// Category Info Loader - Collapse
function hideDetailedInfo() {
	hideContainer('detailedInfo');
	showContainer('summaryInfo');
}

// Category Info Loader - Show
function showDetailedInfo() {
	hideContainer('summaryInfo');
	showContainer('detailedInfo');
	
}


function ShowContentSimple(el) {

  var myelement = document.getElementById(el);
  var myimg = document.getElementById("btn-" + el);

  myelement.style.display = "inline";
 
}
