
function isdefined( variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}

function formQS(sUrl, qs){
   if (!qs)
	   sUrl += "?";
   else
      sUrl += "&";
	return sUrl;
}
var ifrm;
function makeFrame() { 

	var f=document.getElementsByTagName("script");
	g=f[f.length-1];
	//var ph = document.getElementById("addAuctions");
	var sUrl = "http://www.propertyauction.com/featuredlistingsjs.cfm";
   ifrm = document.createElement("IFRAME"); 
   var querystring = false;

   if(isdefined("state")){
   		if(state != ""){		
		   sUrl = formQS(sUrl, querystring);
		   	sUrl += "state="+state;
			querystring = true;
		}
	}
  
	if(isdefined("propertyType")){
			if(propertyType != ""){
			   sUrl = formQS(sUrl, querystring);			
			   	sUrl += "ptype="+propertyType;
				querystring = true;
			}
	}

   if(isdefined("affiliateId")){
   		if(affiliateId != ""){
		    sUrl = formQS(sUrl, querystring);
		   	sUrl += "CooAID="+affiliateId;
			querystring = true;
		}
	}

//	alert(sUrl);
   ifrm.setAttribute("src", sUrl); 
   ifrm.style.width = 220+"px"; 
//   ifrm.style.height = 480+"px"; 
   ifrm.scrolling="no";   
   ifrm.id="PA_AucWidget"
   ifrm.name="PA_AucWidget"   
   ifrm.frameBorder = 0;
   ifrm.marginWidth = 0;
   ifrm.marginHeight = 0;
   g.parentNode.appendChild(ifrm); 
   state = "";
   propertyType = "";
} 


function resizeFrame() { 
	var paFRheight = 0;
	if (ifrm && !window.opera){
		ifrm.style.display="block"
		if (ifrm.contentDocument && ifrm.contentDocument.body.offsetHeight) //ns6 syntax
		{
			paFRheight = ifrm.contentDocument.body.offsetHeight+16; 
		}
		else if (document.all && ifrm.document.body.scrollHeight) //ie5+ syntax
		{
			paFRheight = ifrm.document.body.scrollHeight;			
		}
		ifrm.style.height = 350 + "px";
	}	
}

makeFrame();
resizeFrame();


