// JavaScript Document

/*jslint browser: true */ /*global jQuery: true */

/**
 * jQuery Cookie plugin
 *
 * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

// TODO JsDoc

/**
 * Create a cookie with the given key and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String key The key of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given key.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String key The key of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

jQuery.cookie = function (key, value, options) {

    // key and value given, set cookie...
    if (arguments.length > 1 && (value === null || typeof value !== "object")) {
        options = jQuery.extend({}, options);

        if (value === null) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? String(value) : encodeURIComponent(String(value)),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

/* javascript */
/**
 * jQuery.timers - Timer abstractions for jQuery
 * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
 * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
 * Date: 2009/10/16
 *
 * @author Blair Mitchelmore
 * @version 1.2
 *
 **/

jQuery.fn.extend({
	everyTime: function(interval, label, fn, times) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, times);
		});
	},
	oneTime: function(interval, label, fn) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, 1);
		});
	},
	stopTime: function(label, fn) {
		return this.each(function() {
			jQuery.timer.remove(this, label, fn);
		});
	}
});

jQuery.extend({
	timer: {
		global: [],
		guid: 1,
		dataKey: "jQuery.timer",
		regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
		powers: {
			// Yeah this is major overkill...
			'ms': 1,
			'cs': 10,
			'ds': 100,
			's': 1000,
			'das': 10000,
			'hs': 100000,
			'ks': 1000000
		},
		timeParse: function(value) {
			if (value == undefined || value == null)
				return null;
			var result = this.regex.exec(jQuery.trim(value.toString()));
			if (result[2]) {
				var num = parseFloat(result[1]);
				var mult = this.powers[result[2]] || 1;
				return num * mult;
			} else {
				return value;
			}
		},
		add: function(element, interval, label, fn, times) {
			var counter = 0;
			
			if (jQuery.isFunction(label)) {
				if (!times) 
					times = fn;
				fn = label;
				label = interval;
			}
			
			interval = jQuery.timer.timeParse(interval);

			if (typeof interval != 'number' || isNaN(interval) || interval < 0)
				return;

			if (typeof times != 'number' || isNaN(times) || times < 0) 
				times = 0;
			
			times = times || 0;
			
			var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});
			
			if (!timers[label])
				timers[label] = {};
			
			fn.timerID = fn.timerID || this.guid++;
			
			var handler = function() {
				if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
					jQuery.timer.remove(element, label, fn);
			};
			
			handler.timerID = fn.timerID;
			
			if (!timers[label][fn.timerID])
				timers[label][fn.timerID] = window.setInterval(handler,interval);
			
			this.global.push( element );
			
		},
		remove: function(element, label, fn) {
			var timers = jQuery.data(element, this.dataKey), ret;
			
			if ( timers ) {
				
				if (!label) {
					for ( label in timers )
						this.remove(element, label, fn);
				} else if ( timers[label] ) {
					if ( fn ) {
						if ( fn.timerID ) {
							window.clearInterval(timers[label][fn.timerID]);
							delete timers[label][fn.timerID];
						}
					} else {
						for ( var fn in timers[label] ) {
							window.clearInterval(timers[label][fn]);
							delete timers[label][fn];
						}
					}
					
					for ( ret in timers[label] ) break;
					if ( !ret ) {
						ret = null;
						delete timers[label];
					}
				}
				
				for ( ret in timers ) break;
				if ( !ret ) 
					jQuery.removeData(element, this.dataKey);
			}
		}
	}
});

jQuery(window).bind("unload", function() {
	jQuery.each(jQuery.timer.global, function(index, item) {
		jQuery.timer.remove(item);
	});
});

/**
 * jquery.scrollable 1.0.2. Put your HTML scroll.
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/scrollable.html
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 *
 * Launch  : March 2008
 * Version : 1.0.2 - Tue Feb 24 2009 10:52:04 GMT-0000 (GMT+00:00)
 */
