// Copyright 2005 Infinity Soft
 
function openWindow(url) {
  popupWin = window.open(url,'new_page','width=400,height=350')
}

		
function MenuClick(url)
{
  		location.href = url;
}
		
function MenuMOv(div)
{
			//div.style.background = "#5959FF";
			//div.style.borderColor = "#DFDFFF";
	div.className = "MenuRowOver";
}
		

function MenuMOt(div)
{
  		//div.style.background = "";
			//div.style.borderColor = "#000080";
		div.className = "MenuRow";
}
		
		
function TopMOv(div)
{
			//div.style.background = "#5959FF";
			//div.style.borderColor = "#DFDFFF";
	div.className = "TopRowOver";
}
		

function TopMOt(div)
{
  		//div.style.background = "";
			//div.style.borderColor = "#000080";
		div.className = "TopRow";
}
		
function IsNumeric(strString)	
{
  var strValidChars = "0123456789.-";
  var strChar;
  var blnResult = true;

  if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
  for (i = 0; i < strString.length && blnResult == true; i++)
    {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
    }
  return blnResult;
}

function IsEmpty (fld, fldName) 
{
 var rVal = true;
 if (fld.value == "") 
  {    
    alert("You Must enter a value for "+fldName+".\n");
    fld.focus();
    rVal = false;
  }
   return( rVal );
}

function NeedNumber( fld, fldName )
{
var rVal=true;
if (IsNumeric(fld.value) == false)
  {
    alert("Please enter a Numeric value for the "+fldName+" field.");
    fld.focus();
    rVal = false;
  }
 return( rVal );
}

function IsEmail( fld, fldName )
{
var rVal=true;
var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(fld.value) == false)
  {
  alert("Please enter a valid email address in the "+fldName+" field.");
  fld.focus();
  rVal = false;
  }
  return( rVal );
}

function checkDropdown( fld, fldName ) 
	{
    var rVal = true;
    if (fld.value == "0") 
    {
    alert("You must choose an option for "+ fldName+".\n");
    fld.focus();
    rVal = false;
    }    
		return ( rVal );
}    

function DeleteEvent( strID )
{
input_box=confirm("Are you sure you want to delete this Event from the Calendar?");
if (input_box==true)
	{window.location = "EditEvent.asp?DEL=TRUE&ID="+strID }
}

function DeleteOrder( strID )
{
input_box=confirm("Are you sure you want to delete this order and return the stock to inventory?");
if (input_box==true)
	{window.location = "DeleteOrder.asp?ID="+strID }
}

function DeleteSType( strID )
{
input_box=confirm("Are you sure you want to delete this Shipping Type?");
if (input_box==true)
	{window.location = "EditSType.asp?ID="+strID+"&DEL=DEL" }
}

function DeletePage( strID )
{
input_box=confirm("Are you sure you want to delete this Page?");
if (input_box==true)
	{window.location = "EditGroup.asp?DEL=TRUE&ID="+strID }
}

function DeleteItem( strID )
{
input_box=confirm("Are you sure you want to delete this Item?");
if (input_box==true)
	{window.location = "EditItem.asp?DEL=TRUE&ID="+strID }
}

