function flashobject(sourceURL,width,height)
{
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width=' + width + ' height=' + height + ' id="deptsensors" align="middle">\n');
document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
document.write('<param name="movie" value=' + sourceURL + ' />\n');
document.write('<param name="quality" value="high" />\n');
document.write('<param name="wmode" value="transparent" />\n');
document.write('<param name="menu" value="false" />\n');
document.write('<param name="bgcolor" value="#ffffff" />\n');
document.write('<embed src=' + sourceURL + ' quality="high" wmode="transparent" menu="false" bgcolor="#ffffff" width=' + width + ' height=' + height + ' name="Texas Dream Designs" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
document.write('</object>\n');
}

function CalculatePayment(downpayment, price, term, rate)

{
	var intPrice=price.value;
	var intterm=term.options[term.selectedIndex].text
	var intrate=rate.options[rate.selectedIndex].text
	var intdownpayment=downpayment.value;
	
   for (var i = 0; i < intPrice.length; i++) {
            var curr_ch = intPrice.substring(i, i + 1)
            if ((curr_ch < '0' || curr_ch > '9') && curr_ch != '.') {
	        //msg = msg + " should only contain digits.  You entered: " + input;
                alert("Purchase price should only contain digits");
               price.value="";
		downpayment.value="";
                return false;
            }
        }


for (var i = 0; i < intdownpayment.length; i++) {
            var curr_ch = intdownpayment.substring(i, i + 1)
            if ((curr_ch < '0' || curr_ch > '9') && curr_ch != '.') {
	        //msg = msg + " should only contain digits.  You entered: " + input;
                alert("Down Payment should only contain digits");
               downpayment.value="";
		price.value="";
                return false;
            }
        }
	
    var principal = intPrice - intdownpayment;
	
	
    var i = intrate / 1200;
    var pow = 1;

    for(var j = 0; j < intterm; j++)
	{
       pow *= (1 + i);
	 }

    var mth = (principal * pow * i) / (pow - 1);
	mth = Math.round(mth * 100) / 100;
//alert(mth);
	document.getElementById("txtmonth").value="$" + mth;
    return mth;
	
   }
   
   function clear()
   {
	txtprice.value="";
	txtdown.value="";
    txtmonth.value="";
   }

 function UpdatePayment()
 {
   var frm = document.forms["estimate_payment"];
/* */
   var est = CalculatePayment(
      frm["cash"].value,
      21985,
      frm["term"].value,
      frm["rate"].value
      );
   document.getElementById("txtmonth").value = "$" + FormatNumber(est);
   
/* */                                                                                                                                           
    }
	
	function Clear() { 
document.getElementById("txtprice").value ="";
document.getElementById("txtdown").value ="";
document.getElementById("txtmonth").value ="";
    
}

function writeJS(obj){
     var str='';
     str+='<iframe src='+obj+' frameborder="0" scrolling="auto" class="frame"></iframe>';
     document.write(str);
}

function writeJSdigi(obj){
     var str='';
     str+='<iframe src='+obj+' frameborder="0" scrolling="no" class="framedigi"></iframe>';
     document.write(str);
}																														   
