/*
	setvat.js
	
	A small script to popup a dialog asking the user whether prices should be exclusive or inclusive of VAT
*/

function initVatDisplay()
{
	var cookieValue = '';
	var cookieName = 'ishop-vatmode';
	var posName = document.cookie.indexOf(escape(cookieName) + '=');

	if( posName != -1 )
	{
		var posValue = posName + (escape(cookieName) + '=').length;
		var endPos = document.cookie.indexOf(';', posValue);

		if (endPos != -1)
			cookieValue = unescape(document.cookie.substring(posValue, endPos));
		else
			cookieValue = unescape(document.cookie.substring(posValue));
	}
	
	// Ok, either cookieValue is an empty string (not set), or contains a '1' or '0' for vat on/off respectively
	if( cookieValue.length )		// Already set, ignore popup
		return;
		
	drawPopup( 'momsval', 1 );
}

if (window.addEventListener)
	window.addEventListener("load", initVatDisplay, false);
else if (window.attachEvent)
	window.attachEvent("onload", initVatDisplay );


