var ct = null;		//Current active tab
var c1, c2, c3;		//The three main containers
var helper;			//Extra helper atop main containers 
var n_boxes = -1;
var ti = 0;
var zIndex = 0;   
var default_search_term = "Vul hier uw zoekopdracht in";
var IFRAME = false;
var saving_wait = '<img src="g/loading.gif" alt="Saving ..."/> Saving&hellip;';
var firstTime = false;
var tempContent = "";

//
var module_template = $('<div id="module_template" class="module" style="display:none"><div class="moduleFrame"><div class="moduleHeader"><a href="#" rel="fold" class="moduleIcon" title="collapse"><span>collapse</span></a><h1 class="moduleTitle"><span></span></h1><div class="moduleActions"><a href="#" title="Edit" class="action_edit thickbox"><span>bewerk</span></a><a href="#" title="Collapse" class="action_min"><span>collapse</span></a><a href="#" title="Expand" class="action_max"><span>expand</span></a><a href="#" title="Close" class="action_close"><span>close</span></a></div></div><div class="moduleContent clear"><img src="g/loading.gif" alt="Loading..."/> Loading...</div></div><div class="moduleActivate"><a href="pagina-instellingen" class="thickbox"><span>+ Voeg informatie toe</span></a></div> </div>');                                                  


Array.prototype.each = function(f) {
	for (var i=0; i < this.length; i++)
		f(this[i],i,this);
};
Array.prototype.remove = function(m) {
	for (var i=0; i < this.length; i++)
		if (this[i] === m) this.splice(i, 1);
	return this;
};
Array.prototype.test = function(id) {
	for (var i=0; i < this.length; i++)
		if (this[i].id == id) return this[i];
	return false;
};

// Self-remove
jQuery.fn.rm = function() {
	return this.each(function() {
		this.parentNode.removeChild(this);
	});
};

// For DIV.module to load content
jQuery.fn.loadContent = function(url) {
	return this.each(function() {
		u = (url || this.url); 
		if (u == '') return;     
//		 if (!IE7 && !IE6) console.log("url="+u);
		x = $(".moduleContent", this); 

    var rel1="div[rel='"+this.url+"']"; // + "_1";    
    if ($("#module_content "+rel1).text()!="" && firstTime==true)
    { 
        x.html($("#module_content "+rel1).html()) ; 
        prepLocalModule(x);
    }              
    else
    {
      x.load(u, prepModule);
    }
//    if (!IE7 && !IE6) console.log("url= "+$(x).text());  
    this.loaded = true;  
//    console.log(this);  
    
	});
};

// Load layout defined in modules.js
function loadLayout() {
	// Predefined layout from modules.js is used here, but you can use
	// dynamic script to load customized layout instead
  var list1 = _layout;

  var list = false;
    var d = new Date();              
   $.ajax({         
        async: false,  
        //cache: false,
        type: "GET",
        url: "user_session/get_session/"+d,
        success: function(msg){     
          if (msg != "0")
          {
            list = $.evalJSON(msg).saved;    
          }
          else 
          {
            list = list1;
          }     
          
          layout(eval(list)); 
        }
      }); 
   
                  
// layout(eval(list1));    
  
	
  
  function layout(l) {         
       n_boxes = l.length; 
       //if (!IE6 && !IE7) console.log(l); else alert(l);  
    $.each(l.reverse(), function(i,m) {
      if (m) {                   
        //if (!IE6 && !IE7) console.log(m.c); else alert(m.c);
        var x = eval("_modules."+m.i);
        if ($("#"+m.t).size() > 0)  
         $("#"+m.c).addModule({id:m.i, title:x.t, url:x.l, tab:m.t, color:(x.c || null), state:m.s, edit_title: x.e, edit_url: x.el});
      }
    }); 
	
	}
}	
	


