var link_head  = document.createElement('link');
link_head.href  = "http://www.bestoccaz.com/plugins/js_blocks/js_blocks.css";
link_head.type = "text/css";
link_head.rel = "stylesheet";

document.getElementsByTagName('head').item(0).appendChild(link_head);

var $out ='';

$out +='<div id="jListingPaging"></div>';
				$out +='<div id="page_1" class="page">';
	
	$out += '<a class="jListingLink" href="http://www.bestoccaz.com/categorie/vehicules/voiture/renault/renault-clio-ii-2-1-5-dci-80-privilege-5p-l4704.html">';
	$out += '<div id="jlisting_4704" class="jListingItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)">';
	$out += '<table><tr><td><img class="jListingImg" src="http://www.bestoccaz.com/files/listing_thumbnail4704_18551931471328458285.jpg"></img></td>';
	$out += '<td valign="top"><div class="jListingFields">';
	$out +='<table>';
						$out +='<tr><td>';
			
							$out += '<span class="jListingFirst">Renault Clio ii (2) 1.5 dci 80 privilege 5p</span>';
						$out +='</td></tr>';
								$out +='<tr><td>';
			
							$out += '<span class="jListingValue">€ 2,000.00</span>';
						$out +='</td></tr>';
							$out +='</table>';
	$out += '</div></td></tr></table>';
	$out += '</div>';
	$out += '</a>';

		
	$out += '<a class="jListingLink" href="http://www.bestoccaz.com/categorie/vehicules/voiture/mazda/monospace-mazda-5-a-9500-sous-garantie-l4703.html">';
	$out += '<div id="jlisting_4703" class="jListingItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)">';
	$out += '<table><tr><td><img class="jListingImg" src="http://www.bestoccaz.com/files/listing_thumbnail4703_8468109711328094689.jpg"></img></td>';
	$out += '<td valign="top"><div class="jListingFields">';
	$out +='<table>';
						$out +='<tr><td>';
			
							$out += '<span class="jListingFirst">monospace mazda 5 à 9500 € sous garantie</span>';
						$out +='</td></tr>';
								$out +='<tr><td>';
			
							$out += '<span class="jListingValue">€ 9,500.00</span>';
						$out +='</td></tr>';
							$out +='</table>';
	$out += '</div></td></tr></table>';
	$out += '</div>';
	$out += '</a>';

		
	$out += '<a class="jListingLink" href="http://www.bestoccaz.com/categorie/vehicules/voiture/citroen/citroen-saxo-l4702.html">';
	$out += '<div id="jlisting_4702" class="jListingItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)">';
	$out += '<table><tr><td><img class="jListingImg" src="http://www.bestoccaz.com/files/listing_thumbnail4702_13435375341327071381.JPG"></img></td>';
	$out += '<td valign="top"><div class="jListingFields">';
	$out +='<table>';
						$out +='<tr><td>';
			
							$out += '<span class="jListingFirst">Citroen Saxo</span>';
						$out +='</td></tr>';
								$out +='<tr><td>';
			
							$out += '<span class="jListingValue">€ 2,300.00</span>';
						$out +='</td></tr>';
							$out +='</table>';
	$out += '</div></td></tr></table>';
	$out += '</div>';
	$out += '</a>';

		
	$out += '<a class="jListingLink" href="http://www.bestoccaz.com/categorie/vehicules/voiture/bmw/bmw-x3-3l-d-a-218-cv-l4701.html">';
	$out += '<div id="jlisting_4701" class="jListingItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)">';
	$out += '<table><tr><td><img class="jListingImg" src="http://www.bestoccaz.com/files/listing_thumbnail_6633786651326316388.jpg"></img></td>';
	$out += '<td valign="top"><div class="jListingFields">';
	$out +='<table>';
						$out +='<tr><td>';
			
							$out += '<span class="jListingFirst">BMW X3 3L D a  218 cv</span>';
						$out +='</td></tr>';
								$out +='<tr><td>';
			
							$out += '<span class="jListingValue">€ 24,500.00</span>';
						$out +='</td></tr>';
							$out +='</table>';
	$out += '</div></td></tr></table>';
	$out += '</div>';
	$out += '</a>';

		
	$out += '<a class="jListingLink" href="http://www.bestoccaz.com/categorie/vehicules/voiture/smart/smart-fortwo-passion-l4700.html">';
	$out += '<div id="jlisting_4700" class="jListingItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)">';
	$out += '<table><tr><td><img class="jListingImg" src="http://www.bestoccaz.com/files/listing_thumbnail4700_8418866031326119652.jpg"></img></td>';
	$out += '<td valign="top"><div class="jListingFields">';
	$out +='<table>';
						$out +='<tr><td>';
			
							$out += '<span class="jListingFirst">SMART FORTWO PASSION</span>';
						$out +='</td></tr>';
								$out +='<tr><td>';
			
							$out += '<span class="jListingValue">€ 5,990.00</span>';
						$out +='</td></tr>';
							$out +='</table>';
	$out += '</div></td></tr></table>';
	$out += '</div>';
	$out += '</a>';

								$out += '</div>';
			$out +='<div id="page_2" class="page jListingHide" >';
			var max_page = 2;
				
	$out += '<a class="jListingLink" href="http://www.bestoccaz.com/categorie/vehicules/voiture/toyota/toyota-verso-skyview-7p-l4699.html">';
	$out += '<div id="jlisting_4699" class="jListingItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)">';
	$out += '<table><tr><td><img class="jListingImg" src="http://www.bestoccaz.com/files/listing_thumbnail_291302931325703621.JPG"></img></td>';
	$out += '<td valign="top"><div class="jListingFields">';
	$out +='<table>';
						$out +='<tr><td>';
			
							$out += '<span class="jListingFirst">TOYOTA VERSO SKYVIEW 7P</span>';
						$out +='</td></tr>';
								$out +='<tr><td>';
			
							$out += '<span class="jListingValue">€ 19,000.00</span>';
						$out +='</td></tr>';
							$out +='</table>';
	$out += '</div></td></tr></table>';
	$out += '</div>';
	$out += '</a>';

		
	$out += '<a class="jListingLink" href="http://www.bestoccaz.com/categorie/vehicules/voiture/volkswagen/passt-break-2-0l-tdi-4motion-140cv-l4698.html">';
	$out += '<div id="jlisting_4698" class="jListingItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)">';
	$out += '<table><tr><td><img class="jListingImg" src="http://www.bestoccaz.com/files/listing_thumbnail_6652271481325079716.jpg"></img></td>';
	$out += '<td valign="top"><div class="jListingFields">';
	$out +='<table>';
						$out +='<tr><td>';
			
							$out += '<span class="jListingFirst">Passt break 2.0L TDI 4Motion 140CV</span>';
						$out +='</td></tr>';
								$out +='<tr><td>';
			
							$out += '<span class="jListingValue">€ 15,900.00</span>';
						$out +='</td></tr>';
							$out +='</table>';
	$out += '</div></td></tr></table>';
	$out += '</div>';
	$out += '</a>';

		
	$out += '<a class="jListingLink" href="http://www.bestoccaz.com/categorie/vehicules/voiture/seat/seat-ibiza-sc-l4697.html">';
	$out += '<div id="jlisting_4697" class="jListingItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)">';
	$out += '<table><tr><td><img class="jListingImg" src="http://www.bestoccaz.com/files/listing_thumbnail_15200565231325012645.JPG"></img></td>';
	$out += '<td valign="top"><div class="jListingFields">';
	$out +='<table>';
						$out +='<tr><td>';
			
							$out += '<span class="jListingFirst">seat ibiza sc</span>';
						$out +='</td></tr>';
								$out +='<tr><td>';
			
							$out += '<span class="jListingValue">€ 13,500.00</span>';
						$out +='</td></tr>';
							$out +='</table>';
	$out += '</div></td></tr></table>';
	$out += '</div>';
	$out += '</a>';

		
	$out += '<a class="jListingLink" href="http://www.bestoccaz.com/categorie/vehicules/voiture/mazda/mx5-na-1-8l-131cv-l4696.html">';
	$out += '<div id="jlisting_4696" class="jListingItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)">';
	$out += '<table><tr><td><img class="jListingImg" src="http://www.bestoccaz.com/files/listing_thumbnail_2755045471323977167.JPG"></img></td>';
	$out += '<td valign="top"><div class="jListingFields">';
	$out +='<table>';
						$out +='<tr><td>';
			
							$out += '<span class="jListingFirst">MX5 NA 1,8L 131cv</span>';
						$out +='</td></tr>';
								$out +='<tr><td>';
			
							$out += '<span class="jListingValue">€ 4,200.00</span>';
						$out +='</td></tr>';
							$out +='</table>';
	$out += '</div></td></tr></table>';
	$out += '</div>';
	$out += '</a>';

		
	$out += '<a class="jListingLink" href="http://www.bestoccaz.com/categorie/automobiles/ford/vds-ford-fiesta-titanium-1-4-tdci-3-portes-l4695.html">';
	$out += '<div id="jlisting_4695" class="jListingItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)">';
	$out += '<table><tr><td><img class="jListingImg" src="http://www.bestoccaz.com/files/listing_thumbnail4695_17091597741323721315.gif"></img></td>';
	$out += '<td valign="top"><div class="jListingFields">';
	$out +='<table>';
						$out +='<tr><td>';
			
							$out += '<span class="jListingFirst">VDS Ford fiesta titanium 1.4 tdci 3 portes</span>';
						$out +='</td></tr>';
								$out +='<tr><td>';
			
							$out += '<span class="jListingValue">€ 12,500.00</span>';
						$out +='</td></tr>';
							$out +='</table>';
	$out += '</div></td></tr></table>';
	$out += '</div>';
	$out += '</a>';

						