(function($){function fireEvent(opts,name,self,arg){var fn=opts[name];if($.isFunction(fn)){try{return fn.call(self,arg);}catch(error){if(opts.alert){alert("Error calling scrollable."+name+": "+error);}else{throw error;}return false;}}return true;}var current=null;function Scrollable(root,conf){var self=this;if(!current){current=self;}var horizontal=!conf.vertical;var wrap=$(conf.items,root);var index=0;var navi=root.siblings(conf.navi).eq(0);var prev=root.siblings(conf.prev).eq(0);var next=root.siblings(conf.next).eq(0);var prevPage=root.siblings(conf.prevPage).eq(0);var nextPage=root.siblings(conf.nextPage).eq(0);$.extend(self,{getVersion:function(){return[1,0,1];},getIndex:function(){return index;},getConf:function(){return conf;},getSize:function(){return self.getItems().size();},getPageAmount:function(){return Math.ceil(this.getSize()/conf.size);},getPageIndex:function(){return Math.ceil(index/conf.size);},getRoot:function(){return root;},getItemWrap:function(){return wrap;},getItems:function(){return wrap.children();},seekTo:function(i,time,fn){time=time||conf.speed;if($.isFunction(time)){fn=time;time=conf.speed;}if(i<0){i=0;}if(i>self.getSize()-conf.size){return self;}var item=self.getItems().eq(i);if(!item.length){return self;}if(fireEvent(conf,"onBeforeSeek",self,i)===false){return self;}if(horizontal){var left=-(item.outerWidth(true)*i);wrap.animate({left:left},time,conf.easing,fn?function(){fn.call(self);}:null);}else{var top=-(item.outerHeight(true)*i);wrap.animate({top:top},time,conf.easing,fn?function(){fn.call(self);}:null);}if(navi.length){var klass=conf.activeClass;var page=Math.ceil(i/conf.size);page=Math.min(page,navi.children().length-1);navi.children().removeClass(klass).eq(page).addClass(klass);}if(i===0){prev.add(prevPage).addClass(conf.disabledClass);}else{prev.add(prevPage).removeClass(conf.disabledClass);}if(i>=self.getSize()-conf.size){next.add(nextPage).addClass(conf.disabledClass);}else{next.add(nextPage).removeClass(conf.disabledClass);}current=self;index=i;fireEvent(conf,"onSeek",self,i);return self;},move:function(offset,time,fn){var to=index+offset;if(conf.loop&&to>(self.getSize()-conf.size)){to=0;}return this.seekTo(to,time,fn);},next:function(time,fn){return this.move(1,time,fn);},prev:function(time,fn){return this.move(-1,time,fn);},movePage:function(offset,time,fn){return this.move(conf.size*offset,time,fn);},setPage:function(page,time,fn){var size=conf.size;var index=size*page;var lastPage=index+size>=this.getSize();if(lastPage){index=this.getSize()-conf.size;}return this.seekTo(index,time,fn);},prevPage:function(time,fn){return this.setPage(this.getPageIndex()-1,time,fn);},nextPage:function(time,fn){return this.setPage(this.getPageIndex()+1,time,fn);},begin:function(time,fn){return this.seekTo(0,time,fn);},end:function(time,fn){return this.seekTo(this.getSize()-conf.size,time,fn);},reload:function(){return load();},click:function(index,time,fn){var item=self.getItems().eq(index);var klass=conf.activeClass;if(!item.hasClass(klass)&&(index>=0||index<this.getSize())){self.getItems().removeClass(klass);item.addClass(klass);var delta=Math.floor(conf.size/2);var to=index-delta;if(to>self.getSize()-conf.size){to--;}if(to!==index){return this.seekTo(to,time,fn);}}return self;}});if($.isFunction($.fn.mousewheel)){root.bind("mousewheel.scrollable",function(e,delta){var step=$.browser.opera?1:-1;self.move(delta>0?step:-step,50);return false;});}prev.addClass(conf.disabledClass).click(function(){self.prev();});next.click(function(){self.next();});nextPage.click(function(){self.nextPage();});prevPage.addClass(conf.disabledClass).click(function(){self.prevPage();});if(conf.keyboard){$(window).unbind("keypress.scrollable").bind("keypress.scrollable",function(evt){var el=current;if(!el){return;}if(horizontal&&(evt.keyCode==37||evt.keyCode==39)){el.move(evt.keyCode==37?-1:1);return evt.preventDefault();}if(!horizontal&&(evt.keyCode==38||evt.keyCode==40)){el.move(evt.keyCode==38?-1:1);return evt.preventDefault();}return true;});}function load(){navi.each(function(){var nav=$(this);if(nav.is(":empty")||nav.data("me")==self){nav.empty();nav.data("me",self);for(var i=0;i<self.getPageAmount();i++){var item=$("<"+conf.naviItem+"/>").attr("href",i).click(function(e){var el=$(this);el.parent().children().removeClass(conf.activeClass);el.addClass(conf.activeClass);self.setPage(el.attr("href"));return e.preventDefault();});if(i===0){item.addClass(conf.activeClass);}nav.append(item);}}else{var els=nav.children();els.each(function(i){var item=$(this);item.attr("href",i);if(i===0){item.addClass(conf.activeClass);}item.click(function(){nav.find("."+conf.activeClass).removeClass(conf.activeClass);item.addClass(conf.activeClass);self.setPage(item.attr("href"));});});}});if(conf.clickable){self.getItems().each(function(index,arg){var el=$(this);if(!el.data("set")){el.bind("click.scrollable",function(){self.click(index);});el.data("set",true);}});}if(conf.hoverClass){self.getItems().hover(function(){$(this).addClass(conf.hoverClass);},function(){$(this).removeClass(conf.hoverClass);});}return self;}load();var timer=null;function setTimer(){timer=setInterval(function(){self.next();},conf.interval);}if(conf.interval>0){root.hover(function(){clearInterval(timer);},function(){setTimer();});setTimer();}}jQuery.prototype.scrollable=function(conf){var api=this.eq(typeof conf=='number'?conf:0).data("scrollable");if(api){return api;}var opts={size:5,vertical:false,clickable:true,loop:false,interval:0,speed:400,keyboard:true,activeClass:'active',disabledClass:'disabled',hoverClass:null,easing:'swing',items:'.items',prev:'.prev',next:'.next',prevPage:'.prevPage',nextPage:'.nextPage',navi:'.navi',naviItem:'a',onBeforeSeek:null,onSeek:null,alert:true};$.extend(opts,conf);this.each(function(){var el=new Scrollable($(this),opts);$(this).data("scrollable",el);});return this;};})(jQuery);

/* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * Version: 3.0.2
 * 
 * Requires: 1.2.2+
 */
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);

// JavaScript
// katz.be
// producten detail : tabbed panels 
// requires jquery 1.3.2

$(document).ready(function(){

					//hide panel 2-3-4
					$('#tabdoen').hide();
					$('#tabbezoeken').hide();
					$('#tabkinderen').hide();



					//zebrastriping de resultlists
					//niet doen: ziet er te druk uit
					//$('.tabpanelcontent li:odd').addClass('row1');
					//$('.tabpanelcontent li:even').addClass('row2');
						
						
					// init first panel
					$('.tabpanel #panelcollection .panelsubtab').hide();
					$('.tabpanel #panelcollection .panelsubtab:nth-child(1)').show();
					//$('.tabpanel #panelcollection .panel:nth-child(1)').slideDown('fast', function() {
							// Animation complete.
							//jumpy behavior, hier niet gebruiken
					//	  });
					$('.tabpanel #tabscontainer .tab:nth-child(1)').addClass('selected');
					
					//click tab function
					$('.tabpanel #tabscontainer .tab').click(function(e) {
						e.preventDefault();	
						//get the clicked index (numbering starts at 0 !)
						var index = $('.tabpanel #tabscontainer .tab').index(this);
						var index = index + 1; // clicked index starts at 0, nth-child starts at 1...
						//alert(index);
						var classforsubtab = "tab"+index;
						//alert(classforsubtab);
						//hide all panels, reset all paneltabs
						$('.tabpanel #panelcollection .panelsubtab  .tabcontent').fadeOut('fast');
						$('.tabpanel #tabscontainer .tab').removeClass('selected');
						$('.tabpanel #panelcollection .panelsubtab').removeClass('tab1');
						$('.tabpanel #panelcollection .panelsubtab').removeClass('tab2');
						$('.tabpanel #panelcollection .panelsubtab').removeClass('tab3');
						$('.tabpanel #panelcollection .panelsubtab').removeClass('tab4');
						$('.tabpanel #panelcollection .panelsubtab').addClass(classforsubtab);
						
						//set active paneltab, show active panel
						//$('.tabpanel #panelcollection .panel:nth-child(' + index +')').show();
						$('.tabpanel #panelcollection .panelsubtab .tabpanelcontent .tabpanelscroll .tabcontent:nth-child(' + index +')').fadeIn('fast');
						//$('.tabpanel #panelcollection .panelsubtab:nth-child(' + index +')').slideDown('slow', function() {
							//e.preventDefault();
							// Animation complete.
							// opgelet: als je snel na elkaar op 2 tabs klikt, zie je TWEE panels;
							//kan opgevangen worden door snelheid op te drijven
							//of door de kortste panels langer te maken
						  //});
						$('.tabpanel #tabscontainer .tab:nth-child(' + index +')').addClass('selected');
						
					});
					
					
					
					
});


// JavaScript Document

// jquery-viewer
// requires jquery.1.3.2
// requires jquery.timers-1.2

// author: kristof vandommele
// www.tales.be

