// JavaScript Document


function PopupPic(sPicURL) 
{ 
 sPicURL=ourVLargeImgPath+"/"+sPicURL;
 wid = 800;
 hei = 600;
 window.open("popup.html?"+sPicURL, "", "resizable=1,HEIGHT="+hei+",WIDTH="+wid+"");
}

/*function PopupJsp(sJspURL) 
{ 
 wid = 800;
 hei = 700;
 window.open(sJspURL, "", "resizable=1,scrollBars=yes,HEIGHT="+hei+",WIDTH="+wid+"");
}*/

popUpWin = 0;
function PopupJsp(sJspURL)
{sJspURL=global_path+"/"+sJspURL;
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  wid = 800;
  hei = 700;
  popUpWin = open(sJspURL, "", 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollBars=yes,resizable=no,copyhistory=yes,width='+wid+',height='+hei);
}


/*popUpWin = 0;
function popUpWindow(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollBars=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}*/
popUpWin = 0;
function popUpWindow(URLStr, title, left, top, width, height,id,scrollbars)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollBars='+scrollbars+',resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popUpWindowMenubar(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollBars=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popUpWindow_scroll(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollBars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popUpWindowAll(URLStr, title, left, top, width, height,id)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, title, 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollBars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


	
	
function cNum(e) {
	var strCheck = '0123456789\b\t	 ';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 0 || whichCode == 13)
	{
		return true ;		
	}
	key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
}

function cNumPhone(e) {
	var strCheck = '0123456789\b\t	 +()[]-';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 0 || whichCode == 13)
	{
		return true ;		
	}
	key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
}

function isOneChecked(CheckboxArray) 
{
	for (var i = 0; i < CheckboxArray.length; i++) 
	{
		if (CheckboxArray[i].checked)
		{
			return true;
		}
	}
	return false;
}

function setPointer(theRow, thePointerColor, theNormalBgColor)
{
  var theCells = null;

  if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
      return false;
  }
  if (typeof(document.getElementsByTagName) != 'undefined') {
      theCells = theRow.getElementsByTagName('td');
  }
  else if (typeof(theRow.cells) != 'undefined') {
      theCells = theRow.cells;
  }
  else {
      return false;
  }

  var rowCellsCnt  = theCells.length;
  var currentColor = null;
  var newColor     = null;
  // Opera does not return valid values with "getAttribute"
  if (typeof(window.opera) == 'undefined'
      && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
      currentColor = theCells[0].getAttribute('bgcolor');
      newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                   ? theNormalBgColor
                   : thePointerColor;
      for (var c = 0; c < rowCellsCnt; c++) {
          theCells[c].setAttribute('bgcolor', newColor, 0);
      } // end for
	
  }
  else {
      currentColor = theCells[0].style.backgroundColor;
      newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                   ? theNormalBgColor
                   : thePointerColor;
      for (var c = 0; c < rowCellsCnt; c++) {
          theCells[c].style.backgroundColor = newColor;
		  
      }
	  
  }

  return true;
} // end of the 'setPointer()' function