
var brit = {src: 'http://www.opreisgids.nl/swf/brit.swf'};
sIFR.activate(brit);

sIFR.replace(brit, {
  selector: '.stitel',
  wmode: 'transparent'
});

sIFR.replace(brit, {
  selector: '.fp_titel, .fp_titel2',
  wmode: 'transparent',
  css: [
    'a { text-decoration: none; }',
    'a:link { color: #cb252b; }',
    'a:hover { color: #000000; }'
  ]
});


$(function(){
	
	setTimeout(function(){
		$(".fp_titel, .fp_titel2").css("visibility","visible");
	},500);

	$(".mid .bericht_inhoud img, .mid .doc_inhoud img").css("margin","5px");
	
	
	$(".togglebericht").click(function(){
		$("#themabericht").slideToggle();
	});
	

	$(".hover").hover(
		function(){
			$(this).css("color","#4f4f4f");
		},
		function(){
			$(this).css("color","black");
		}
	)
	
	
	$(".opac").hover(
		function(){
			$(this).attr("class","opacfull");
		},
		function(){
			$(this).attr("class","opac");
		}
	)
	
	
	$(".hover").click(function(){
		redir($(this).attr("link"));
	});
	

    $(".newsline").hover(
    	function(){
    		$(this).find("img").attr("src","/images/website/travel.gif");
    	},
    	function(){
    		$(this).find("img").attr("src","/images/website/case_light.jpg");
    	}
    );
    
    $("#imggroup a, div.mid a.fancyimg, .imggroup a").fancybox({
		'zoomSpeedIn':	0, 
		'zoomSpeedOut':	0, 
		'overlayShow':	true,
		'hideOnContentClick': true
	});

	

	
	
    

	
	
	/*
	$('h1').sifr( {
		font: '/swf/brit',
		textAlign: 'left'
	});
	*/
	
	/*
	$('.fp_titel, h1').flash({ 
            src: '/sifr/brit.swf', 
            wmode: 'transparent',
            flashvars: { 
                css: [
                    '* { color: #000000; text-align:left; }',
                    'a { color: #cb252b; text-decoration: none; }',
                    'a:hover { color: #cb252b; }'
                ].join(' ')
            }
        },{ version: 7 },
        function(htmlOptions) {
            htmlOptions.flashvars.txt = this.innerHTML;
            this.innerHTML = '<div>'+this.innerHTML+'</div>';
            var $alt = $(this.firstChild);
            htmlOptions.height = $alt.height();
            htmlOptions.width = $alt.width();
            $alt.addClass('alt');
            $(this)
                .addClass('flash-replaced')
                .prepend($.fn.flash.transform(htmlOptions));	
        }
    );
	
	
    $('h11').flash({ 
            src: '/_test/jfr-2.swf', 
            wmode: 'transparent',
            flashvars: { 
                css: [
                    '* { color: #000000; }',
                    'a { color: #0099CC; text-decoration: none; }',
                    'a:hover { text-decoration: underline; }'
                ].join(' ')
            }
        },{ version: 7 },
        function(htmlOptions) {
            htmlOptions.flashvars.txt = this.innerHTML;
            this.innerHTML = '<div>'+this.innerHTML+'</div>';
            var $alt = $(this.firstChild);
            htmlOptions.height = $alt.height();
            htmlOptions.width = $alt.width();
            $alt.addClass('alt');
            $(this)
                .addClass('flash-replaced')
                .prepend($.fn.flash.transform(htmlOptions));	
        }
    );
    */
    
	 $('.flashbanner').flash(null, { version: 8 }, function(htmlOptions) {
        var $this = $(this);
        var params = $this.attr('bestand');
        htmlOptions.src = params;
        htmlOptions.width = 200;
        htmlOptions.height = 123;
        this.innerHTML = '<div class="alt">'+this.innerHTML+'</div>';
        $this.addClass('flash-replaced').prepend($.fn.flash.transform(htmlOptions));
    });

	
	
	$(".buttonleft").hover(
		function(){
			$(this).attr("class","buttonlefthover");
		},
		function(){
			$(this).attr("class","buttonleft");
		}
	)
	
	
	
	$(".navbut").click(function(){
		
		if($(this).attr("link")){
			
			document.location.href = $(this).attr("link");
		}
	});
		

    $(".navbut").hover(
    	function(){   		
    		$("#menu, #menu-shadow").remove();
    		
    		$(this).attr("class","navbuthover");
    		
    		var html = $(this).find(".mc").html();
    		if(!html) return;

    		var o = $(this).offset();
			var h = $(this).height();

			if($(this).attr("type") == "wide"){
				$(".page").append( '<div id="menu" style="display:none;z-index:100;background:white;position:absolute;left:0px;top:'+(o.top+60)+'px;width:990px;"></div>' );
				$("#menu").append( html );
				$(".page").append('<div id="menu-shadow" style="z-index:99;background:black;position:absolute;width:'+($("#menu").width()+6)+'px;height:'+($("#menu").height())+'px;left:-2px;top:'+(o.top+64)+'px;"></div>');
			} else {
				
				if($(window).width()>990){
					l = o.left-(($(window).width()-990)/2);
				} else {
					l = o.left;
				}
				
				$(".page").append( '<div id="menu" style="display:none;z-index:100;background:white;position:absolute;left:'+l+'px;top:'+(o.top+32)+'px;"></div>' );
				$("#menu").append( html );
				$(".page").append('<div id="menu-shadow" style="z-index:99;background:black;position:absolute;width:'+($("#menu").width()+6)+'px;height:'+($("#menu").height())+'px;left:'+(l-2)+'px;top:'+(o.top+36)+'px;"></div>');
			}
			
			
			$("#menu-shadow").hide().css("opacity","0.05");
			$("#menu, #menu-shadow").slideDown("slow");
			
			$("#menu").hover(
				function(){},
				function(){
					//$("#menu").fadeOut("fast",function(){
						$("#menu, #menu-shadow").remove();
					//});
				}
			);
			
    	},
    	function(){
    		$(this).attr("class","navbut");
    	}
    );
	
    
    $("#zoeken").autocomplete("/static/search.php", {
		selectFirst: true,
		minChars: 3,
		delay: 200,
		width:320,
		scrollHeight:300,
		max: 30,
		cacheLength: 1,
		matchSubset: false,
		formatItem: function(row, i, max) {
			return '<img src="/images/website/flags/'+row[0]+'" /> ' +row[1];
		}
	});
	$("#zoeken").result(function(event, data, formatted) {
	if (data)
		//$("#zoeken").val( data[1] );
		document.location.href = data[2];
		return false;
	});
	
	$("#emailform").validate({
		errorContainer: ".errorcontainer",
		errorLabelContainer: $(".errorcontainer ul"),
		wrapper: 'li',
		rules: {
			email: {
				required: true,
				email: true
			}
		},
		messages: {
			email: "Vul een geldig e-mailadres in."
		}
	});
	
	
});

function is_numeric( mixed_var ) {
	return !isNaN(mixed_var * 1);
}

function round ( val, precision ) {
	return parseFloat(parseFloat(val).toFixed(precision));
}

function redir(str){
	document.location.href = str;
}
