// template script

function HighLight(obj)
{
	obj.className = "inputfocus";
}


function LowLight(obj)
{
	obj.className = "input";
}

function ObjFormSubmit(ButtonVal)
{
	document.Obj_Form.Button.value = ButtonVal;
	document.Obj_Form.submit();
}

function IdFormSubmit(ButtonVal)
{
	document.Id_Form.Button.value = ButtonVal;
	document.Id_Form.submit();
}

function NavTo(fieldname)
{
	si = document.forms['Obj_Form'].elements[fieldname].selectedIndex;
	if (si == -1)
	{
	alert('You must make a selection from the list before navigating.');
	} else {
	sv = document.forms['Obj_Form'].elements[fieldname].options[si].value;
	window.open(sv,'SocketNav','Width=640,Height=400,Resizable=Yes,toolbar=1,copyhistory=0,Scrollbars=Yes,Status=Yes,MenuBar=1,Border=0');
	}
}

function makeCookie(Name,Value,Expiry,Path,Domain,Secure)
{
	//Bunch of arguments
	if (Expiry != null) {
	//if you want to save the cookie
	var datenow = new Date();
	//get a date
	datenow.setTime(datenow.getTime() + Math.round(86400000*Expiry));
	//mutiply the number to make it represent days
	Expiry = datenow.toGMTString();
	//convert to GMT time
	}
	//ends that. And now...
	Expiry = (Expiry != null) ? '; expires='+Expiry : '';
	//has an expiration?
	Path = (Path != null)?'; path='+Path:'';
	//has a path?
	Domain = (Domain != null) ? '; domain='+Domain : '';
	//has a domain?
	Secure = (Secure != null) ? '; secure' : '';
	//Secure?
	document.cookie = Name + '=' + escape(Value) + Expiry + Path + Domain + Secure;
	//Make the cookie!
}
	
function vwlookup(fieldname,searchid)
{
	words = document.forms['Obj_Form'].elements[fieldname].value;
	thrf  = '../vw.asp?' + searchid + '~ILOOKUP~FIELD=' + escape(fieldname) + '~WORDS=' + words;
	window.open(thrf,'Lookup','Width=640,Height=400,Resizable=Yes,toolbar=1,copyhistory=0,Scrollbars=Yes,Status=Yes,MenuBar=1,Border=0');
}

function showmenuie5() {
  var rightedge = document.body.clientWidth-event.clientX;
  var bottomedge = document.body.clientHeight-event.clientY;
  if (rightedge < ie5menu.offsetWidth)
    ie5menu.style.left = document.body.scrollLeft + event.clientX - ie5menu.offsetWidth;
  else
    ie5menu.style.left = document.body.scrollLeft + event.clientX;
  if (bottomedge < ie5menu.offsetHeight)
    ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight;
  else
    ie5menu.style.top = document.body.scrollTop + event.clientY;
  ie5menu.style.visibility = "visible";
  return false;
}

function hidemenuie5() {
  ie5menu.style.visibility = "hidden";
}

function highlightie5() {
  if (event.srcElement.className == "menuitems")
   {
    event.srcElement.style.backgroundColor = "highlight";
    event.srcElement.style.color = "white";
   }
}

function lowlightie5() {
  if (event.srcElement.className == "menuitems")
   {
     event.srcElement.style.backgroundColor = "";
     event.srcElement.style.color = "black";
   }
}
function jumptoie5() {
  if (event.srcElement.className == "menuitems")
    location.replace(event.srcElement.url);
}

function deleteObj() {
  if (confirm('Are you sure you want to delete this object?'))
  ObjFormSubmit('DELETE');
}
