
// Allow only numbers to be inputed in the quantity box.
function NumbersOnly(myfield, e, dec){
var key;
var keychar;

if (window.event)
key = window.event.keyCode;

else if (e)
key = e.which;

else
return true;

keychar = String.fromCharCode(key);
// control keys
if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
return true;

// decimal point jump
else if (dec && (keychar == ".")){
myfield.form.elements[dec].focus();
return false;
}else
return false;
}


// Browser Data
 // <script type="text/javascript">
// var x = navigator
// document.write("CodeName=" + x.appCodeName)
// document.write("MinorVersion=" + x.appMinorVersion)
// document.write("Name=" + x.appName)
// document.write("Version=" + x.appVersion)
// document.write("CookieEnabled=" + x.cookieEnabled)
 // document.write("CPUClass=" + x.cpuClass)
 // document.write("OnLine=" + x.onLine)
// document.write("Platform=" + x.platform)
// document.write("UA=" + x.userAgent)
 // document.write("BrowserLanguage=" + x.browserLanguage)
 // document.write("SystemLanguage=" + x.systemLanguage)
 // document.write("UserLanguage=" + x.userLanguage)
 // </script>

// Screen Size
//<A HREF="javascript:alert('Your resolution is '+screen.width+'x'+screen.height);">
// Click for your screen resolution</A>


// Display a new price if there is a change.
function writeNew( sel, spId, bpId ) {
    
  var sp  = document.getElementById( spId );
  var bp  = document.getElementById( bpId );
  var so  = sel.options[ sel.selectedIndex ];

  var prices = so.value.split('$' );
  var extra = ship = other = 0.0;
    
  if ( prices.length > 1 ) extra  = parseFloat( prices[ 1 ] );
  if ( prices.length > 2 ) ship   = parseFloat( prices[ 2 ] );
  if ( prices.length > 3 ) other  = parseFloat( prices[ 3 ] );
    
  if ( extra == NaN ) { extra = 0; }
  if ( ship  == NaN ) { ship  = 0; }
  if ( other == NaN ) { other = 0; }

  var bpVal = parseFloat( bp.value );
     
  sp.innerHTML = 'Your price: $' + ( extra + bpVal ).toFixed( 2 );
  
}


// Display a new price when item is sold by the square foot.
function getFootPrice(theSel){
  var theForm = theSel.form;
  var squareFeet = (theForm.hight.value * theForm.width.value) / 144;
  var thePrize = (squareFeet * 125).toFixed(2); 
  document.getElementById("squereSize").innerHTML = squareFeet.toFixed(3);
  document.getElementById("prize").innerHTML = thePrize;
  theForm.Price.value = thePrize;
}


// Display a new price when item is sold by the square yard.
function getYardPrice(theSel){
  var theForm = theSel.form;
  var squareFeet = (theForm.hight.value * theForm.width.value) / 144;
  var thePrize = (squareFeet * 125).toFixed(2);
  var squareYard = squareFeet/9;
  
  document.getElementById("squereSize").innerHTML = squareFeet.toFixed(3);
  document.getElementById("squereSizeYard").innerHTML = squareYard.toFixed(5);
  document.getElementById("prize").innerHTML = thePrize;
  theForm.Price.value = thePrize;
}