$out +='</div>';



function build()
{
	document.getElementById('jl').innerHTML = $out;

	var $paging = '';

	for(var i=1; i<=max_page; i++)
	{
		var page = document.getElementById('page_' + i);
		$paging +='<span class="jListingPageItem" onmouseover="changeCss(this)" onmouseout="restoreCss(this)" id="pg_' + i + '" onclick=pageClick('+ i +');>' + i + '</span>';
	}
	document.getElementById('jListingPaging').innerHTML = $paging;
	
	if(typeof(conf_img_width) != 'undefined'){
		setStyleByClass("img", 'jListingImg', "width", conf_img_width);}
	if(typeof(conf_img_height)!= 'undefined'){
		setStyleByClass("img", 'jListingImg', "height", conf_img_height);}

	if(typeof(conf_advert_bg)!= 'undefined'){
		setStyleByClass("div", 'jListingItem', "background", conf_advert_bg);}
	if(typeof(conf_advert_border)!= 'undefined'){
		setStyleByClass("div", 'jListingItem', "border", conf_advert_border);}

	if(typeof(conf_field_first_color)!= 'undefined'){
		setStyleByClass("span", 'jListingFirst', "color", conf_field_first_color);}
	if(typeof(conf_field_color)!= 'undefined'){
		setStyleByClass("span", 'jListingValue', "color", conf_field_color);}
	if(typeof(conf_field_names_color)!= 'undefined'){
		setStyleByClass("span", 'jListingField', "color", conf_field_names_color);}

	if(typeof(conf_paging_bg)!= 'undefined'){
		setStyleByClass("span", 'jListingPageItem', "background", conf_paging_bg);}
	if(typeof(conf_paging_border)!= 'undefined'){
		setStyleByClass("span", 'jListingPageItem', "border", conf_paging_border);}
}

