function getSpec() {
var x=document.forms[0].uid;
if (!x.value) {
  alert('Invalid or Missing ID');
  return false;
  }
x=x.value;
var URL='/!C0/spec/'+x+'/for-sale';
location.href=URL;
}
var state = 'none';
/* ****************************************************************** */
function showhide(layer_ref,layer_form) {
var fv;
 if (state == '') {
  state = 'none';
  fv = 'none';
  } else {
  state = '';
  fv = 1;
  }  
var x=eval("document.forms['"+layer_form+"']."+layer_ref+"x.value");
x = fv;
 if (document.all) { 
  eval( "document.all." + layer_ref + ".style.display = state");
  }
 if (document.layers) { 
  document.layers[layer_ref].display = state;
  }
 if (document.getElementById && !document.all) {
  obj = document.getElementById(layer_ref);
  obj.style.display = state;
  }
}
/* ****************************************************************** */
function at_show_aux(parent,child) {
var p = document.getElementById(parent);
var c = document.getElementById(child );
var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;
for (; p; p = p.offsetParent) {
  top  += p.offsetTop;
  left += p.offsetLeft;
  }
c.style.position   = "absolute";

//Beg iManPro Hack

divleft = document.getElementById(parent).offsetLeft;
divtop  = document.getElementById(c["at_div"]).offsetTop;
top  = top-divtop;
left = divleft;
//alert(top); alert(divtop); alert(left);
//end iManPro Hack

c.style.top        = (top+(c["at_tpx"]*1))  +'px';
c.style.left       = (left+(c["at_lpx"]*1)) +'px';
c.style.display    = "";
}
// ***** at_show *****
function at_show(tpx,lpx) {
var p = document.getElementById(this["at_parent"]);
var c = document.getElementById(this["at_child" ]);
at_show_aux(p.id,c.id);
clearTimeout(c["at_timeout"]);
}
// ***** at_hide *****
function at_hide() {
var p = document.getElementById(this["at_parent"]);
var c = document.getElementById(this["at_child" ]);
c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.display = 'none'", 100);
}
// ***** at_click *****
function at_click() {
var p = document.getElementById(this["at_parent"]);
var c = document.getElementById(this["at_child" ]);
if (c.style.display != "none") at_show_aux(p.id, c.id); else c.style.display = "none";
  return false;
}
function at_attach(parent,child,showtype,position,cursor,tpx,lpx,div) {
var p = document.getElementById(parent);
var c = document.getElementById(child);
p["at_parent"]     = p.id;     c["at_parent"]     = p.id;
p["at_child"]      = c.id;     c["at_child"]      = c.id;
p["at_position"]   = position; c["at_position"]   = position;
c.style.position   = "absolute";
c.style.display    = "none";
c.style.zIndex     = "5000"; 
c["at_tpx"]=tpx; c["at_lpx"]=lpx; c["at_div"]=div; 
if (cursor != undefined) p.style.cursor = cursor;
switch (showtype) {
  case "click":
   p.onclick     = at_click; p.onmouseout  = at_hide;
   c.onmouseover = at_show; c.onmouseout  = at_hide;
   break;
  case "hover":
   p.onmouseover = at_show; p.onmouseout  = at_hide;
   c.onmouseover = at_show; c.onmouseout  = at_hide;
   break;
  }
}
/* ****************************************************************** */
//Figure Loan Payment for Total Financed
function getPayment() {
var x=document.forms['F1'];
var totl=x.totlP.value;
if (isNaN(totl)) {
  x.paymentP.value='NA';
  return false;
  }
var i=x.intrP.value;
if (i == parseFloat(i)){
  var intr=(i/100/12);
  } else {
  x.paymentP.value='NA';
  return false;
  }
var term=x.termP.options[x.termP.selectedIndex].value;
var z=(totl*intr)/(1-Math.pow(1+intr,-term));
z=Math.round(z*1)/1
if (z == parseFloat(z)){
   x.paymentP.value=z;
  }
}
//Figure Total Afford based on Payment/Int/Term
function getAfford() {
var x=document.forms['F1'];
var p=x.paymentA.value;
if (isNaN(p)) {
  x.totlA.value='NA';
  }
var i=x.intrA.value;
if (i == parseFloat(i)){
  var intr=(i/100/12);
  } else {
  x.totlA.value='NA';
  }
var term=x.termA.options[x.termA.selectedIndex].value;
var z = 1*(0+p*(1+intr*0)*((Math.pow(1+intr,term))-1)/intr)/(Math.pow(1+intr,term));
z=Math.round(z*1)/1
if (z == parseFloat(z)){
  x.totlA.value=z;
  }
}
/* ****************************************************************** */