(function($){
	$(document).ready( function(){
		if ($('.tx-lumogooglemaps-pi1').length > 0) {
			$('.mapovaaerlay').corners('20px');
		}
		
		if ($('#logo_groot').length > 0) {

			var flashVars = {
					fv_link: "/"
				};

			var flashParams = {
				wmode: "transparent",
				allowfullscreen: "false",
				allowscriptaccess: "sameDomain"
			};
			swfobject.embedSWF("/fileadmin/template/html/main/flash/eneco_logo_big.swf", "logo_groot", "309", "282", "9.0.0", "/flash/expressInstall.swf", flashVars, flashParams);
		}

		if ($('#logo_klein').length > 0) {

			var flashVars = {
					fv_link: "/"
				};

			var flashParams = {
				wmode: "transparent",
				allowfullscreen: "false",
				allowscriptaccess: "sameDomain"
			};
			swfobject.embedSWF("/fileadmin/template/html/main/flash/eneco_logo_klein.swf", "logo_klein", "285", "260", "9.0.0", "/flash/expressInstall.swf", flashVars, flashParams);
		}
		
		if ($('#firstticket h2').length > 0) {
			Cufon.replace('#firstticket h2', { fontFamily: 'EtelkaMedium' });
		}
		if ($('#content-blocks h2 h2').length > 0) {
			Cufon.replace('#content-blocks h2', {fontFamily: 'EtelkaMedium'});
		}
		if ($('div.defaultpage h2').length > 0) {
			Cufon.replace('div.defaultpage h2', {fontFamily: 'EtelkaMedium'});
		}
		if ($('div#page_title h1').length > 0) {
			Cufon.replace('div#page_title h1', {fontFamily: 'EtelkaMedium'});
		}

		
		if ($('.tx-lagemeterstandenloterij-controller .deelnemer_home_in_exitperiod h3').length > 0) {
			Cufon.replace('.tx-lagemeterstandenloterij-controller .deelnemer_home_in_exitperiod h3', {fontFamily: 'EtelkaMedium'});
		}
		$('a[target="layer"]').each(function() {
			var $dialog = $('<div></div>');
			$dialog.load($(this).attr("href"));
			$(this).removeAttr("target");
			$(this).bind('click', function() {
				layer_title = $(this).attr("title");
				dialogOptions = {
					width: 875,
					position:["center",66],
					modal: true,
					bgiframe: true,
					title: layer_title,
					closeText: "Venster sluiten x",
					autoOpen: true,
					resizable: true,
					draggable: false,
					open: function(){
						Cufon.replace('.ui-dialog-title', {fontFamily: 'EtelkaMedium'});	
					},
					close: function(ev, ui) {
						$(this).remove();
					}
				};
				$dialog.dialog(dialogOptions)
				$dialog.dialog('open');
				return false;
			});
		});

		$('a[target="layer675"]').each(function() {
			var $dialog = $('<div></div>');
			$dialog.load($(this).attr("href"));
			$(this).removeAttr("target");
			$(this).bind('click', function() {
				layer_title = $(this).attr("title");
				dialogOptions = {
					width: 675,
					position:["center",66],
					modal: true,
					bgiframe: true,
					title: layer_title,
					closeText: "Venster sluiten x",
					autoOpen: true,
					resizable: true,
					draggable: false,
					open: function(){
						Cufon.replace('.ui-dialog-title', {fontFamily: 'EtelkaMedium'});	
					},
					close: function(ev, ui) {
						$(this).remove();
					}
				};
				$dialog.dialog(dialogOptions)
				$dialog.dialog('open');
				return false;
			});
		});

		
		if ($('.week_opdracht').length > 0) {
			$('.week_opdracht form input').each(function() {
				$(this).bind('click', function() {
					if ( ($('#opdracht1:checked').val()) && ($('#opdracht2:checked').val()) && ($('#answer_1:checked').val() || $('#answer_2:checked').val() || $('#answer_3:checked').val())) {
						$('button').attr('disabled', false);
						$('button').removeClass('disabled');
						
					} else {
						$('button').attr('disabled', true);
						$('button').addClass('disabled');
					}
				});
			});
		}
		
	});
})(jQuery);