// ##########################################################################

// 5 STAR AWARD STRING IN FEATURES
// gets called from Review pages

function doAward() {

	var x = document.getElementsByTagName('div');

	for (var i=0;i<x.length;i++){

		if (x[i].className == 'award'){
			var obj = x[i];

			var myStr = "<span class=awardTxt>5-Star Design Award</span> <img src=images/stars/five_stars_sm.gif width=35 height=6 border=0 hspace=0>";

			obj.innerHTML =   myStr;

		}
   	}
}

var awardtimer=setTimeout('doAward()',1000);

// ##########################################################################


// IN REVIEW PAGES, PULL PRICE FROM DATA GRID TO POPULATE TOP MORTGAGE AND EMAIL POPUPS

// if(_fl==0){tm=setTimeout("cp('273500')",1000);_fl=1;} - IN GRID

_fl=0; // set flag so only FIRST design's price is captured in var desPri

function cp(pri){
desPri = pri; // set price variable for pop-ups and inline price spans

	}


function checkPriceSpan(Pri) { // check to see if price spans exist - eat cycles so online version functions

	var x = document.getElementsByTagName('span');

	for (var i=0;i<x.length;i++){

		if (x[i].className == 'price'){
			var obj = x[i];

			formatDesPri(Pri); // pass unformatted price to formatter function

		}
   	}
}


if ( typeof(desPri) != "undefined" ) {

var pritimer=setTimeout('checkPriceSpan(desPri)',3000);


} else {

desPri = "<SPAN style='color:red;'> * Not Available * </SPAN>";

var pritimer=setTimeout('doPriceSpan(desPri)',3000);
}


//alert(desPri);

function formatDesPri(mnt) {
var amount = String(mnt);
var formatted = '';
for (var i = amount.length-1, t = 1; i >= 0; --i, ++t){
if ((t % 3) == 0){
formatted = ',' + amount.substr(i,1) + formatted;
}else{
formatted = amount.substr(i,1) + formatted;
}
}
if (formatted.substr(0,1) == ','){
formatted = formatted.substr(1,formatted.length-1);
}
//return "$"+formatted; // orig
//return alert("$"+formatted);

designPrice = "$"+formatted;
//return designPrice;

doPriceSpan(designPrice);  // send formatted price to page element locating function
	}

// ##########################################################################

function doPriceSpan(dp) {

	var x = document.getElementsByTagName('span');

	for (var i=0;i<x.length;i++){

		if (x[i].className == 'price'){
			var obj = x[i];

			obj.innerHTML = dp; // populate 'price' spans with formatted design price set by function formatDesPri()

		}
   	}
}

//var awardtimer=setTimeout('doPriceSpan()',3000);

// ##########################################################################
