function printAds(){
	var tmpArray    = returnRandom();
	var together    = new Array();
	var registered  = new Array();
	var banner =1;

	if ( cats.length > size ){
		while ( together.length < size ){
			tmpArray 	= returnRandom();

			if ( registered[tmpArray[1]] != 1 ){
				registered[tmpArray[1]] = 1;
				together.push( new Array( tmpArray[0],tmpArray[1],tmpArray[2],tmpArray[3]));
			} 
		}
	} else { 
		together	=	cats;
	}

	document.write('<table height=100% width=100%  cellspacing="0" cellpadding="2" border="0" class="white_speurders">');


	if (wide == true && together.length > 3){
		document.write('<tr>');

		document.write('<td rowspan=2 width=25% class="background_speurders">' );
		document.write(getLink(together[0][0],affiliate,aff_id));
		document.write(' class="anchor_speurders " TARGET="_blank">'+together[0][1]+'</a>'); 
		document.write('</td>');

		document.write('<td rowspan=2 width=25% class="white_speurders">' );
		document.write(getLink(together[1][0],affiliate,aff_id));
		document.write(' class="anchor_speurders " TARGET="_blank">'+together[1][1]+'</a>'); 
		document.write('</td>');

		document.write('<td rowspan=2 width=25% class="background_speurders">' );
		document.write(getLink(together[2][0],affiliate,aff_id));
		document.write(' class="anchor_speurders " TARGET="_blank">'+together[2][1]+'</a>'); 
		document.write('</td>');

		document.write('<td width=25% class="white_speurders">' );
		document.write(getLink(together[3][0],affiliate,aff_id));
		document.write(' class="anchor_speurders " TARGET="_blank">'+together[3][1]+'</a>'); 
		document.write('</td>');

		document.write('</tr>');
		document.write('<tr><td height=10px class="kop_speurders"  style="cursor:pointer" onClick="window.open(\'http://www.speurders.nl/\',\'speurders\') ;">');
		document.write('Speurders.nl</td></tr>');

	} else if(wide == false){
		for (i=0;i<together.length;i++){
			if ( i % 2 == 0 ){
				document.write('<tr class="white_speurders"><td>');
				document.write(getLink(together[i][0],affiliate,aff_id));
				document.write(' class="anchor_speurders " TARGET="_blank">'+together[i][1]+'</a>'); 
			} else {
				document.write('<tr class="background_speurders"><td>');
				document.write(getLink(together[i][0],affiliate,aff_id));
				document.write(' class="anchor_speurders background_speurders" TARGET="_blank">'+together[i][1]+'</a>'); 
			}
			document.write('</td></tr>');
		}
	}

	document.write('</table>');
}

function getLink(id,affiliate,aff_id){
	var ret ='<a href="http://www.speurders.nl/locator/locator.php?action=entrance&speurders_id=';
	ret += id +'&affiliate=' + affiliate;
	if ( aff_id !=null){
		ret += '&af_id=' + aff_id;
	}
	ret +=  append + '"';
	return ret;
}

function returnRandom(){
	return cats[ Math.round(Math.random()* (cats.length -1 )) ]; 
}
var cats = new Array();

