
/***************

The most common way to detect Internet Explorer is to use client-side scripting to parse the user-agent string and extract the version number from the version token. 
The following example shows the preferred way to do this with JavaScript.

******************/
	
var browser = navigator.appName
var ver = navigator.appVersion
var thestart = parseFloat(ver.indexOf("MSIE"))+1
var brow_ver = parseFloat(ver.substring(thestart+4,thestart+7))


/**
 * jQuery Delay - A delay function
 * Copyright (c) 2009 Clint Helfers - chelfers(at)gmail(dot)com | http://blindsignals.com
 * Dual licensed under MIT and GPL.
 * Date: 7/01/2009
 * @author Clint Helfers
 * @version 1.0.0
 *
 * http://blindsignals.com/index.php/2009/07/jquery-delay/
 */


$.fn.delay = function( time, name ) {

    return this.queue( ( name || "fx" ), function() {
        var self = this;
        setTimeout(function() { $.dequeue(self); } , time );
    } );

};

$(document).ready(function() {
						   
						   
		// set Timeout to move the nav bar up.
		var myTimeout = 0;


		if ((browser=="Microsoft Internet Explorer") && (brow_ver < 7)) {
		//IE6 stuff do nothing 
		//IE6 stuff
		// what you need to do when the DOM is ready.
		$("div#minipanel").stop(true, true).animate({ top : "-350"}, "fast");
		}




						   
// JavaScript Document
function setCookie(c_name,value,expiredays)
{
	  var futdate = new Date()	;	//Get the current time and date
      var expdate = futdate.getTime();  //Get the milliseconds since Jan 1, 1970
      expdate += 3600*1000;  //expires in 1 hour(milliseconds)
      futdate.setTime(expdate);
      


//var exdate=new Date();
//exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+futdate.toGMTString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}


		if ((browser=="Microsoft Internet Explorer") && (brow_ver < 7)) {
		//IE6 stuff do nothing 

		}else{

				//We can create a nice fade effect without the common problem of multiple queued animations by adding .stop(true, true) to the chain:
				$(".toppanel").hover(function() {
			
					//how to kill a setTimeout() function
					clearTimeout(myTimeout);
                   if (browser=="Microsoft Internet Explorer"){
                        $(this).stop(true, true).animate({ top: "0px"}, "fast");
                        $("div#panel div.content").stop(true, true).animate({ opacity: "show"},"fast");
                        $("div#minipanel").stop(true, true).animate({opacity: "hide",height : "1", top : "-350"}, 0);
                    }else{
						 $("div#minipanel").stop(true, true).animate({opacity: "hide",height : "1", top : "-350"}, "fast"); 
                        $(this).stop(true, true).animate({ top: "0px"}, "slow");
                        $("div#panel div.content").stop(true, true).animate({ opacity: "show"},"slow");
                    
                    }
			
				}, function() {
			
					//how to kill a setTimeout() function
					//clearTimeout(myTimeout);
					// set Timeout to move the nav bar up.
					//var myTimeout = window.setTimeout(collapse_bar,200);
			
					$(this).fadeIn(5000).animate({top: "-88px"},"fast", function() {
					$("div#panel div.content").animate({ opacity: "hide"}, 0);
					$("div#minipanel").animate({opacity: "show", height : "30", top : "-45"},  "fast");
				});
					//how to kill a setTimeout() function
					//clearTimeout(myTimeout);
				}	);

	
		}
	
	
	
	
	
	//collapse navigationbar
	var collapse_bar = function() { 
		$(".toppanel").stop(true, true).animate({top: "-85px"}, "slow");
		$("div#panel div.content").stop(true, true).animate({ opacity: "hide"}, "fast");
		$("div#minipanel").stop(true, true).animate({opacity: "show", height : "30", top : "-45"}, 1000);
	};
	
	
	

	
		if ((browser=="Microsoft Internet Explorer") && (brow_ver < 7)){
		//IE6 stuff do nothing 

		}else{
	
			function checkCookie()
			{
			firstvisit=getCookie('firstvisit_cookie');
			if (firstvisit!=null && firstvisit!="")
			  {
				// ben hier al geweest !
				// alert('Welcome again '+firstvisit+'!');
				
				//Durations are given in milliseconds; 
				//higher values indicate slower animations, not faster ones. 
				//The strings 'fast' and 'slow'  can be supplied to indicate durations of 200 and 600  milliseconds, respectively.
				// what you need to do when the DOM is ready.
		
				$("div#panel div.content").hide();
				$(".toppanel").stop(true, true).animate({top: "-85px"}, 1);
				$("div#minipanel").stop(true, true).animate({opacity: "show", height : "30", top : "-45"}, "fast");
		
		
			  }
			else
			  {
				//alert('niks');
				setCookie('firstvisit_cookie','first visiteur',365);
				
		
				// what you need to do when the DOM is ready.
				$("div#minipanel").stop(true, true).animate({ top : "-350"}, "fast");
			
		
				// set Timeout to move the nav bar up.
				var myTimeout = window.setTimeout(collapse_bar,3000);
			
				
				
			  }
			}
			
			
			
			checkCookie();
		}
	
	
		/*
function checkCookie()
{
firstvisit=getCookie('firstvisit_cookie');
if (firstvisit!=null && firstvisit!="")
  {
	// ben hier al geweest !
	// alert('Welcome again '+firstvisit+'!');

  }
else
  {
	//alert('niks');
    setCookie('firstvisit_cookie','first visiteur',365);
    
  }
}
		
		
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");
	
	});	
	
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");	
	});	
	
	
	
	$(".menu a").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-75"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-85"}, "fast");
	});

	
	// Expand Panel
	$("#open").hover(function(){
		$("div#panel").slideDown("slow");
	
	});	
	
	// Collapse Panel
	$("#close").mouseout(function(){
		$("div#panel").slideUp("slow");	
	});	
	
	$(".toppanel").hover(function() {
		$("div#panel").slideDown("slow");
	}, function() {
		$("div#panel").slideUp("slow");	
	});

	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});	
		*/	
		
});
