function Sligro_OnLoad()
{
	resize_iframe();
	SubmitDataToIframe();
	SetIframe();
}
function resize_iframe()
{
	myString = String(parent.location);
	myArray = myString.split('.nl/');
	if (myArray[1] != 'Pages/default.aspx' && myArray[1] != 'thema/Pages/default.aspx')
	{
		if (document.getElementById("anIframe") != null)
		{
			document.getElementById("anIframe").height=document.body.offsetHeight-document.getElementById("anIframe").offsetTop-120;
		}
	}
}
function showList()
{
	window.open("/wpresources/aanbiedingen/loading.htm","printlijst","height=500,width=430,status=yes,toolbar=no,menubar=yes,location=no,scrollbars=1,resizable=1");
}

/*function voegToe()
{
	count = 0
	var empty = 0;
	while (count < document.anIframe.artikelen.elements.length)	{
		if ((document.anIframe.artikelen.elements[count].type == 'checkbox') && (document.anIframe.artikelen.elements[count].checked))
		{
			lijst.artnummers.value = lijst.artnummers.value + ',' + document.anIframe.artikelen.elements[count].value;
			document.anIframe.artikelen.elements[count].checked = false;
			empty = 1;
		}
		count++;
	}
	if (empty == 0)
	{
		window.alert('Er zijn geen items geselecteerd.');
	}
	else
	{
		window.alert('Selectie toegevoegd aan lijst.');
	}
}*/

function voegToe()
{
	count = 0
	var empty = 0;
	while (count < parent.frames['anIframe'].document.artikelen.elements.length)	{
		if ((parent.frames['anIframe'].document.artikelen.elements[count].type == 'checkbox') && (parent.frames['anIframe'].document.artikelen.elements[count].checked))
		{
			document.lijst.artnummers.value = lijst.artnummers.value + ',' + parent.frames['anIframe'].document.artikelen.elements[count].value;
			parent.frames['anIframe'].document.artikelen.elements[count].checked = false;
			empty = 1;
		}
		count++;
	}
	if (empty == 0)
	{
		window.alert('Er zijn geen items geselecteerd.');
	}
	else
	{
		window.alert('Selectie toegevoegd aan lijst.');
	}
}

function check_postcode()
{
	if (document.forms[0].zipcode.value.match(/^[1-9][0-9]{3}\s*?[a-zA-Z]{2}$/))
	{
		DoPostcodeLookup();
		return false;
	}
	else
	{
		window.alert('De ingevulde postcode is niet geldig. Een geldige postcode bestaat uit 4 cijfers en 2 letters');
		document.forms[0].zipcode.value='';
		return false;
	}
}
function postcode_KeyDown(e)
{
	if (e.keyCode == 13 || e.keyCode==10) 
	{
		e.returnValue=false;
		if (check_postcode())
		{
			DoPostcodeLookup();
			return false;
		}
		else
		{
			return false;
		}
	}
	else
	{
		return true;
	}
}

function DoPostcodeLookup()
{
  var url = "/vestigingen/vestigingzoeker/Pages/Locatiezoeker.aspx?zipcode=__zipcode__";
  url = url.replace(/__zipcode__/g, document.forms[0].zipcode.value);
  window.location = url;
}
function changeImages()
{
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2)
		{
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
function SubmitDataToIframe()
{
	if (document.getElementById("anIframe") != null)
	{
		qString = parent.location.search.substring(1).split('=');
		if ((qString[0] == 'zipcode') && (qString[1] != ''))
		{
			document.invoerform.action = 'http://tools.locatienet.com/finder/address.asp'
			document.invoerform.resulttype.value = 'BEST';
			document.invoerform.client_id.value = '1491';
			document.invoerform.country.value = 'NL';
			document.invoerform.zipcode.value = qString[1];
			document.invoerform.submit();
		}
		
		if ((qString[0] == 'vestiging') && (qString[1] != ''))
		{
			document.invoerform.action = '/wpresources/vestigingen/postcode.asp'
			document.invoerform.vestiging.value = qString[1];
			document.invoerform.submit();
		}
	}
}
function SetIframe()
{
	myString = String(document.location);
	myArray = myString.split('?');
	if (myArray.length > 1)
	{
		qString = parent.location.search.substring(1).split('=');
		
		if (document.getElementById("anIframe") != null && myArray[1].search("zipcode") == -1 && myArray[1].search("vestiging") == -1)
		{
			window.frames['anIframe'].location = '/wpresources/aanbiedingen/standaard_mc.asp?' + myArray[1];
		}
	}
}

function zoekprijs(obj) {
	prijsrange = obj.value;
	window.frames['anIframe'].location='/wpresources/kerstpakketten/pakketten.asp?pcid=' + prijsrange;
	}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=940,height=600');");
}