$(document).ready(function(){
						   
	//first things first:						   
	//		positioning the textoverlays
	//		 activate the first item

	// 0. , set href on items in controller and in scroller
	$('#jqtalesviewer #controller .item ').each(
		function(){
			
			//var myitem = $(this).html();
			//alert(myitem);
			//get the itemindex
				var whichControllerItem = $(this).parent().index();
				//alert(whichControllerItem);
				$(this).attr('href', '#scrolleritem'+whichControllerItem);
				//alert('whichControllerItem = '+whichControllerItem)
				//$(this).addClass("outlineborder");
							}
		)
	
	$('#scrollcontainer #scrollme .item').each(
		function(){
			
			var myitem = $(this).html();
			//alert(myitem);
			//get the itemindex
				var whichControllerItem = $(this).index();
				//alert(whichControllerItem);
				$(this).attr('id', 'scrolleritem'+whichControllerItem);
			}
		)
	
	
	//focus van a-element overdragen op parent li
	$('#jqtalesviewer #controller .item ').focus(
		function(){
			
			//var myitem = $(this).html();
			//alert(myitem);
			//get the itemindex
				$(this).parent().addClass('focus');
				//alert('whichControllerItem = '+whichControllerItem)
				//$(this).addClass("outlineborder");
							}
		)
	$('#jqtalesviewer #controller .item ').focusout(
		function(){
			
			//var myitem = $(this).html();
			//alert(myitem);
			//get the itemindex
				var whichControllerItem = $(this).index();
				$(this).parent().removeClass('focus');
				//alert('whichControllerItem = '+whichControllerItem)
				//$(this).addClass("outlineborder");
							}
		)
	// 1. loop over each .item .description, calculate height, set top-position
	
	$('#scrollcontainer #scrollme .item .description').each(
		function(){
			var myHeight = $(this).height();		
			//alert('myHeight = '+myHeight);
			var myNewTop = -myHeight -30;
			$(this).css('top', myNewTop);
			
			}
		)
	// 2. show selected state on first item
	$('#jqtalesviewer #controller li:nth-child(1)').addClass('selected');
	
	
	//vars
	var offsetH = 480;
	var transitionTime = 750;
	var autoTimer = 4500;
	var nrofItems = $('#jqtalesviewer #controller li').children().size();
	//alert ('nr of items = '+nrofItems)
	

	// clicking on an item in the controller...
	$('#jqtalesviewer #controller .item').click(function(e){
			e.preventDefault();
			//remove selected state
			$('#jqtalesviewer #controller li').removeClass('selected');
			//set clicked item to 'selected'
			$(this).parent().addClass('selected');
			//get the clicked index (numbering starts at 0 !)
			var index = $('#jqtalesviewer #controller .item').index(this);
			//var myhref= $(this).attr(href);
			//alert(myhref);
			var offset = -(index*offsetH);
			//alert(offset);
			
			$('#scrollcontainer #scrollme').animate({
				 marginLeft: offset
			  }, transitionTime, function() {
				// Animation complete.
			  });
		})
						   
						   
						   
	$.fn.nextItem = function(){
			 return this.each(function()
				{
				//which item is active?
				var whichSelected = $('#jqtalesviewer #controller li.selected').index();
				
				//alert(whichSelected);
				var whichSelected = whichSelected+1; //adding 1 for nth-child counting
				if (whichSelected == nrofItems){
					var nextSelected = 1;
					}
				else{
					var nextSelected = whichSelected+1;
				}
				
				$('#jqtalesviewer #controller li.selected').removeClass('selected');	
				$('#jqtalesviewer #controller li:nth-child(' + nextSelected + ')').addClass('selected');
				var offset = -((nextSelected-1)*offsetH);
				$('#scrollcontainer #scrollme').animate({
					 marginLeft: offset
				  }, transitionTime, function() {
					// Animation complete.
				  });
				});
			
	}
	

	$.fn.prevItem = function(){
			 return this.each(function()
				{
				//which item is active?
				var whichSelected = $('#jqtalesviewer #controller li.selected').index();
				var whichSelected = whichSelected+1; //adding 1 for nth-child counting
				if (whichSelected == 1){
					var nextSelected = nrofItems;
					}
				else{
					var nextSelected = whichSelected-1;
				}
				
				$('#jqtalesviewer #controller li.selected').removeClass('selected');	
				$('#jqtalesviewer #controller li:nth-child(' + nextSelected + ')').addClass('selected');
				var offset = -((nextSelected-1)*offsetH);
				$('#scrollcontainer #scrollme').animate({
					 marginLeft: offset
				  }, transitionTime, function() {
					// Animation complete.
				  });
				});
			
	}
	
	$.fn.autoPlay = function(){		
		$('#jqtalesviewer #anysurfcontroller #stop').show();
		$('#jqtalesviewer #anysurfcontroller #play').hide();
		var active = false;
						if (!active) {
							//alert(active);
							active = !active;
							$('#jqtalesviewer #anysurfcontroller #next').everyTime(autoTimer, 'controlled', function() {
								var whichSelected = $('#jqtalesviewer #controller li.selected').index();
								var whichSelected = whichSelected+1; //adding 1 for nth-child counting
								if (whichSelected == nrofItems){
									var nextSelected = 1;
									}
								else{
									var nextSelected = whichSelected+1;
								}
								
								$('#jqtalesviewer #controller li.selected').removeClass('selected');	
								$('#jqtalesviewer #controller li:nth-child(' + nextSelected + ')').addClass('selected');
								var offset = -((nextSelected-1)*offsetH);
								$('#scrollcontainer #scrollme').animate({
									 marginLeft: offset
								  }, transitionTime, function() {
									// Animation complete.
								  });
							});
						}
		
		
	}		
	//var active = false;
	$.fn.autoStop = function(){
		//alert('active = ');
		
						//if (active) {
						//	active = !active;
							$('#jqtalesviewer #anysurfcontroller #next').stopTime('controlled');
							$('#jqtalesviewer #anysurfcontroller #stop').hide();
							$('#jqtalesviewer #anysurfcontroller #play').show();
						//}
		
	}

	// autostart on pageload
	$(this).autoPlay();
	
	$('#jqtalesviewer #anysurfcontroller #next').click(function(){
		$(this).nextItem();
		})
	$('#jqtalesviewer #anysurfcontroller #prev').click(function(){
		$(this).prevItem();											
		})
	$('#jqtalesviewer #anysurfcontroller #stop').click(function(){
		$(this).autoStop();											
		})
	$('#jqtalesviewer #anysurfcontroller #play').click(function(){
		$(this).autoPlay();											
		})
	
		
					   
	}	)
// JavaScript Document

// requires jquery.1.3.2
// requires jquery.cookie.js