function printStart(text){
	document.write('<table class="table_speurders white_speurders" style="table-layout:fixed;" cellspacing="0" cellpadding="0" border="0">');
	document.write(' <tr>')
	document.write(' <td valign=top align="center">');
	if (wide == false){
		document.write('<table width=100%  style="table-layout:fixed;" cellspacing="0" cellpadding="2" border="0" >');
		document.write('  <tr>');
		document.write('   <td width="100%" class="kop_speurders" id="headText"><b>'+text+'</b></td>');
		document.write('  </td>');
		document.write('  </tr>');
		document.write('  </table>');
	}
}
function printEnd(logo){
	if (wide == false){
		document.write('<tr>');
		document.write(' <td valign="bottom">');
		document.write('  <table cellspacing="0" cellpadding="0" border=0>');
		document.write('  <tr>');
		document.write('   <td class="td_speurders_botton">');

		document.write('<form name="speurders_form" method="GET" action="http://www.speurders.nl/overzicht/" target="_BLANK">');
		document.write('   <table width="100%" border="0" cellspacing="0" cellpadding="2">');
		document.write('     <tr><td class="search">');
		document.write('	<input type=hidden name="extern_call" value=1>');
		document.write('	<center><input type="text" name="q" class="textField"></center>');
		document.write('	<center><input type="button" class="button_speurders_zoek" value="Zoek" onClick="document.forms[\'speurders_form\'].submit()"></center><br>');
		document.write('   </td></tr>');
		document.write('  <tr>');
		document.write('   <td align="center">');
		document.write('     <a href="http://speurders.nl/" target="_blank">');
		document.write('     <img src="'+logo+'" width="110" height="13" border="0" alt="">');
		document.write('     </a>');
		document.write('   </td>');

		document.write('  </tr>');
		document.write('  </table>');
		document.write('</form>');

		document.write('</td>');
		document.write('</tr>');
	}

	document.write('</table>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
}

function printCSS(color,font,points,width,height){
	document.write('<style type="text/css">');
	document.write('a.anchor_speurders { text-decoration: none; font-family: '+font+'; font-size: '+points+'px; color: #000000; }');
	document.write('a.anchor_speurders:hover {  text-decoration: none;color: #000000; }');
	document.write('a.anchor_speurders:visited { text-decoration: none; color: #000000; }');
	document.write('a.anchor_speurders:active { text-decoration: none; color: #000000; }');
	document.write('.table_speurders {');
	document.write(' height: '+height+';');
	document.write(' padding:0px 0px 0px 0px;');
	document.write(' width:  '+width+';');
	document.write(' border: 1px solid black;');
	document.write('}');
	document.write('.td_speurders {');
	document.write('  margin: 0px;');
	document.write('  border: 0px solid;');
	document.write('  border-left: 0px solid;');
	document.write('  border-right: 0px solid;');
	document.write('  font-family: '+font +';');
	document.write('  font-size: '+points+'px;');
	document.write('}');
	document.write('');
	document.write('.td_speurders_bottom {');
	document.write('  margin: 0px;');
	document.write('  font-family: '+font+';');
	document.write('  font-size: '+points+'px;');
	document.write('}');
	document.write('.td_speurders_search{');
	document.write('      border:0px;');
	document.write('      padding:0px 0px 0px 0px;');
	document.write('      height:19px;');
	document.write('      background-color:#000000;');
	document.write('}');
	document.write('.textField{');
	document.write('      height:19px;');
	document.write('      width: '+ ( width - 20 )+'px;');
	document.write('}');
	document.write('');
	document.write('.background_speurders {');
	document.write('  background-color: #'+color+';');
	document.write('}');
	document.write('.kop_speurders{');
	document.write('	background-color:#000000;');
	document.write('	font-family:Arial, Helvetica, sans-serif;');
	document.write('	color:#FFFFFF;');
	document.write('	font-size:13px;');
	document.write('	text-align:center;');
	document.write('	border: 0px solid white;');
	document.write('}');
	document.write('.white_speurders {');
	document.write('  background-color: white;');
	document.write('}');
	document.write('.button_speurders_zoek {');
	document.write('	color: #FFF;');
	document.write('	font-weight: bold;');
	document.write('	font-color: #FFF;');
	document.write('	width: auto;');
	document.write('	border: 0px;');
	document.write('	background: #000000;');
	document.write('};');
	document.write('');
	document.write('.button_speurders');
	document.write('{');
	document.write('  font-size: 14px;');
	document.write('  background-color: #ff0066;');
	document.write('  border-color: #647a96;');
	document.write('  border-width: 1px;');
	document.write('  border-style: solid;');
	document.write('  padding: 2px;');
	document.write('}');
	document.write('</style>');
}

