// JavaScript Document
function generatecode()
{
 var code='';
 var astyle='';
 var textcolor=document.getElementById('textcolorinput').value;
 var textcode='';
 var bgcode='';
 var spacer='?';
 var bgcolor=document.getElementById('bgcolorinput').value;
 if(textcolor=='Default')
 {
  textcolor='';
 }
 if(bgcolor=='Default')
 {
  bgcolor='';
 }
 if(textcolor!='')
 {
  astyle=' style="color:'+textcolor+'"; ';
  textcode=spacer+'textcolor='+textcolor.replace('#','');
  spacer='&';
 }
 if(bgcolor!='')
 {
  bgcode=spacer+'bgcolor='+bgcolor.replace('#','');
 }
 var code='<div id="mortgage-calculator">\n<iframe src="http://www.freeloancalculators.com/script/calculator.php'+textcode+bgcode+'" scrolling="no" width="300px" height="250px" frameborder="0"></iframe>\n</div>';
 document.getElementById('codesnippit').value=code;
}

function resetcode()
{
  document.getElementById('textcolorinput').value='Default';
  document.getElementById('bgcolorinput').value='Default';
  var code='<div id="mortgage-calculator">\n<iframe src="http://www.freeloancalculators.com/script/calculator.php" scrolling="no" width="300px" height="250px" frameborder="0"></iframe>\n</div>';
  document.getElementById('codesnippit').value=code;
}
