/*
	MUS - Multimedia Unieke Service
	Basis javascripts
	05-10-2010 - www.m-us.nl
	door: Bas Muskens
*/

// form validate
$(document).ready(function(){
	$("#cntnt01moduleform_1").validate();
	$("#m1ce37moduleform_1").validate();
	$("#m1ce37moduleform_2").validate();
});

// home icoontje op scherm voor ie
$(document).ready(function(){
	$("#navigatie ul.menu li:nth-child(1) a").css({
				'background': 'url(img/new/navHome.png) no-repeat top left',
				'width': '15px',
				'text-indent': '-5000px',
				'float': 'left',
				'display': 'block'
			});
});

// Font-size changer
var sitefunctions = {
	textresize : function(){
		// show text resizing links
		$(".FontSize").show();
		var $cookie_name = ".FontSize";
		var originalFontSize = $("html").css("font-size");
		// if exists load saved value, otherwise store it
		if($.cookie($cookie_name)) {
			var $getSize = $.cookie($cookie_name);
			$("html").css({fontSize : $getSize + ($getSize.indexOf("px")!=-1 ? "" : "px")}); // IE fix for double "pxpx" error
		} else {
			$.cookie($cookie_name, originalFontSize);
		}
		// reset link
		$(".resetFont").bind("click", function() {
			$("html").css("font-size", originalFontSize);
			$.cookie($cookie_name, originalFontSize);
		});
		// text "+" link
		$(".decreaseFont").bind("click", function() {
			var currentFontSize = $("html").css("font-size");
			var currentFontSizeNum = parseFloat(currentFontSize, 10);
			var newFontSize = currentFontSizeNum*1.1;
			if (newFontSize,  11) {
				$("html").css("font-size", newFontSize);
				$.cookie($cookie_name, newFontSize);
			}
			return false;	
		});
	}
}
$(document).ready(function(){
		sitefunctions.textresize();	
})


//  Movie scroll op home
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

jQuery(function( $ ){
	$('.intro').serialScroll({
		target:'#selectie',
		items:'li.first', 
		prev:'img.vorige',
		next:'img.volgende',
		axis:'xy',
		start: 0,
		duration:400,
		force:true,
		interval:0,
		
		onBefore:function( e, elem, $pane, $items, pos ){
			e.preventDefault();
			if( this.blur )
				this.blur();
		},
		onAfter:function( elem ){
		}
	});

});

// Twitter API koppeling 
   	getTwitters('twitter', {
        id: 'stralendelach', 
        prefix: '<a href="http://twitter.com/%screen_name%">@%screen_name%</a>', 
        clearContents: false,
        count: 1, 
        withFriends: false,
        ignoreReplies: true,
        newwindow: true
   });
   
// foto album
$(function() {
	$('ul#certificaten li a').lightBox();
});

// Nieuwe pagina openen 
	$(function(){
		$('a.newWindow').click(function(){
			window.open(this.href);
			return false;
		});
	});

	
// ie6 melding 
function badBrowser(){
	if($.browser.msie && parseInt($.browser.version) <= 6){ return true;}
	return false;
}

function getBadBrowser(c_name)
{
	if (document.cookie.length>0)
	{
	c_start=document.cookie.indexOf(c_name + "=");
	if (c_start!=-1)
		{ 
		c_start=c_start + c_name.length+1; 
		c_end=document.cookie.indexOf(";",c_start);
		if (c_end==-1) c_end=document.cookie.length;
		return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}	

function setBadBrowser(c_name,value,expiredays)

{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

if(badBrowser() && getBadBrowser('browserWarning') != 'seen' ){
	$(function(){
		$("<div id='browserWarning'>You are using an <strong>unsupported</strong> browser. Please switch to <a href='http://getfirefox.com'><strong>FireFox</strong></a>, <a href='http://www.google.com/chrome/'><strong>Chrome</strong></a>, <a href='http://www.apple.com/safari/'><strong>Safari</strong></a> or <a href='http://www.microsoft.com/windows/downloads/ie/getitnow.mspx'><strong>Internet Explorer 7 or 8</strong></a>. Thanks!&nbsp;&nbsp;&nbsp;[<a href='#' id='warningClose'>close</a>] </div> ")
			.css({
				backgroundColor: '#fcfdde',
				'width': '100%',
				'color': 'black',
				'font-size': '14px',
				'border-bottom': 'solid 1px #000',
				'text-align': 'center',
				padding:'5px 0px 5px 0px'
			})
			.prependTo("body");	

		$('#warningClose').click(function(){
			setBadBrowser('browserWarning','seen');
			$('#browserWarning').slideUp('slow');
			return false;
		});
	});	
}