function changeCss( obj )
{
	if( obj.className == 'jListingItem' )
	{
		if(typeof(conf_advert_bg_hover) != 'undefined'){
			obj.style.background = conf_advert_bg_hover;}
		if(typeof(conf_advert_border_hover) != 'undefined'){
			obj.style.border = conf_advert_border_hover;}
	}else if( obj.className == 'jListingPageItem' )
	{
		if(typeof(conf_paging_bg_hover) != 'undefined'){
			obj.style.background = conf_paging_bg_hover;}
		if(typeof(conf_paging_border_hover) != 'undefined'){
			obj.style.border = conf_paging_border_hover;}
	}
}

function restoreCss( obj )
{
	if( obj.className == 'jListingItem' )
	{
		if(typeof(conf_advert_bg) != 'undefined'){
			obj.style.background = conf_advert_bg;}
		if(typeof(conf_advert_border) != 'undefined'){
			obj.style.border = conf_advert_border;}
	}else if( obj.className == 'jListingPageItem' )
	{
		if(typeof(conf_paging_bg) != 'undefined'){
			obj.style.background = conf_paging_bg;}
		if(typeof(conf_paging_border) != 'undefined'){
			obj.style.border = conf_paging_border;}
	}
}

function pageClick(n)
{
	for(var k=1; k<=max_page; k++)
	{
		if(k==n)
		{	
			document.getElementById('page_' + k).className = 'page';
			document.getElementById('pg_' + k).className = 'active';

			if(typeof(conf_paging_bg_hover) != 'undefined' && typeof(conf_paging_border_hover) != 'undefined'){
				document.getElementById('pg_' + k).style.background = conf_paging_bg_hover;
				document.getElementById('pg_' + k).style.border = conf_paging_border_hover;
			}
		}
		else
		{
			document.getElementById('page_' + k).className = 'jListingHide';
			document.getElementById('pg_' + k).className = 'jListingPageItem';

			if(typeof(conf_paging_bg) != 'undefined' && typeof(conf_paging_border) != 'undefined'){
				document.getElementById('pg_' + k).style.background = conf_paging_bg;
				document.getElementById('pg_' + k).style.border = conf_paging_border;
			}		
		}
	}	
}

function setStyleByClass(t,c,p,v){
	var elements;
	if(t == '*') {
		elements = (ie) ? document.all : document.getElementsByTagName('*');
	} else {
		elements = document.getElementsByTagName(t);
	}
	for(var i = 0; i < elements.length; i++){
		var node = elements.item(i);
		for(var j = 0; j < node.attributes.length; j++) {
			if(node.attributes.item(j).nodeName == 'class') {
				if(node.attributes.item(j).nodeValue == c) {
					eval('node.style.' + p + " = '" +v + "'");
				}
			}
		}
	}
}

document.onready = build();