// Used on pre-formated <DIV><UL.tabsul><DIVs></DIV> section
jQuery.fn.Tabs = function() {
	return this.each(function() {
		x = $(this);
		var targets = x.children("div").addClass("tabsdiv").hide();

		x.children(".tabsul").children("li").each(function(i) {
			this.target = targets[i];
			$(this).click(function() {
				if ($(this).is(".on")) return;

				y = $(this).siblings(".on");
				y.add(this).toggleClass("on");
				if ((this.id) && (!this.loaded)) {
					$(this.target).load(eval("_modules."+this.id+".l"),prepModule);
					this.loaded = true;
				}
				$(this.target).add(y.size() > 0 ? y[0].target : null).toggle();
			});
		}).eq(0).click();
	});
};

// Used on pre-formated <DL> section
// Exclusive accordion, only one on at a time
jQuery.fn.Accordion = function() {
	return this.each(function (i) {
		x = $(this);

		x.children("dt").click(function(){
			y = $(this);
			if (y.is(".on")) return;

			y.siblings("dt.on").andSelf().toggleClass("on");
			y.siblings("dd:visible").add(y.next()).slideToggle();
		});

		x.children("dt:first").click();
	});
};

// Used on pre-formated <DL> section
// Mutiple accordions, individual on/off control
jQuery.fn.MAccordion = function() {
	return this.each(function (i) {
		x = $(this);

		x.addClass("accordion").children("dd").slideDown();
		x.children("dt").addClass("on").click(function(){
			$(this).toggleClass("on").next().slideToggle();
		});
	});
};

jQuery.fn.NavIcon = function() {
	return this.each(function(i){
		t = $(this).attr("title");
		$(this).wrap("<div class='navdiv'><a href=# id='" + this.id +"'></a></div>");
		x = $(this.parentNode);
		x.append("<br/>"+t);
		x.click(ReplaceModule);
	});
};

jQuery.fn.NavLi = function() {
	return this.addClass("navli").click(ReplaceModule);
};

// When a NavLi (or NavIcon) item is clicked, close all modules in column2 (c2)
// and add a new module designated by the NavLi's ID 
function ReplaceModule() {
	if (!this.id) return;
	i = this.id;
	x = $(".module:visible",c2);
	$(".action_close",x).mousedown();
	c2.addModule({id:i,
				title:eval("_modules."+i+".t"),
				url:eval("_modules."+i+".l"),
				color:eval("_modules."+i+".c")||null});
};

//RSS Side Menu (Text Link)
jQuery.fn.RSSLi = function()  {
	$("a", this).click(LoadRSSModule);
	return this.addClass("rssli");
};

// When a RSSLi item is clicked, close all modules in column2 (c2)
// and add a new module with dynamic RSS content
function LoadRSSModule() {
	x = $(".module:visible",c2);
	$(".action_close",x).mousedown();
	c2.addModule({id:'m000',			//Module ID doesn't matter now
				title:$(this).text(),	//Link text as module title
				url:'rss.php?q='+encodeURIComponent(this.href)});	//Original link turn into proxy query
	return false;
};
       


// Process the content of a newly loaded module before showing
function prepModule() { 
  
  // add class="local" to pagination links
//  $("#pagination a").addClass("local"); 
  // if (!IE7 && !IE6) console.log("1. url= "+$(this).text());  
  $(".tabs",this).Tabs();
	$(".accordion",this).Accordion();
	$(".maccordion",this).MAccordion();
	$(".navicon > img",this).NavIcon();
	$(".navul > li",this).NavLi();
	$(".rssul > li",this).RSSLi();
	$("a.local",this).LocalLink();
	$("a.tab",this).TabLink();
	$("form.ajaxform1",this).AjaxForm1();
	$("form.ajaxform2",this).AjaxForm2(); 
	$(".thickbox",this).click(TB);
	$("a[href^=http]",this).attr("target","_blank");
	$("a[rel=new]",this).attr("target","_blank");
  
   $(this).slideDown();
	n_boxes -= 1;  
	
  if ($(this).parents(".module").attr("rel")=="min") $(this).parents(".module").minModule();
  if ($(this).parents(".module").attr("rel")=="closed") $(this).parents(".module").closeModule();  
   // if (!IE7 && !IE6) console.log("2. url= "+$(this).text()); 
};   

