function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
	thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
	thisfield.value = defaulttext;
	}
}


jQuery(function(){
	// Accordion on home page
	$("#accordion").accordion({ header: "h2", autoHeight: false, collapsible: true });

	// Grid options on results page
	$('.grid').tabs();


	// Dialog
	$('.modalwindow').dialog({
		autoOpen: false,
		modal: true,
		width: 550,
		resizable: false,
		buttons: {
			"Sluit venster": function() { 
				$(this).dialog("close"); 
			} 
		}
	});
	
	// Dialog Link
	$('.openmodal').click(function(){
		$('.modalwindow').dialog('open');
		return false;
	});

});

jQuery(function($) {
	$('.pop_shoplist').each(function() {
		var $link = $(this);
		var $dialog = $('<div></div>')
			.load($link.attr('href'))
			.dialog({
				autoOpen: false,
				modal: true,
				width:570,
				resizable: false,
				closeOnEscape: true
			});

		$link.click(function() {
			$dialog.dialog('open');
			return false;
		});
	});
});

jQuery(function ($) {
    $('.pop_tellfriend').each(function () {
        var $link = $(this);
        var $dialog = $('<div></div>')
            .html('<iframe src="' + $link.attr('href') + '" width="100%" height="100%" scrollbar="no" frameborder="0"/>')
			.dialog({
			    autoOpen: false,
			    modal: true,
			    width: 600,
			    height: 590,
			    resizable: false,
			    closeOnEscape: true
			}).bind('dialogclose', function (event, ui) {
			    iFrame = event.target.firstChild.contentWindow.location;
			    iFrame.href = iFrame.href;
			});

        $link.click(function () {
            $dialog.dialog('open');
            return false;
        });
    });
});	

jQuery(function($) {
	$('.pop_verlanglijstje').each(function() {
		var $link = $(this);
		var $dialog = $('<div></div>')
			.load($link.attr('href'))
			.dialog({
				autoOpen: false,
				modal: true,
				width:600,
				resizable: false,
				closeOnEscape: true
			});

		$link.click(function() {
			$dialog.dialog('open');
			$('a.subpop_password').click(function(){
					$dialog.load('modal/password.html');
					return false;
				});
			return false;
			});
	});
});


jQuery(function ($) {
    $('.pop_sendbyemail').each(function () {
        var $link = $(this);
        var $dialog = $('<div></div>')
            .html('<iframe src="' + $link.attr('href') + '" width="100%" height="100%" scrollbar="no" frameborder="0"/>')
			.dialog({
			    autoOpen: false,
			    modal: true,
			    width: 600,
			    height: 350,
			    resizable: false,
			    closeOnEscape: true
			});

        $link.click(function () {
            $dialog.dialog('open');
            return false;
        });
    });
});	

jQuery(function($) {
	$('.pop_product').each(function() {
		var $link = $(this);
		var $dialog = $('<div></div>')
			.load($link.attr('href'))
			.dialog({
				autoOpen: false,
				modal: true,
				width:600,
				resizable: false,
				closeOnEscape: true
			});

		$link.click(function() {
			$dialog.dialog('open');
			return false;
		});
	});
});

jQuery(function ($) {
    $('.pop_password').each(function () {
        var $link = $(this);
        var $dialog = $('<div></div>')
            .html('<iframe src="' + $link.attr('href') + '" width="100%" height="100%" scrollbar="no" frameborder="0"/>')
			.dialog({
			    autoOpen: false,
			    modal: true,
			    width: 380,
			    resizable: false,
			    title: $link.attr('title'),
			    closeOnEscape: true,
			    close: function () { location.reload(true); }
			});

        $link.click(function () {
            $dialog.dialog('open');

            return false;
        });
    });
});


jQuery(function($) {
    $('.pop_tc').each(function() {
        var $link = $(this);

        $link.click(function() {

            var $dialog = $('<div></div>')
            .html('<iframe src="' + $link.attr('href') + '" width="100%" height="100%" scrollbar="no" frameborder="0"/>')        
			.dialog({
			    autoOpen: false,
			    modal: true,
			    width: 600,
			    height: 600,
			    resizable: false,
			    closeOnEscape: true
			});
        
            $dialog.dialog('open');
            return false;
        });
    });
});