// author: kristof vandommele
// www.tales.be
$(document).ready(function(){
	(function() {
			/*
			 * isEven(n)
			 * @args number n
			 * @return boolean returns whether the given number is even
			 */
			jQuery.isEven = function(number) {
				return number % 2 == 0;
			};
		
			/* isOdd(n)
			 * @args number n
			 * @return boolean returns whether the given number is odd
			 */
			jQuery.isOdd = function(number) {
				return !jQuery.isEven(number);
			};
	})();					   
	var cookieName = "uitinwvl";
	
					   
	function alertCookie(){
				alert('butsearch = ' + butsearch +'\n' +
							  'butmijnprofiel = ' + butmijnprofiel + '\n' +
							  'butmijnagenda = ' + butmijnagenda + '\n' +
							  'butmijnzoekfuncties = ' + butmijnzoekfuncties + '\n' +
							  'butrecentitems = ' + butrecentitems
							  );			
			}	
	//hide stuff when DOM is ready
	$('.showfordisabledusers').hide();
	$('.citylist').hide();
		
	//anysurfer: focus on 'naar inhoud' -> show hidden fields
	$('#topblock #naarinhoud a').focus(function(){
		//$('.showfordisabledusers').removeClass('showfordisabledusers');
		$('.showfordisabledusers').show('normal');
		var panelHeight = $('#panel-movie .stretchcontent').height();
		var newPanelHeight = panelHeight + 60;
		//alert(panelHeight);
		$('#panel-movie .stretchcontent').css('height',newPanelHeight);
		$('#panel-tweets .stretchcontent').css('height',newPanelHeight);
		})
	
	$('#topblock #naarinhoud a').click(function(){
		//$('.showfordisabledusers').removeClass('showfordisabledusers');
		$('.showfordisabledusers').show('normal');
		var panelHeight = $('#panel-movie .stretchcontent').height();
		var newPanelHeight = panelHeight + 60;
		//alert(panelHeight);
		$('#panel-movie .stretchcontent').css('height',newPanelHeight);
		$('#panel-tweets .stretchcontent').css('height',newPanelHeight);
		})
	
	
	//linkrow bovenaan
	$('#topblock #linkrow ul li:last-child a').css('background-image','none');
	
	
	
	// set value in generic searchform (top of page)	
		$('#header .col3 #ctl00_txtKeyword').val('Zoek in UiTinWest-Vlaanderen.be');
		$('#header .col3 #ctl00_txtKeyword').addClass('lightertext');
	// clear value in generic searchform (top of page) when focussing
		$('#header .col3 #ctl00_txtKeyword').focus(function(){
			$('#header .col3 #ctl00_txtKeyword').val('');
			$('#header .col3 #ctl00_txtKeyword').removeClass('lightertext');
			})


	// topnavigation homepage
		//
		
		$('.home #topnav li:last-child').addClass('noborder');
		function hideTopnavHome(){		
			$('.home #topnav li').hide();
			$('.home #topnav li:nth-child(1)').show();	
			$('.home #topnav li:nth-child(2)').show();	
			$('.home #topnav li:nth-child(3)').show();	
			$('.home #topnav li:nth-child(4)').show();	
			$('.home #topnav li:nth-child(5)').show();//5th child is 'meer...'
			
			}
		function showTopnavHome(){			
			$('.home #topnav li').show('normal');		
			}
			
		//on startup: hide the nav-items
		hideTopnavHome();
		// verberg de 'meer...'-link indien aangeklikt
		$('.home #topnav li:nth-child(5) a').click(function(e){
			e.preventDefault();
			showTopnavHome();
			$('.home #topnav li:nth-child(5)').hide();	
			})
		
		
		
		
		//sidenav behavior
		//toggle open or close
		$('#sidenav ul li:last-child').addClass('noborderbottom');
		$('.toggle_container').hide();


		$.fn.slidePanel = function(e) {
				//alert('boe');
				e.preventDefault();
				
				//slide toggle
				$(this).parent().next(".toggle_container").slideToggle('normal');
				//switch toggle icon
				//and set cookie value for togglestatus
				if ($(this).parent().hasClass('toggledown')){					
						$(this).parent().removeClass('toggledown');
						$(this).parent().addClass('toggleup');
						var myparentId = $(this).parent().attr('id');
						//alert('myparentId = '+myparentId);
						$.cookie(myparentId, 'open', {expires: 360,	path: '/'});
					}
					else if ($(this).parent().hasClass('toggleup')){
							//alert('toggleup');
							$(this).parent().removeClass('toggleup');
							$(this).parent().addClass('toggledown');
							var myparentId = $(this).parent().attr('id')
							$.cookie(myparentId, 'collapsed', {expires: 360,	path: '/'});
						}
				}//)
		
		
		$.fn.slidePanelfromotherlink = function(e) {
				//alert('boe');
				//e.preventDefault();
				
				//slide toggle
				$(this).parent().next(".toggle_container").slideToggle('normal');
				//switch toggle icon
				//and set cookie value for togglestatus
				if ($(this).parent().hasClass('toggledown')){					
						$(this).parent().removeClass('toggledown');
						$(this).parent().addClass('toggleup');
						var myparentId = $(this).parent().attr('id');
						//alert('myparentId = '+myparentId);
						$.cookie(myparentId, 'open', {expires: 360,	path: '/'});
					}
					else if ($(this).parent().hasClass('toggleup')){
							//alert('toggleup');
							$(this).parent().removeClass('toggleup');
							$(this).parent().addClass('toggledown');
							var myparentId = $(this).parent().attr('id')
							$.cookie(myparentId, 'collapsed', {expires: 360,	path: '/'});
						}
				}//)
		
		
		$('.slidingpanel').click(function(e){
				$(this).slidePanel(e);						  
			})
			//opgelet: je moet de keypress binden aan de a-tag, niet de .slidingpanel-span !!!!
			$('.slidingpanel').parent().bind('keydown', function(e) {
					//alert(e.type + ': ' +  e.which);
					if(e.keyCode==13){
							$(this).children().slidePanel(e);	
					}
			});
			
			
		//anysurferindexlist : set focus on anchor after click/keypress + slide panel open
		
		$('.anysurferindexlist a.linktopanel').click(function(e){
				var mytarget = $(this).attr("href");
				//alert(mytarget);
				$(mytarget).focus();
				if ($(mytarget).hasClass('toggledown')){
						//alert('target staat dichtgeklapt');
						$(mytarget).children().slidePanelfromotherlink(e);
					}	
				if ($(mytarget).hasClass('toggleup')){
						//alert('target staat opengeklapt')
					}	
				//
			 })
	

		$.fn.showVideoControls = function(e) {
				e.preventDefault();
				//slide toggle
				$(this).next().next(".anysurfvideocontrols").slideToggle('normal');
				
				}
		
		$('#showcontrols').click(function(e){
				$(this).showVideoControls(e);						  
			})		
		
		
		//vanuit zoekresultfilters focussen naar zoekveld:
		//zoekfunctie openklappen en focus zetten
		$('#zoekresultfilters a').click(function(e){
				var mytarget = $(this).attr("href");
				//alert('target= ' + mytarget);	
				$('#butsearch').focus();	
				if ($('#butsearch').hasClass('toggledown')){
						//alert('target staat dichtgeklapt');
						$('#butsearch').children().slidePanelfromotherlink(e);
						//$(this).kaartkust();
						//$(mytarget).focus();
						
					}	
				if ($('#butsearch').hasClass('toggleup')){
						//alert('target staat opengeklapt');
					}	
				$(mytarget).focus();
			})
		//sidenav cookiestuff: open en close status ophalen en toepassen
		var value = $.cookie(cookieName);
		//alert(value);
		if (!value){
			//alert("no cookie yet");
			//we set up a cookie
			$.cookie(cookieName, 'settings', {
									 	expires: 360,
										path: '/'
										//domain: 'jquery.com',
										//secure: true 
										});
							
		
			}
			else{
				//alert("cookie is available");
				//laad de values in
				var butsearch = $.cookie('butsearch');
				var butprofiel = $.cookie('butprofiel');
				var butmijnagenda = $.cookie('butmijnagenda');
				var butmijnzoekfuncties = $.cookie('butmijnzoekfuncties');
				var butrecentitems = $.cookie('butrecentitems');
				var butadmin = $.cookie('butadmin');
				var butorganisator = $.cookie('butorganisator');
				var butpers = $.cookie('butpers');
				var butmeestgelezen = $.cookie('butmeestgelezen');
				
				//alertCookie();
				//als een item 'open' staat, dan gaan  we bij het laden van de pagina:
				//toggledown als class verwijderen, toggleup toevoegen (verandert beeldje)
				//de list eronder zichtbaar zetten
				if (butsearch == 'open'){
					$('#sidenav #butsearch').removeClass('toggledown');
					$('#sidenav #butsearch').addClass('toggleup');
					$('#sidenav #butsearch').next(".toggle_container").show();
					}
				if (butprofiel == 'open'){
					$('#sidenav #butprofiel').removeClass('toggledown');
					$('#sidenav #butprofiel').addClass('toggleup');
					$('#sidenav #butprofiel').next(".toggle_container").show();
					}
				if (butmijnagenda == 'open'){
					$('#sidenav #butmijnagenda').removeClass('toggledown');
					$('#sidenav #butmijnagenda').addClass('toggleup');
					$('#sidenav #butmijnagenda').next(".toggle_container").show();
					}
				if (butmijnzoekfuncties == 'open'){
					$('#sidenav #butmijnzoekfuncties').removeClass('toggledown');
					$('#sidenav #butmijnzoekfuncties').addClass('toggleup');
					$('#sidenav #butmijnzoekfuncties').next(".toggle_container").show();
					}
				if (butrecentitems == 'open'){
					$('#sidenav #butrecentitems').removeClass('toggledown');
					$('#sidenav #butrecentitems').addClass('toggleup');
					$('#sidenav #butrecentitems').next(".toggle_container").show();
					}
				if (butadmin == 'open'){
					$('#sidenav #butadmin').removeClass('toggledown');
					$('#sidenav #butadmin').addClass('toggleup');
					$('#sidenav #butadmin').next(".toggle_container").show();
					}
				if (butorganisator == 'open'){
					$('#sidenav #butorganisator').removeClass('toggledown');
					$('#sidenav #butorganisator').addClass('toggleup');
					$('#sidenav #butorganisator').next(".toggle_container").show();
					}
				if (butpers == 'open'){
					$('#sidenav #butpers').removeClass('toggledown');
					$('#sidenav #butpers').addClass('toggleup');
					$('#sidenav #butpers').next(".toggle_container").show();
					}
				if (butmeestgelezen == 'open'){
					$('#sidenav #butmeestgelezen').removeClass('toggledown');
					$('#sidenav #butmeestgelezen').addClass('toggleup');
					$('#sidenav #butmeestgelezen').next(".toggle_container").show();
					}
				
				
				}
		
		
		
		//show map-overlays
		
		/*
		#kaartwvl
		#kaartwvlkust
		#kaartwvlbrugge
		#kaartwvlleie
		#kaartwvlwesthoek		
		
		*/
		$.fn.kaartkust = function(){
			var checked = false;
			var checked = $('#gswaar #ctl00_cphContent_chkKust').attr('checked')
			//alert(checked);
			if (checked){
				$('#kaartwvlkust').addClass('selected');
				}
			else{
				$('#kaartwvlkust').removeClass('selected');
				}	
			
			}
		$.fn.kaartbrugge = function(){
			var checked = false;
			var checked = $('#gswaar #ctl00_cphContent_chkBrugsommeland').attr('checked')
			//alert(checked);
			if (checked){
				$('#kaartwvlbrugge').addClass('selected');
				}
			else{
				$('#kaartwvlbrugge').removeClass('selected');
				}	
			
			}
		$.fn.kaartleiestreek = function(){
			var checked = false;
			var checked = $('#gswaar #ctl00_cphContent_chkLeiestreek').attr('checked')
			//alert(checked);
			if (checked){
				$('#kaartwvlleie').addClass('selected');
				}
			else{
				$('#kaartwvlleie').removeClass('selected');
				}	
			
			}
		$.fn.kaartwesthoek = function(){
			var checked = false;
			var checked = $('#gswaar #ctl00_cphContent_chkWesthoek').attr('checked')
			//alert(checked);
			if (checked){
				$('#kaartwvlwesthoek').addClass('selected');
				}
			else{
				$('#kaartwvlwesthoek').removeClass('selected');
				}	
			
			}
		
		$(this).kaartkust();
		$(this).kaartbrugge();
		$(this).kaartleiestreek();
		$(this).kaartwesthoek();
		
		$('#gswaar #ctl00_cphContent_chkKust').click(function(){
				$(this).kaartkust();						  
			})
		
				
		$('#gswaar #ctl00_cphContent_chkBrugsommeland').click(function(){
				$(this).kaartbrugge();						  
			})
		
				
		$('#gswaar #ctl00_cphContent_chkLeiestreek').click(function(){
				$(this).kaartleiestreek();						  
			})
		
				
		$('#gswaar #ctl00_cphContent_chkWesthoek').click(function(){
				$(this).kaartwesthoek();						  
			})
		
		
/*		
		$('#gswaar #kust').click(function(){
				var checked = false;
				var checked = $('#gswaar #kust').attr('checked')
				//alert(checked);
				if (checked){
					$('#kaartwvlkust').addClass('selected');
					}
				else{
					$('#kaartwvlkust').removeClass('selected');
					}				
										   
		})
		
	*/	
		//open citylist in sidenav
		$('.questionicon').click(function(e){
				e.preventDefault();
				//slide toggle
				
				$(this).next().next('.citylist').slideToggle('normal');
				
			})
		
		//$('.slidingpanel').parent().bind('keydown', function(e) {
		// keydown niet meer nodig : alle browsers vangen dit intussen op 
		/*
		$('#sidenav .questionicon').bind('keydown', function(e) {
				//e.preventDefault();
				//slide toggle
				if ($.browser.msie){}//ie intercepts enter-key as click and opens and closes .citylist  on 'enter'
				else if(e.keyCode==13){
					$(this).next().next('.citylist').slideToggle('normal');
				}
			})
		*/

$('.gsblock').attr("tabindex", "-1");
		
		
		
		
		//zoekresultaat scherm
		//3 panels dezelfde hoogte geven
		
		var watHeight 		= $('#panel-wat .stretchcontent').height();
		var waarHeight 		= $('#panel-waar .stretchcontent').height();
		var wanneerHeight 	= $('#panel-wanneer .stretchcontent').height();
		
		//alert (watHeight + ' ' + waarHeight + ' ' + wanneerHeight) ;
		
		if( watHeight >= waarHeight){
			var targetHeight = watHeight;
			}
			else{
				var targetHeight = waarHeight;
				}
		if(wanneerHeight >= targetHeight){
				var targetHeight = wanneerHeight;
			}
		
		//$('#panel-wat .stretchcontent').css('height',targetHeight);
		//$('#panel-waar .stretchcontent').css('height',targetHeight);
		//$('#panel-wanneer .stretchcontent').css('height',targetHeight);
		
		//alert (targetHeight) ;	
		
		//zoekresultaat
			if (jQuery.browser.msie) { 
					jQuery('.zoekresultaat .detailrow .sr-descr').css('zoom', '1'); 
				} 
			//openschuiver
			$('.zoekresultaat .inforow').click(function(e){
					e.preventDefault();
					$(this).next(".detailrow").slideToggle('normal');
				})
			
			//tablestriping
			$('.zoekresultaat .item:odd').addClass('rowcolor1');
			$('.zoekresultaat .item:even').addClass('rowcolor2');
		/*	
			var config = {    
			 over: makeTall, // function = onMouseOver callback (REQUIRED)    
			 timeout: 500, // number = milliseconds delay before onMouseOut    
			 out: makeShort // function = onMouseOut callback (REQUIRED)    
		};
		*/
		//$(".navmenu ul").hoverIntent( config )

			
			//if($.browser.msie && /6.0/.test(navigator.userAgent)){
				//alert('ie6');
				$('#topnav2 h2').mouseover(function(e){
							//e.preventDefault();
							//alert('boe');	
							$('ul.navmenu').hide();
							$(this).parent().children('ul').show();		
							//$(ul.navmenu).show();
						
					})
				$('#topnav2 ul').mouseout(function(e){
							//e.preventDefault();
							//alert('boe');	
							$(this).hide();
							//! de mouseout verbergt de ul ook bij hoveren over de ul
							
						
					})
				$('#topnav2 ul').mouseover(function(e){
							//nodig: de mouseout verbergt nl. de ul ook bij hoveren over de ul						
							//e.preventDefault();
							//alert('boe');	
							$(this).show();
							
						
					})
				
				
				//Hide (Collapse) the toggle containers on load
							//$(".toggle_container").hide(); 
							
							
							//Slide up and down on click
							$(".toggletriggerhotelresto").click(function(e){
								e.preventDefault();
								$(this).parent().next(".toggle_container").slideToggle("normal");
							});
			
			
			
			$(".ticketruil textarea").focus(function(e){
							$(this).animate({
									height: '150'	
								}, 500, function() {
									// Animation complete.
								});
							
							
						
					})	
		//$('.winnaarsoverzicht li:nth-child(2)').css('height',700);
		//wedstrijdoverzicht
		//doel: li's dezelfde hoogte geven als de hoogste li
	
		$('.wedstrijdoverzicht li').each(function (index) {
							var vorige = index-1;
							var huidige = index;
							var myListItemHeight = $(this).height();
							var myPreviousListItemHeight = $('.wedstrijdoverzicht li:eq('+ vorige +')').height();
							if($.isOdd(index)){
								if (myListItemHeight > myPreviousListItemHeight){
									$('.wedstrijdoverzicht li:eq(' + vorige +')').css('height', myListItemHeight);
									
									}
								else if (myListItemHeight < myPreviousListItemHeight){
									//alert('de vorige is hoger');
									//dit item zelfde hoogte geven als vorig item
									this.style.height = myPreviousListItemHeight +'px';
									$('.wedstrijdoverzicht li:eq(' + huidige +')').css('height', myPreviousListItemHeight);
									
									}
								else{
									//alert('ze zijn even hoog');
									//niks doen
									}	
								}
							else{
								
								if(index==0){
									//do nothing
									//alert('0000000');
								}

								//alert('even');
								//niks doen, we setten de height pas als we op de oneven li zitten
							}
							
				
		 	 })
	
			
	})
		
		/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