function prepLocalModule(jqo)
{ 
  
  $(".tabs",jqo).Tabs();
	$(".accordion",jqo).Accordion();
	$(".maccordion",jqo).MAccordion();
	$(".navicon > img",jqo).NavIcon();
	$(".navul > li",jqo).NavLi();
	$(".rssul > li",jqo).RSSLi();
	$("a.local",jqo).LocalLink();
	$("a.tab",jqo).TabLink();
	$("form.ajaxform1",jqo).AjaxForm1();
	$("form.ajaxform2",jqo).AjaxForm2(); 
	$(".thickbox",jqo).click(TB);
	$("a[href^=http]",jqo).attr("target","_blank");
	$("a[rel=new]",jqo).attr("target","_blank");   
	
  if (jqo.parents(".module").attr("rel")=="max") jqo.slideDown();
  n_boxes -= 1;  

  if (jqo.parents(".module").attr("rel")=="min") jqo.parents(".module").minModule();
  if (jqo.parents(".module").attr("rel")=="closed") jqo.parents(".module").closeModule(); 

} 



jQuery.fn.minModule = function() { 
//  if (IE7) $("#footer").hide();     
//	  this.hide().parents(".moduleFrame").children(".moduleContent").hide();
    this.find(".moduleIcon").addClass("moduleIconClosed").attr("title", "expand"); 
	  this.find(".moduleContent").addClass("hiddenModuleContent").children("*").hide(); 
	  this.find(".action_min").hide(); 
	  this.find(".action_max").show();     
	  	  $(this).attr("rel", "min");  
//	  	   if (IE7) $("#footer").show();     
//	  this.siblings(".action_max").show();
 saveState();                             
}; 

jQuery.fn.maxModule = function() { 
//	  this.hide().parents(".moduleFrame").children(".moduleContent").hide();   
// if (IE7) $("#footer").hide();     
   this.find(".moduleIcon").removeClass("moduleIconClosed").attr("title", "collapse"); 
	  this.find(".moduleContent").removeClass("hiddenModuleContent").children("*").show(); 
	  this.find(".action_min").show(); 
	  this.find(".action_max").hide();           
	  $(this).attr("rel", "max");
//	  this.siblings(".action_max").show(); 
// if (IE7) $("#footer").show();     
   saveState();                          
}; 
   

jQuery.fn.closeModule = function() {  
//   if (IE7) $("#footer").hide();       
  this.find(".moduleFrame").hide();
  this.find(".moduleActivate").show(); 
  this.attr("rel", "closed");        
//   if (IE7) $("#footer").show();     
   saveState();  
};                 
     
    
jQuery.fn.activateModule = function() {  
//   if (IE7) $("#footer").hide();     
  this.children(".moduleFrame").show(); 
  this.children(".moduleActivate").hide(); 
  this.maxModule();
  // 
  // this.attr("rel", "max");           
//   if (IE7) $("#footer").show();     
    saveState(); 
};    

//Used on DIV.main_container only, 'tab' is used only when loading layouts
//When 'tab' is omitted, ct (current tab) is used instead
jQuery.fn.addModule = function(settings) { //id, title, url, tab, class, state, edit_title, edit_url
	return this.each(function() {
		var options = $.extend({
			title	      : null,
			tab		      : null,
			color	      : null,
			state       : null,
			edit_title  : null,
			edit_url    : null
		}, settings);
    
		var tx = options.tab ? document.getElementById(options.tab) : ct;
		if (!options.tab && (m = ct.modules.test(options.id))) {
			$(m).fadeTo('fast', 0.5).fadeTo('fast', 1);
			return; //Disable duplicate in a same tab
		}                        

		y = module_template.clone(true);    //$("#module_template").clone(true);    
		x = y[0];
		x.loaded = false;     
		x.url = options.url;
		x.tab = tx.id;
		x.id = options.id;
		x.rel = options.state; 
		if (options.edit_title) $(".action_edit", x).attr("title", options.edit_title);
		if (options.edit_url && options.edit_url != "") 
		{
		  $(".action_edit", x).attr("href", options.edit_url);
		}
		else
		{
		  $(".action_edit", x).remove();
		  $(".moduleActions", x).css("width", "52px");
		}
    
		tx.modules.push(x);
                              
		if (options.title) $(".moduleTitle span", x).html(options.title);
		else $(".moduleHeader",x).rm();

		if (options.color) $(x).addClass(options.color);

		if (tx === ct) $(x).show();
		$(this).prepend(x);

	  if (!options.tab) { 
		  $(x).loadContent();
		}  
		
		
	});
};

