function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}

function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}

function change_subcategory(selectBox, catId, brandId)
{
	location.href = '/webshop/categorie/'+catId+','+selectBox.value+','+brandId+'/subcategorie.html';
}

function change_brand(selectBox, catId, subCatId, title)
{
	location.href = '/webshop/categorie/'+catId+','+subCatId+','+selectBox.value+'/merk.html';
}

function getURL(url)
{
	document.location.href = url;
}

/* onload event listener*/

Event.attach = function($target, $eventName, $eventHandler)
{
	$eventName = $eventName.toLowerCase();
	// ff
	if($target.addEventListener)
	{
		$eventName = $eventName.substr(2);
		$target.addEventListener($eventName, $eventHandler, false);
	}
	// ie
	else if($target.attachEvent)
	{
		$target.attachEvent($eventName, $eventHandler);
	}
	else
	{
		var $event = $target[$eventName];
		if(!($event && typeof($event) == 'function')) $target[$eventName] = $eventHandler;
		else
		{
			$target[$eventName] = function($e)
			{
				$event($e);
				$eventHandler($e);
			};
		}
	}
};

/*	Popup functies */
function SluitVenster() {
	document.getElementById('popup').style.display = 'none';
}
function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	var today = new Date();
	today.setTime( today.getTime() );
	
	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}
function dontShowAgain(pageId, value){
	var question= confirm("Weet u zeker dat u dit bericht niet meer wilt zien?");

	if (question == true)
	{
		//Set_Cookie( 'hidePopup_'+version, 'true', '365', '/', '', '' );
		Set_Cookie( 'bomij_show_popup_'+pageId, value, '365', '/', '', '' );
		SluitVenster();
	}
}
