var zones_str = '';
var adsloaded=false;
var delivered = Array();
for (i in zones)
{
	zones_str+=zones[i] + '%3D' + zones[i].substring(4) + '|';
}
var loc=window.location.href;
var r=Math.floor(Math.random()*99999999);
var file=location.protocol=='https:'?'https://ad.bold.dk/spc.php':'http://ad.bold.dk/spc.php';
var charset=(document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
var url=file+'?zones='+zones_str+'&nz=1&source=&r='+r+'&charset='+charset+'&loc='+loc;
jQuery.getScript(url, function(){
	for (i in zones)
	{
		openIframeTimed(zones[i]);
	}
});




function prepareIframe(zone, width, height) {
    //document.write('<iframe src="" id="i'+zone+'" width='+width+' height='+height+' marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no>');
	var $frame = jQuery('<iframe src="" id="i'+zone+'" width='+width+' height='+height+' marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no>')
    jQuery('#'+zone).html( $frame );
}; 

function openIframe(zone) {
	jQuery('#i'+zone).attr('src', "/ad/giggs_project/giggs_iframe.html#"+zone); 
}; 

function getContent(zone) {
	if (typeof(OA_output[zone]) != 'undefined') {
		delivered[zone]=true;
		return OA_output[zone];
	}else{
		return '<script language="JavaScript" type="text/javascript">'+
				'setTimeout(function(){'+
					'location.reload(true)'+
				'},125);'+
				'</script>';
	} 
}; 

function openIframeTimed(zone) {
	setTimeout(function(){
		if (typeof(OA_output[zone]) != 'undefined') {
			openIframe(zone);
		}
		else {
			openIframeTimed(zone);
		};
	},125); 
}; 