// Actions taken when you click a header tab
function HeaderTabClick(){
	if (this === ct) return;	//Return if click on current active tab

	//location.hash = '#' + this.id;
	$(this).siblings(".on").andSelf().toggleClass("on");

	//Hide last tab's modules
	$(".module:visible").hide();

	ct = this;
	x = eval("_tabs."+ct.id);

	// Load an extra helper content block if defined
	// with a file name default to current tab's id
  // helper.hide();
  // if (x.helper) helper.load(this.id+".html", prepModule).show();
  // else helper.hide().empty();

	//Ajust column widths
	c1.css({width:x.c1});
	c2.css({width:x.c2}); 

	if (x.c2 == "auto") {
		c2.css({'float':"none", marginLeft:x.c1});
	} else {
		c2.css({'float':"left", marginLeft:0});
	} 

	c3.css({width:(x.c3 || 0)});

	//Load content and show module
	this.modules.each(function(m,i){
		// Lazy loading when the tab is activated
		if(!m.loaded) $(m).loadContent();
		
    $(m).fadeIn();
	});
};
     
function startUp() {  
    
  c1 = $("#c_1");
	c2 = $("#c_2");
	c3 = $("#c_3");
	//helper = $("#helper");

	$("#header_tabs li").each(function(){
		// During initialization, attach a "modules" array to each tab
		this.modules = [];
		$(this).click(HeaderTabClick);
	});

	$(".main_containers").sortable({
		connectWith: ['.main_containers'],
		handle: '.moduleHeader',
		revert: true,
		tolerance: 'pointer',
		start: function(event, ui) { 
		 zIndex = $(this).css("z-index");
		  $(this).css("z-index", "999999");
		},
		stop: function(event, ui) { 
		 $(this).css("z-index", zIndex);   
		 saveState();
		},
		items: '.module:not(.ui-state-disabled)'
	});
 
       
  // Load module definitions for each tab
	loadLayout();
  
  $("#instellignen a.thickbox").click(TB);
	$("#expd").click(showAll);
	$("#clps").click(hideAll);
	$(".moduleTitle a").click(function(){return false;});
	
  // $(".action_refresh").mousedown(loadContent); 

	$("a.moduleIcon").click(function(){
	  if ($(this).hasClass("moduleIconClosed")) 
	    $(this).parents(".module").maxModule();
	  else                                     
      $(this).parents(".module").minModule();
      
    return false;  
	});   

//	$(".moduleTitle a.action_min").mousedown(minModule);
	$(".action_max").mousedown(maxModule); 
	$(".action_min").mousedown(minModule);  
 
//	$(".moduleTitle a.action_max").mousedown(maxModule);  
	$(".action_close").mousedown(closeModule); 
 // $(".action_edit").attr("href", "static/m204.html"); 
	
   $("#searchButton").click(function() { searchC();  });
   $("#searchq").focus(function() { if ($(this).attr("rel")=="") $(this).val(""); }); 
   $("#searchq").blur(function() { if ($(this).attr("rel")=="") $(this).val(default_search_term); }); 
   $("#searchq").keypress(function(e) { if (e.which==13) searchC(); });         
	
	//$(".moduleActivate a").mousedown(activateModule); 
	//Make all external links open in new window
	//$("a.searchLink_7").click(function(){alert("find");goTo(this); return false;});
	$("a[href^=http]").attr("target","_blank");
	//Make all links with rel=new attribute to open in new window
	$("a[rel=new]").attr("target","_blank");
  
  algemeneButton();
  sprekersButton();
  
	t = location.hash;
	if ((t == '') || ($(t).size() != 1)) t = ":first";

	setTimeout("$('#header_tabs li"+t+"').click()", 200);   
}                                     

