document.onclick = function(e)
{
  var target = e ? e.target : window.event.srcElement;

  while (target && !/^(a|body)$/i.test(target.nodeName))
  {
    target = target.parentNode;
  }

  if (target && target.getAttribute('rel')
      && target.rel == 'external')
  {
    var external = window.open(target.href);

    return external.closed;
  }
  
}



function fieldFocus(field) {
if(document.oml){
        document.oml.elements[field].focus();
        }
}


function doDecimals(val) {
ttl = "" + parseInt(val * 100)/100;
dec1 = ttl.substring(ttl.length-3, ttl.length-2);
dec2 = ttl.substring(ttl.length-2, ttl.length-1);
if (dec1 != '.') { // adds trailing zeroes if necessary
        if (dec2 == '.') {ttl += "0"}   else {ttl += ".00"}
        if (ttl == ".00") {ttl = "0.00"}
        }
return ttl
}


function remapForm(sel){
	if(sel == 1){
		if(document.remap.model){
			document.remap.model.selectedIndex = 0;
			}
		}
	if(document.remap.variation){
		document.remap.variation.selectedIndex = 0;
		}
	document.remap.submit();
	}

// POP-UP for Help
function NewHelpWindow(mypage) {
win = window.open(mypage, "help", 'height=300,width=550,top=10,left=10,scrollbars=1,resizable');
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

//  POP-UP for Use form
function NewUserWindow(mypage) {
win = window.open(mypage, "profile", 'height=700,width=600,top=10,left=10,scrollbars=1,resizable');
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


