hbbase = "http://flyingpenguinsmedia.com/";
hblib = "adnet/";
hbfile = "ad.php";
hbq = "type=hb&";
hbmExt = Math.floor(Math.random()*9871);
td = window.location.hostname;
$domain = (td.split('www.').length>1) ? td : "www."+td;
hbrandExt = "se="+hbmExt+"&domain="+$domain;

function requestXSS( tmpsite, callback ) {
	if ( !tmpsite ){
		alert('No site was passed.');
		return false;
	}
	var yql = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent('select * from html where url="' + tmpsite + '"') + '&format=xml&callback=?';
	$.getJSON( yql, cbFunc );

	function cbFunc(data){
	if ( data.results[0] ) {
		data = data.results[0].replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '');
		if ( typeof callback === 'function') {
			callback(data);
		}
	}
	else throw new Error('Nothing returned from getJSON.');
	}
}

hbbaseurl = hbbase+hblib+hbfile+"?"+hbq+hbrandExt;

//Do load
$(function(){
	$('#fpm_hb').ready(function(){
	hbparentWidth = $('#fpm_hb').parent('div').width();
	hbparentHeight = $('#fpm_hb').parent('div').height();
	ext = "?w="+hbparentWidth+"&"+"h="+hbparentHeight;
		$('#fpm_hb').ready(function(){
			requestXSS(hbbaseurl,function(hb_results){ 
			$('#fpm_hb').html(hb_results);
			});
		});
	});
	
//long banner
	
//END
});