function showFooter() 
{ 
                                                  
  if (n_boxes==0) {
 //if (IE7)  $("#footer").show();
   firstTime=false;

   clearInterval(ti) ;
   
  }
}

$(function(){  
    
 //if (IE7) $("#footer").hide();  

 
	
    firstTime = true;  
   startUp();            
   ti = setInterval("showFooter()", 200); 
});

// Container Actions, apply on modules
function showAll() {
	$(".moduleContent").show();
	$(".action_min").show();  
	$(".action_max").hide();     
	$("#expd").hide();
	$("#clps").show();
};

function hideAll() {
	$(".moduleContent").hide();
	$(".action_max").show();	
	$(".action_min").hide();	
	$("#expd").show();
	$("#clps").hide();
};

// Module Actions, apply on current module
function loadContent() {
	$(this).parents(".module").loadContent();
};
     
function editSettingsModule() {

}

function minModule() {             
//   if (IE7) $("#footer").hide();     
	$(this).hide().parents(".moduleFrame").children(".moduleContent").addClass("hiddenModuleContent").children("*").hide();  
	$(this).parents(".moduleHeader").children(".moduleIcon").addClass("moduleIconClosed").attr("title", "expand");;
	$(this).siblings(".action_max").show();      
	$(this).parents(".module").attr("rel", "min");   
//	 if (IE7) $("#footer").show();     
	saveState();                     
};

function maxModule() {  
//   if (IE7) $("#footer").hide();     
	$(this).hide().parents(".moduleFrame").children(".moduleContent").removeClass("hiddenModuleContent").children("*").show();  
	$(this).parents(".moduleHeader").children(".moduleIcon").removeClass("moduleIconClosed").attr("title", "collapse");; 
	$(this).siblings(".action_min").show(); 
	$(this).parents(".module").attr("rel", "max");  
//	 if (IE7) $("#footer").show();     
		saveState();                     
};

function closeModule() {    
//   if (IE7) $("#footer").hide();     
  $(this).parents(".moduleFrame").hide();
  $(this).parents(".module").children(".moduleActivate").show();
  $(this).parents(".module").attr("rel", "closed");
//   if (IE7) $("#footer").show();     
  saveState();                     
};

function activateModule() {   
//   if (IE7) $("#footer").hide();     
  $(this).parents(".module").children(".moduleFrame").show(); 
  $(this).parents(".module").children(".moduleActivate").hide();
  $(this).parents(".module").maxModule();
  // $(this).parents(".module").attr("rel", "max"); 
//   if (IE7) $("#footer").show();     
	saveState();                     
};      

function removeAllModules() {
  var m = $("#main .module");
	ct.modules.remove(m);
	m.rm(); 
}   


function resetPagina() {    
    
   if (confirm("Wilt u doorgaan naar de standaard instelling van de pagina?")) saveState({reload: true, reset: true}); 

}   

function goTo(el) 
{                      
  tb_remove();               
  var m = "#"+el.rel;
  $(m).activateModule();
  $(m).maxModule();   
  firstTime = false;
  $(m).loadContent("static/wait.html");  
  $(m).loadContent(el.href);         
  
}
  

function saveState(settings)
{  
   var options = $.extend({ reload: false, reset: false}, settings);
   var resetAll = "0";
   var newlayout = new Array(); 
   if ( ! options.reset)   
   {
    var m = $("#main .module");  
    var lc = new Array(c1.sortable("toArray"),c2.sortable("toArray"),c3.sortable("toArray"));   
    
    
    for (i=1; i<=lc.length; i++)
    { 
      var col = lc[i-1];
      for (x=0; x<col.length; x++)
      {  
        var lay = {};   
        var ci = "c_"+i;
        lay.c = "c_"+i;  
        lay.t = "t1"; 
        lay.i = $("#"+col[x]).attr("id");
        lay.s = $("#"+col[x]).attr("rel"); 
        newlayout.push(lay);
      }                
     } 
   }
   else
   {
     newlayout = _layout; 
     resetAll = "1"
   }   
    var layout = {saved: newlayout};   
//    alert("layout = " + layout) ;
   $.ajax({  
     type: "POST",
     url: "user_session/save_session/"+resetAll,
     data: "layout="+$.toJSON(layout),
     success: function(msg){
//       alert( "Data Saved: " + msg ); 
       if (options.reload) location.reload();
     }
   });
    
}
       