function setActiveStyleSheet(titlein) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == titlein+title2) a.disabled = false;
    }
  }
  //alert('title='+title);
  title = titlein;
  createCookie("style", titlein, 365);
  createCookie("contrast", title2, 365);
  
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 
    	&& a.getAttribute("title") 
    	&& !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getActiveContrast() {
  return title2;
}

function getPreferredStyleSheet() {  
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function getPreferredContrast() {  
  return '';
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function switchActiveContrast() {
  if (title2 == 'hc')
  {
  	title2 = '';
  }
  else
  {
  	title2 = 'hc';
  }
  //alert('title='+title+' title2='+title2);
  createCookie("style", title, 365);
  createCookie("contrast", title2, 365);
  setActiveStyleSheet(title);
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  //var cookie2 = readCookie("contrast");
  var title = cookie ? cookie : getPreferredStyleSheet();
  
  var title2 = cookie2 ? cookie2 : getPreferredContrast();
  //alert(title);
  //alert(title2);
  setActiveStyleSheet(title);
}


/*window.onunload = function(e) {
  var title = getActiveStyleSheet();
  var title2 = getActiveContrast();
  createCookie("style", title, 365);
  createCookie("contrast", title2, 365);
}*/

var cookie = readCookie("style");
var cookie2 = readCookie("contrast");
var title = cookie ? cookie : getPreferredStyleSheet();
var title2 = cookie2 ? cookie2 : getPreferredContrast();
setActiveStyleSheet(title);

//alert(title);

