/*
function OS(){

if (!ValidateForm()) return false;

var D=document, oScr=D.createElement('SCRIPT');
D.body.insertBefore(oScr, null);
oScr.src="http://"+window.location.host+"/re/re1.php?n="+Math.random().toString().substr(2, 4);

return false;
}
*/

function OS(F){
var strErr, tmpZip;

if (!F) F=D.getQuoteForm;
strErr=""; tmpZip=trim(F.zip.value);

F.zip.value=tmpZip;
if (tmpZip.search(/^\d{5}/) == -1 || tmpZip.length > 5){
	strErr=strErr + "Zip Code is required and must be in the format 00000.\n";
	}

if (strErr!=""){
	alert(strErr); F.zip.focus(); return false;
	}

preserveRefby(); return true;
}



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function addfavoris() {
if ( navigator.appName != 'Microsoft Internet Explorer' )
{ window.sidebar.addPanel(document.title,location.href,""); }
else { window.external.AddFavorite(location.href,document.title); } }

/***********************************************  Video Options ***********************************************/


		//Размер документа по вертикали
		function getDocumentHeight()
		{
		  return (document.body.scrollHeight > document.body.offsetHeight)?
			document.body.scrollHeight:
			document.body.offsetHeight;
		}

		//Размер документа по горизонтали
		function getDocumentWidth()
		{
		  return (document.body.scrollWidth > document.body.offsetWidth)?
			document.body.scrollWidth:
			document.body.offsetWidth;
		}


//IE5+, Mozilla 1.0+, Opera 7+ рабочая область браузера

function getClientWidth() {
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function getClientHeight() {
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}

var dd_width = 0;
var dd_height = 0;
var dd_sroll_height = 0;

function CountWH(picid)
	{
	//dd_width = (screen.width);//-20;
	dd_width = document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
	
	
	dd_sroll_height = getDocumentHeight();

	//alert('width:' + dd_width + '\n' + 'sroll:' + dd_sroll_height);
	
	document.all['superdiv'].style.width=dd_width;
	document.all['superdiv'].style.height=dd_sroll_height;	

	document.all['superdiv'].style.visibility='visible';
}

/*

*/

var tt_width = 0;
var tt_height = 0;
var picid;

function OpenDiv(picid)
	{
	//alert(picid);
	tt_width = (screen.width/2)-400;

	tt_height = (screen.height/2)-270-100; // 254 is div height 509/2
	tt_height = tt_height + document.body.scrollTop;

	//document.all['warstwa'].style.visibility='visible'; 
	
	//document.all['warstwa'].style.left=tt_width;
	//document.all['warstwa'].style.top=tt_height;
	//document.all['warstwa'].style.visibility='visible';

	document.all[picid].style.left=tt_width;
	document.all[picid].style.top=tt_height;
	document.all[picid].style.visibility='visible';	

	//document.getElementById(picid).style.display = display;
	
	//picid = 'images/divpic/'+picid+'_big.jpg';
	//document.all['divpicture'].src=picid;
	//OpenDiv(334126);
}

function toggleDiv(id, display)
{
	div = document.getElementById(id);
		div.style.display = display;
		return true;
}

function CloseAll()
	{
	document.all['superdiv'].style.visibility='hidden';
	document.all['div1'].style.visibility='hidden';
	document.all['div2'].style.visibility='hidden';
	document.all['div3'].style.visibility='hidden';
	document.all['div4'].style.visibility='hidden';
	document.all['div5'].style.visibility='hidden';
	document.all['div6'].style.visibility='hidden';
	document.all['div7'].style.visibility='hidden';
	document.all['div8'].style.visibility='hidden';
	document.all['div9'].style.visibility='hidden';
	document.all['div10'].style.visibility='hidden';
	document.all['div11'].style.visibility='hidden';
	document.all['div12'].style.visibility='hidden';
	document.all['div13'].style.visibility='hidden';
	document.all['div14'].style.visibility='hidden';
	document.all['div15'].style.visibility='hidden';
	document.all['div16'].style.visibility='hidden';
	document.all['div17'].style.visibility='hidden';
	document.all['div18'].style.visibility='hidden';
	document.all['div19'].style.visibility='hidden';
	document.all['div20'].style.visibility='hidden';
}

function addfavoris() {
	if ( navigator.appName != 'Microsoft Internet Explorer' )
	{ window.sidebar.addPanel(document.title,location.href,""); }
	else { window.external.AddFavorite(location.href,document.title); } 
}

function calcface(form){
      var amt = form.amount.options[form.amount.selectedIndex].value;
      var interest = form.intrate.options[form.intrate.selectedIndex].value;
      var n = form.lnth.options[form.lnth.selectedIndex].value;
	var pmt = amt;
	var cpi = form.cpirate.options[form.cpirate.selectedIndex].value;	
	var i = interest - cpi;
      var k = 1/(1+i);
	var m = Math.pow(k,n);
	var pv;
	if(i != 0){pv = pmt*(1-m)/i}else{pv = pmt*n}
	form.faceval.value = Math.round(pv);
}