function moduleStatus()
{   
    var m = $("#main .module");  
    var lc = new Array(c1.sortable("toArray"),c2.sortable("toArray"),c3.sortable("toArray"));   
    
    for (i=1; i<=lc.length; i++)
    { 
      var col = lc[i-1];
      for (x=0; x<col.length; x++)
      {           
        var id = $("#"+col[x]).attr("id"); 
        var checked = ($("#"+col[x]).attr("rel") != "closed") ? "checked" : "";
        $("#selection #" + id + "_edit").attr("checked", checked);  
      }                
     }  
}       

function resetModules()   
{                      
  $("#selection input").each(function(){
     var modul = "#" + $(this).val();   
     if ($(this).attr("checked") )
       $(modul).activateModule();
     else
       $(modul).closeModule();
  });
  
  tb_remove(); 
  saveState(); 
  
  
}    

// save category settings
function saveCat(el)
{  
   $(el).parent().html(saving_wait); 
   var cat = $(el).attr("rel");
   var d = new Date();   
   var cats = [];           
   $.ajax({         
        async: false,  
        //cache: false,
        type: "GET",
        url: "user_session/get_cat/"+d,
        success: function(msg){ 
          if (msg != "0") cats = $.evalJSON(msg); 
          prepCat();
        }  
      });
      
   function prepCat()
   { 
     var cat_obj = {}; 
     var new_cat = new Array();
     $("#selection input").each(function(){
       if ($(this).attr("checked") )
       {
         new_cat.push($(this).val());
       }  
       cat_obj[cat] = new_cat; 
     });
          
     jQuery.each(cats, function(i, val){
        if (i != cat) 
        {
          cat_obj[i] = val;
        }  
     });                                     
     
     $.ajax({  
     type: "POST",
     url: "user_session/save_cat",
     data: "cat="+$.toJSON(cat_obj),
     success: function(msg){
        var mod = cat+"_1"; 
        var url = eval("_modules."+mod+".l") + "/list_all";
        tb_remove();
        $("#"+mod).loadContent(url);
      }
     });
     
   }   
      
}            


function searchC()
{
  var search = escape($("#searchq").val());
   if (search!="")
   {           
     $("#searchq2").val(search);    
     $("#results_1").loadContent("static/wait.html"); 
     var url = "search/index/"+search; 
     var url_all = "search/list_all/tb";
     var sr = $("#results_1");
     sr.activateModule();
     sr.maxModule();    
      firstTime = false;
     sr.loadContent(url);  
     $.scrollTo(sr, 500, {axis:'xy'});
    // tb_show("ZOEKENRESULTAT", url_all);
   }      
   return false;
}         
 
function searchC2()
{     
  var search = escape($("#searchq2").val());
   if (search!="")
   {             
     $("#searchq").val(search);  
     $("#results_1").loadContent("static/wait.html"); 
     var url = "search/index/"+search; 
     var url_all = "search/list_all/tb";
     var sr = $("#results_1");
     sr.activateModule();
     sr.maxModule();    
      firstTime = false;
     sr.loadContent(url);  
     $.scrollTo(sr, 500, {axis:'xy'});
    // tb_show("ZOEKENRESULTAT", url_all);
   }  
   return false;   
}
        
