//does the banner writing thing


function writeBanner(zoneid,block,blockcampaign,target,sizes,keywords)
{
   zone = banner_mappings[zoneid];
   
   //alert("writing banner no " +zone +" was: "+zoneid);
   
   if(!(sizes.length && sizes[0]!=undefined && sizes[0].length!=null && sizes[0].length>3))
   {
     temp = sizes;
     sizes = new Array();
     sizes[0]=temp;
   }
   
   if(!(zone.length))
   {
     temp = zone;
     zone = new Array();
     zone[0]=temp;
   }

   phpAds_output = "";

   if (!document.phpAds_used)
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   phpAds_output+= ("<script language='JavaScript' type='text/javascript' src='http://phpads.hippo.nl/adx.js'></script>");
   phpAds_output+= ("<script language='JavaScript' type='text/javascript' src='");
   phpAds_output+= ("http://phpads.hippo.nl/adjs.php?n=" + phpAds_random);
   phpAds_output+= ("&amp;what=");
   
   for(i=0; i<zone.length; i++)
   {
     phpAds_output+= ("zone:"+zone[i]);
     if(i<(zone.length-1))
       phpAds_output+= ("|");
   }

   
   if(block!=null)
       phpAds_output+= ("&amp;block="+block);
   if(target!=null)
       phpAds_output+= ("&amp;target="+target);
   phpAds_output+= ("&amp;blockcampaign="+blockcampaign+"");
   
   //alert(document.phpAds_used);
   if(document.phpAds_used!=null)
     bannerkeys=document.phpAds_used.split(",");
     
   if(bannerkeys.length>0)
   {
      document.phpAds_used=",";
      for(i=0;i<bannerkeys.length;i++)
      {
         if(bannerkeys[i].indexOf('bannerid')>-1)
         {
           document.phpAds_used+=bannerkeys[i]+',';
         }
      }
   }
   
   //alert(document.phpAds_used);
   phpAds_output+= ("&amp;exclude=" + document.phpAds_used);	   
   if (document.referer)
   {
      phpAds_output+= ("&amp;referer=" + escape(document.referer));
   }
   phpAds_output+= ("'></script>");
   
   //alert(phpAds_output);
   document.write(phpAds_output);
}


function writeFirstBanner(zoneid,block,blockcampaign,target,sizes,keywords)
{
   zone = banner_mappings[zoneid];
   
   //alert("writing banner no " +zone +" was: "+zoneid);

   if(!(sizes.length && sizes[0]!=undefined && sizes[0].length!=null && sizes[0].length>3))
   {
     temp = sizes;
     sizes = new Array();
     sizes[0]=temp;
   }
   if(!(zone.length))
   {
     temp = zone;
     zone = new Array();
     zone[0]=temp;
   }
   
   phpAds_what = "";
   phpAds_output = "";

   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   phpAds_output+= ("<" + "script language='JavaScript' type='text/javascript' src='http://phpads.hippo.nl/adx.js'></script>");
   phpAds_output+= ("<" + "script language='JavaScript' type='text/javascript' src='");
   phpAds_output+= ("http://phpads.hippo.nl/adjs.php?n=" + phpAds_random);
   phpAds_output+= ("&amp;what=");
   
   for(i=0; i<zone.length; i++)
   {
     phpAds_output+= ("zone:"+zone[i]);
     //phpAds_what+= ("zone:"+zone[i]);
     if(i<(zone.length-1))
     {
       phpAds_output+= ("|");
       //phpAds_what+= ("|");
     }
   }
   //alert(keys.length+" "+phpAds_what);
   
   if(block!=null)
       phpAds_output+= ("&amp;block="+block);
   if(target!=null)
       phpAds_output+= ("&amp;target="+target);
   if(blockcampaign!=null)
	     phpAds_output+= ("&amp;blockcampaign="+blockcampaign+"");
   phpAds_output+= ("&amp;exclude=" + document.phpAds_used);	   
   if (document.referer)
   {
      phpAds_output+= ("&amp;referer=" + escape(document.referer));
   }
   phpAds_output+= ("'></script>");
   
   //alert(phpAds_output);
   document.write(phpAds_output);

}

function loadJavaScript(file,el)
{
	alert("About to load this: "+file+" into element "+el);
	return;

	if(!el)
	{
		head = document.getElementsByTagName('head').item(0);
		if(!head)
			return;
	}
	else
		head = el;
		
	script = document.createElement('script');
	script.src = file;
	script.type = "text/javascript";
	//script.defer = true;
	void( head.appendChild(script) );
}