    var sifr = {
      src: '/domains/stichtingstarter.nl_2/sifr/sifr.swf'
    };
	function do_sIFR(){
		sIFR.replace(sifr, {
		  selector: '#intro h1,#container.page #intro div.title h2'
			,filters: {
				 DropShadow: {
					distance: -1
				   ,color: '#6e480a'
				   ,strength: 1
				   ,alpha: 1
				   ,blurX: 1
				   ,blurY: 1
				 }
			   }
			,wmode: 'transparent'
			,css: [
			'.sIFR-root { font-size:44px; color:#f78525; }',
			'a { text-align:left; font-size:54px; color:#f78525; text-decoration:none; }',
			'a:hover { color:#f78525; }',
		 ]
		});
		
		sIFR.replace(sifr, {
		  selector: '#intro h2, #uploads h2, #footer .article.thirth_boxed h2'
			,filters: {
				 DropShadow: {
					distance: -1
				   ,color: '#6e480a'
				   ,strength: 1
				   ,alpha: 1
				   ,blurX: 1
				   ,blurY: 1
				 }
			   }
			,wmode: 'transparent'
			,css: [
			'.sIFR-root { font-size:24px; color:#f78525; }',
			'a { text-align:left; font-size:34px; color:#f78525; text-decoration:none; }',
			'a:hover { color:#f78525; }',
		 ]
		});
	
		sIFR.replace(sifr, {
		  selector: '#footer h2'
			,filters: {
				 DropShadow: {
					distance: -1
				   ,color: '#006699'
				   ,strength: 1
				   ,alpha: 1
				   ,blurX: 1
				   ,blurY: 1
				 }
				}
			,wmode: 'transparent'
			,css: [
			'.sIFR-root { font-size:34px; color:#ffffff; }',
			'a { text-align:left; font-size:34px; color:#ffffff; text-decoration:none; }',
			'a:hover { color:#ffffff; }',
		 ]
		});
	}
	do_sIFR();
    sIFR.useStyleCheck = false;
	sIFR.activate(sifr);
	
	
		
	//make uniqID
	var uid = (
		function(){
			var id=0;
			return function(){
				return id++ ;
			};
		}
	)();
	
	//emulate popup function...
	var popWindow = function(u,w,h,popEl){
		if(!popEl){
			e = u.substring(u.lastIndexOf('.')+1).toLowerCase();
			if(e == 'png' || e == 'gif' || e == 'jpg')
				popEl = $("<div class=\"popWindowDiv\" style=\"display:block;\"><img src=\""+ u +"\" width=\"" + w + "\" height=\"" + h + "\" border=\"0\" /></div>",{overlay:20});
			else
				popEl = $("<div class=\"popWindowDiv\" style=\"display:block;\"><iframe src=\""+ u +"\"  width=\"" + w + "\" height=\"" + h + "\" border=\"0\" frameborder=\"0\"></iframe></div>",{overlay:20});
		}
		popEl.modal({
				onOpen: function (dialog) {
							dialog.data.show();
							//dialog.data.addClass('alert');
							dialog.container.css('height','auto');
							dialog.overlay.fadeIn('normal', function () {
								dialog.container.show('normal', function () {
									//dialog.data.slideDown('normal'); // See Other Notes below regarding
															   // data display property and
															   // iframe details
								});
							});
						},
				onClose: function (dialog) {
							//dialog.data.slideUp('normal', function () {
							  dialog.container.hide('normal', function () {
								dialog.overlay.fadeOut('normal', function () {
								  $.modal.close(); // must call this to have SimpleModal
												   // re-insert the data correctly and
												   // clean up the dialog elements
								$('#alert').remove();
								});
							  });
							//});
						}
		});
		$("#modalContainer").css('width',w).css('margin-left',(w / 2) * -1).css('height',h).css('margin-top',(h / 2) * -1); 
	}
	
	
	var foundOnloadAlerts = new Array();
	var alert = function(str){
		foundOnloadAlerts[foundOnloadAlerts.length] = str;
	}
	

	function confirm(message, callback) {
		$('#alert').remove();
		o = $('<div id="alert" class="clear confirm"><span class="message"></span><br /><span class="no simplemodal-close button_small">Annuleer</span> <span class="yes button_small">Okay</span></div>');
		o.css('display','none').appendTo('body');

		$('#alert').modal({
			//closeHTML:"<a href='#' title='Close' class='modal-close'>x</a>",
			//position: ["20%",],
			//overlayId:'confirm-overlay',
			//containerId:'confirm-container', 
			onOpen: function (dialog) {
						dialog.data.show();

						w = 300;
						h = $('.message', dialog.data[0]).height();
						$("#modalContainer").css('width',w).css('margin-left',(w / 2) * -1).css('height',h).css('margin-top',(h / 2) * -1); 

						//dialog.data.addClass('alert');
						dialog.container.css('height','auto');
						dialog.overlay.fadeIn('normal', function () {
							dialog.container.show('normal', function () {
								//dialog.data.slideDown('normal'); // See Other Notes below regarding
														   // data display property and
														   // iframe details
							});
						});
					},
			onClose: function (dialog) {
						//dialog.data.slideUp('normal', function () {
						  dialog.container.hide('normal', function () {
							dialog.overlay.fadeOut('normal', function () {
							  $.modal.close(); // must call this to have SimpleModal
											   // re-insert the data correctly and
											   // clean up the dialog elements
								$('#alert').remove();
							});
						  });
						//});
					},
			onShow: function (dialog) {
				$('.message', dialog.data[0]).append(message);
	

				// if the user clicks "yes"
				$('.yes', dialog.data[0]).click(function () {
					// call the callback
					if ($.isFunction(callback)) {
						callback.apply();
					}
					// close the dialog
					$.modal.close();
				});
			}
		});
	}

	var doneFileUpload = function(s){
		resetUploadState();
		alert(s);
	}	

	var resetUploadState = function(){
		$('#uploads').load('/?module=service #uploads>.listing',addUploadDelClicks);
		$('form.filesubmit').removeClass('loading');
		$('form.filesubmit input').val('');
	}

	var statusUpload = function(s){
		$('.filesubmit .status span').html(s);
	}
	
	//file delete warning
	var addUploadDelClicks = function(){
		do_sIFR();
		$('#uploads .thumb .del').click(function(){
			var u = $(this).attr('href');
			confirm('<h1>Let op!</h1>Weet u zeker dat u deze afbeelding wilt verwijderen?',function(){
				$("#uploads").load(u + ' #uploads>.listing',addUploadDelClicks);
			});
			return false;
		});
	}

	//draw icons
	var drawicons = function(){
		var files = new Array('ai','avi','flv','bmp','cs','dll','doc','exe','fla','gif','jpg','js','mdb','pdf','png','ppt','rdp','txt','vsd','xls','xlsx','xml','zip');
		$("a[href]").not("a[href$=php],a[href$=html]").each(function(){
			if($.trim($(this).text())){
				p = $(this).attr("href").split('.');
				e = p[p.length - 1].toLowerCase();
				for(i in files)
					if(files[i] === e)
						$(this).addClass('inline_icon icon_' + e);
			}
		});
	}

			
	//onload init all stuff.
	$(document).ready(function(){
		
		//show next object
		if($("div.showNextObject").length && $("a.showNextObject").length){
			$("div.showNextObject").css('display','none');
			$("a.showNextObject").click(function(){
				o = $(this).next("div.showNextObject");
				if(!o.length){
					o = $(this).parents('.article').find("div.showNextObject");
				}
				$(this).remove();
				o.slideDown('normal');
				return false;
			});
		}

	
		//change cafe details
		if($(".startercafe_details_module").length){
			$(".startercafe_details_module .head a.button_big").click(function(e){
				e.preventDefault();
				$(".startercafe_details_module .aanmeld_form script").remove();
				popWindow('',500,$(".startercafe_details_module .aanmeld_form").innerHeight(),$(".startercafe_details_module .aanmeld_form"));
				return false;
			});
			if($('a[href="#popShops"]').length){
				$('a[href="#popShops"]').click(function(e){
					e.preventDefault();
					popWindow('',500,$(".startercafe_details_module .hypotheekshops").innerHeight(),$(".startercafe_details_module .hypotheekshops"));
					return false;
				});
			}
		}
		
		//cafe search input
		$('.startercafe_search_module .input').keyup(function(){
			if($(this).val()){
				$(this).removeClass('not_filled');
			}else{
				$(this).addClass('not_filled');
			}
		});

		//service stuff
		if($('.service_module').length){
/*			
			//file uploads
			$('form.filesubmit').change(function(){
				$(this).addClass('loading').submit();
			});
			if($.browser.safari == true || $.browser.webkit == true){
				$('form.filesubmit').addClass('webkitPatch');
			}
*/

			//build upload button
			var a = $('form.filesubmit').attr('action');
			$('form.filesubmit .button_big').attr('id','filesubmit')
			$('form.filesubmit .button_big input').remove();//.width(100).height(70);
			new AjaxUpload('#filesubmit', {
				action: a,
				name: 'upload',
				autoSubmit: true,
				responseType: 'json',
				onSubmit: function(file, extension) {
					$('#filesubmit').parents('form').addClass('loading');
				},
				onComplete: function(file, response) {
					$('#filesubmit').parents('form').removeClass('loading');
				}
			});

			
			$('div.screen.downloads').load('/service/downloads?no_404_error=true #intro>.margin>.article',function(){
				$('div.screen.shop').load('/service/shop?no_404_error=true #intro>.margin>.article',function(){
					$("div.screen").not('.start').find('div.title:eq(0)').after("<form class=\"back\"><input type=\"button\" name=\"start\" class=\"screen_but button_small\" value=\"&laquo; terug\" /></form>");
					$('input.screen_but').click(function(){
						$("div.screen").hide();
						$("div.screen." + $(this).attr('name')).show(function(){
							do_sIFR();
							drawicons();
						});
					});
				});
			});
			
			addUploadDelClicks();
			
		}
		
		drawicons();

		//my own alert...
		alert = function(str){
			o = $('<div id="alert"><span class="string">' + str + '</span></div>');
			o.css('display','none').appendTo('body');
			popWindow('',300,o.height(),o);
		}
		//show all found alerts
		if(foundOnloadAlerts.length > 0){
			$.each(foundOnloadAlerts,function(){
				alert(this);
			});
		}	

	});
