var screenwidth = screen.width; if (screenwidth <= 1024) { document.write('<link rel="stylesheet" href="css/small.css" type="text/css" media="screen" />'); }

ddsmoothmenu.init({
	mainmenuid: "smoothmenu1",
	orientation: 'h',
	classname: 'ddsmoothmenu',
	contentsource: "markup"
})

$(document).ready(function() {
	
	$('textarea.mceBericht').tinymce({
		// Location of TinyMCE script
		script_url : '/scripts/tiny_mce/tiny_mce.js',

		// General options
		theme : "advanced",
		height : "200",
		width  : "500",
		relative_urls : false, 
		skin : "o2k7",
		paste_strip_class_attributes : "all",
		paste_remove_spans : true,
		paste_remove_styles : true,
		plugins : "emotions,media",
		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,emotions,separator,bullist,numlist,separator,link,unlink,image,media",
		theme_advanced_buttons2: "",
		theme_advanced_buttons3: "",
		theme_advanced_disable : "formatselect,cleanup,justifyleft,justifycenter,justifyright,justifyfull,tablecontrols,hr,removeformat,visualaid,charmap,safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,help,styleselect,preview,anchor,hr,removeformat,visualaid,charmap,iespell,advhr,liststyle,sub,sup",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "none",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "/css/tinymce.css"

	});

	$("a.spotlight").fancybox({
		'overlayShow'		: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic'
	});

	$("a.agendapunt").fancybox({
		'overlayShow'		: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic'
	});

	$("a.fancybox").fancybox({
		'overlayShow'		: true,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Afbeeldingen op deze pagina: ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
	
	$("a.video").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'			: 680,
				'height'		: 495,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
					 'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});
	
		return false;
	});

	$("a.iframe").fancybox({
		'width'				: 730,
		'height'			: 600,
		'overlayShow'		: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'				: 'iframe'
	});

	$("a.bestuursdocs").fancybox({
		'width'				: '100%',
		'height'			: '100%',
		'overlayShow'		: true,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});

	$("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true); 

	$("#slider").sudoSlider({
		continuous: true,
		prevNext: 	false,
		speed:		'2000',
		pause: 		'1500',
		updateBefore: true,
		auto:		true
	});

	$(".ads").sudoSlider({
		continuous: true,
		prevNext: 	false,
		speed:		'600',
		pause: 		'4000',
		auto:		true
	});
	
/*
	$(".ads_bordsponsors").sudoSlider({
		continuous: true,
		prevNext: 	false,
		speed:		'600',
		pause: 		'4000',
		fade: 		true,
		auto:		true
	});
*/

	$(".ads_bordsponsors_klein").sudoSlider({
		continuous: true,
		prevNext: 	false,
		speed:		'600',
		pause: 		'4000',
		auto:		true
	});

	var icons = {
		header: "accordion_close",
		headerSelected: "accordion_open"
	};
	// Accordion
	$(".accordion").accordion({
		autoHeight: false,
		header: "h4",
		fillSpace: false,
		alwaysOpen: false,
		navigation: true,
		collapsible: true,
		active: false,
		icons: icons
	});
	$("#toggle").button().toggle(function() {
		$(".accordion").accordion("option", "icons", false);
	}, function() {
		$(".accordion").accordion("option", "icons", icons);
	});
	
	$(".accordion_sub").accordion({
		autoHeight: false,
		header: "h6",
		fillSpace: false,
		alwaysOpen: false,
		navigation: true,
		collapsible: true,
		active: false,
		icons: icons
	});
	$("#toggle_sub").button().toggle(function() {
		$(".accordion_sub").accordion("option", "icons", false);
	}, function() {
		$(".accordion_sub").accordion("option", "icons", icons);
	});


	var mobile = function(){
		return {
			detect:function(){
				var uagent = navigator.userAgent.toLowerCase(); 
				var list = this.mobiles;
				var ismobile = false;
				for(var d=0;d<list.length;d+=1){
					if(uagent.indexOf(list[d])!=-1){
						ismobile = true;
					}
				}
				return ismobile;
			},
			mobiles:[
				"midp","240x320","blackberry","netfront","nokia","panasonic",
				"portalmmm","sharp","sie-","sonyericsson","symbian",
				"windows ce","benq","mda","mot-","opera mini",
				"philips","pocket pc","sagem","samsung","sda",
				"sgh-","vodafone","xda","palm","iphone",
				"ipod","android"
			]
		};
	}();

	if(mobile.detect()){ }
	else {	
		$.sifr({
			path: '/scripts/sifr/resources/',
			save: true
		});
		$('h1').sifr({ font: 'segoe_print' });
		$('h2').sifr({ font: 'segoe_print' });
		$('h5').sifr({ font: 'segoe_print' });
	}

});

/* Google Analytics */

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1696430-20']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