// dummy
function algemeneButton()
{ 
  $("#algemene a").click(function(){
    if ($("#mainContent").hasClass("AlgemeneIntroductie"))
    { 
      // is open
      if ( ! $(this).hasClass("algemeneClosed"))
      {
        $("#mainContent").hide();
        $(this).addClass("algemeneClosed"); 
        $("#algemene").addClass("algemeneClosed");
        $("#topContent").addClass("algemeneClosed"); 
        var so = new SWFObject("static/NL=logistiek_fin.swf", "NL=logistiek", "700", "170", "9", "#ffffff");
        so.addParam("wmode", "transparent");
		    so.useExpressInstall('expressinstall.swf');
	      so.write("flashcontent"); 
      }
      else
      {  
        var so = new SWFObject("static/NL=logistiek_small_fin.swf", "NL=logistiek", "700", "57", "9", "#ffffff"); 
        so.addParam("wmode", "transparent");
		    so.useExpressInstall('expressinstall.swf');
	      so.write("flashcontent"); 
	      
        $(this).removeClass("algemeneClosed"); 
        $("#algemene").removeClass("algemeneClosed");
        $("#topContent").removeClass("algemeneClosed"); 
        $("#mainContent").show();
      }
	      
    } 
    else
    {
      location.href = this.href;
    }
    return false;  
     
  });

}   

// dummy  
function sprekersButton()
{
  
  $("#sprekers a").click(function(){
    if ($("#mainContent").hasClass("Sprekers"))
    { 
      // is open
      if ( ! $(this).hasClass("sprekersClosed"))
      {
        $("#mainContent").hide();
        $(this).addClass("sprekersClosed"); 
        $("#sprekers").addClass("sprekersClosed");
        $("#topContent").addClass("sprekersClosed"); 
        var so = new SWFObject("static/NL=logistiek_fin.swf", "NL=logistiek", "700", "170", "9", "#ffffff");
        so.addParam("wmode", "transparent");
		    so.useExpressInstall('expressinstall.swf');
	      so.write("flashcontent"); 
      }
      else
      {  
        var so = new SWFObject("static/NL=logistiek_small_fin.swf", "NL=logistiek", "700", "57", "9", "#ffffff"); 
        so.addParam("wmode", "transparent");
		    so.useExpressInstall('expressinstall.swf');
	      so.write("flashcontent"); 
	      
        $(this).removeClass("sprekersClosed"); 
        $("#sprekers").removeClass("sprekersClosed");
        $("#topContent").removeClass("sprekersClosed"); 
        $("#mainContent").show();
      }
	      
    } 
    else
    {
      location.href = this.href;
    }
    return false;  
     
  });
  
}

// ----------------------------------------------------
//    Extra Methods for More Dynamic Content Loading
// ----------------------------------------------------

// Used on A.local to change the content of current module
jQuery.fn.LocalLink = function() {
	return this.click(function() {
	  firstTime=false;
		$(this).parents(".module").loadContent(this.href);
		return false
	});
}

// Used on A.tab to switch to another Tab
jQuery.fn.TabLink = function() {
	return this.click(function() {
		$("#header_tabs li" + "#" + this.id).click();
		return false
	});
}

// Used on FORM.ajaxform1, replace Form's parent DIV.moduleContent with response from Ajax submit
jQuery.fn.AjaxForm1 = function() {
	return this.each(function(){
		var x = this
		var result = $(this).parents(".moduleContent")
		$("input.submit",this).click(function(){
			data = {}
			$("input,textarea", x).each(function(){
				if (this.name != '') 
					eval("data." + this.name + "='" + $(this).val() + "'")
			})
			$.post(x.action, data, function(data){result.html(data);prepModule.apply(result[0])})
			return true;
		})
	});
};

// Used on FORM.ajaxform2, replace Form > div.result with response from Ajax submit
jQuery.fn.AjaxForm2 = function() {
	return this.each(function(){
		var x = this
		var result = $(".result",this)
		$("input.submit",this).click(function(){
			data = {}
			$("input,textarea", x).each(function(){
				if (this.name != '') 
					eval("data." + this.name + "='" + $(this).val() + "'")
			})
			$.post(x.action, data, function(data){result.html(data);prepModule.apply(result[0])})
			return true;
		})
	});
};


