var Pilli = {

	baseURL : 'http://ilan.pilli.com/g?s=__site_id__&u=__unit_id__&t=__time__',
	
	frameWidth : ( window.p_width ) ? p_width : 270, 
	frameHeight : 300 || p_height,
	style : window.p_style ? p_style : '',
	el_id: 'pilli_if_' + p_site_id + '_' + p_unit_id,
	prepareIframeTag : function (){
		var	url = this.baseURL.replace('__site_id__',p_site_id);
		url = url.replace('__unit_id__',p_unit_id);
		var d = new Date(); 
		url = url.replace('__time__',d.getTime());
//		s = '<i'+ 'frame id="'+this.el_id+'" src="'+url+'" width="'+this.frameWidth+'" height="'+this.frameHeight+'"' +  
//			' frameBorder="0" scrolling="no" hspace="0" vspace="0" allowtransparency="true" marginheight="0" marginwidth="0">';
//		s += '</if' + 'rame>';
		s = '<div id="pilli_if_'+p_site_id+'_'+p_unit_id+'" style="width:'+this.frameWidth+'px; '+this.style+' "' + 
			'><scr'+ '' +'ipt src="'+url+'" ></script></div>';
		return s;
	},
	getIframeHeight: function(){
		var iframe = document.getElementById(this.el_id);
		var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
		var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0; //extra height in px to add to iframe in FireFox 1.0+ browsers
		
		if (iframe.contentDocument && iframe.contentDocument.body.offsetHeight){ //ns6 
			height = iframe.contentDocument.body.offsetHeight+FFextraHeight;
		} else if (iframe.Document && iframe.Document.body.scrollHeight){ //ie5+ 
			height = iframe.Document.body.scrollHeight;
		}
		return height;
	},
	writeAd : function (){
		document.write(this.prepareIframeTag());
		//document.getElementById(this.el_id).height = this.getIframeHeight();
	}
}
Pilli.writeAd();