function track_link(thas)
{
	var dnow = new Date();
	if (thas.target != '_blank')
	{
		//this.target = dnow.getTime();
		//this.href = 'http://www.lastminuteszoeken.nl/frame.php?id=' + this.className;
		thas.target = "_blank";
	}
	else
	{
		if (!thas.done)
		{
			thas.href = thas.href.replace('l|', 'l|' + parseInt(dnow.getTime()/1000) + '|');
		}
	}
	
	if (document.cookie && !thas.done)
	{
		if (document.cookie.split('utmctr=')[1])
		{
			subid = /(\|[0-9]+){7,}/;
			if (thas.href.match(subid))
			{
				//this.href = this.href.replace(subid, this.href.match(subid)[0] + '|' + document.cookie.split('utmctr=')[1].split(';')[0]);	
			}
			if (thas.className.match(subid))
			{
				thas.className = thas.className.replace(subid, thas.className.match(subid)[0] + '|' + document.cookie.split('utmctr=')[1].split(';')[0]);	
			}					
		}
	}	
		
	thas.done = true;	
	document.getElementById('stats').src = 'http://lmz.euronovo.com/stats/' + thas.className + '.gif';	
}

function track_links()
{
	var aa = document.getElementById('kols').getElementsByTagName('a');
	
	for (var i = 0; i < aa.length; i++)
	{
		if (aa[i].className.indexOf('omhoog') == -1)
		{
			aa[i].onclick = function()
			{
				track_link(this);
			}
			
			aa[i].onmouseover = function()
			{
				this.old = window.status;
				window.status = '';
				return true;
			}
			aa[i].onmouseout = function()
			{
				window.status = this.old;
				return true;
			}
		}
	}
}

if (document.getElementById('pull1'))
{
	document.getElementById('pull1').onchange = function()
	{
		document.location.href = this.value;
	}
}

if (document.getElementById('pull2'))
{
	document.getElementById('pull2').onchange = function()
	{
		document.location.href = this.value;
	}
}	

function lmzoek_start()
{
	var pageid = document.body.id.substr(1,document.body.length);
	var tonen = 0;
	if ($('lmzoek_land'))
	{
		var selects = $('lmzoek_form').getElementsByTagName('select');
		for (i = 0; i < selects.length; i++)
		{
			selects[i].disabled = true;
			tonen += selects[i].options.selectedIndex;
		}
		new Ajax.Updater($('lmzoek'), "/engine.php?func=lmzoek",
		{
			method: "post",
			evalScripts: true,
			parameters: 
			{
				land: $('lmzoek_land').value,
				best: $('lmzoek_best').value,
				dat: $('lmzoek_dat').value,
				dg: $('lmzoek_duur').value,
				prijs: $('lmzoek_prijs').value,
				tonen: tonen, 
				pageid: pageid
			}
		});		
	}
	else
	{
		if ($('lmzoek').innerHTML != '')
		{
			tonen = 1;
		}		
		
		new Ajax.Updater($('lmzoek'), "/engine.php?func=lmzoek",
		{
			method: "post",
			evalScripts: true,
			parameters:
			{
				pageid: pageid,
				land: $('lmzoek').innerHTML,
				tonen: tonen,
				limit: 4
			}
		});
	}
}	

function lmzoek_result(start, limit)
{
	var pageid = document.body.id.substr(1,document.body.length);
	$('lmzoek_submit').style.display = 'none';
	new Ajax.Updater($('lmzoek_result'), "/engine.php?func=lmresult",
	{
		method: "post",
		evalScripts: true,
		parameters: 
		{
			land: $('lmzoek_land').value,
			best: $('lmzoek_best').value,
			dat: $('lmzoek_dat').value,
			dg: $('lmzoek_duur').value,
			prijs: $('lmzoek_prijs').value,
			start: start,
			limit: limit,
			pageid: pageid
		}
	});		
}

function lmzoek_reset()
{
	var pageid = document.body.id.substr(1,document.body.length);
	new Ajax.Updater($('lmzoek'), "/engine.php?func=lmzoek",
	{
		method: "post",
		evalScripts: true,
		parameters: 
		{
			land: '',
			best: '',
			dat: '',
			dg: '',
			prijs: '',
			tonen: '',
			pageid: pageid
		}
	});	
}	

if (document.getElementById('lmzoek'))
{
	lmzoek_start();
}

var pageid = document.body.id.substr(1,document.body.length);

if (pageid == 5129)
{
	var vpzoek = document.createElement('div');
	vpzoek.id = 'kol4';
	vpzoek.innerHTML = '<div class="blok"><h3>Zoek een park</h3><iframe src="http://www.park-vakanties.nl/vpzoek.php" noborder frameborder=0 style="border:0; width:192px;height:160px;"></iframe></div>';
	document.getElementById('kols').appendChild(vpzoek);
	document.getElementById('main').style.width = '1000px';
	// vpz
}

track_links();
