$(function()
{
	//var popp= $.cookie('popp');
	
	//if(popp != "zu")
	//{
		$('body').append('<div class="overlay"></div><div class="blackback" style="display:none; top:50%px; left:50%;"></div><div class="diashow" style="display:none; top:50%px; left:50%;"><a style="color:white; cursor:pointer;" class="close">X</a><p>In Memory of Katharina Wunsch<br /> (* 6. Dezember 1985 - † 29. Januar 2010)</p><div class="popup_image"><img height="400" src="http://masomo.org/images/wunsch.png" /></div><p>Pumzika Kwa amani... Rest in Peace</p></div>');
		$(".overlay").css({height:"100%",left:"0",position:"fixed",top:"0",width:"100%"});
		$(".diashow").css({textAlign:"center",height:"500px",marginLeft:"-223px",marginTop:"-300px",padding:"50px",position:"fixed",width:"340px"});
		$(".diashow p").css({color:"white"});
		$(".diashow .close").css({left:"248px",top:"-44px", position:"relative"});
		$(".blackback").css("-moz-border-radius","10px").css({opacity:"0.9",backgroundColor:"black",height:"500px",marginLeft:"-260px",marginTop:"-300px",padding:"50px",position:"fixed",width:"420px"});
		$(".popup_image img").css("-moz-border-radius","10px");

		var speed = 2000;
		
		//nicht IE6
		if(!$.browser.msie && $.browser.version != "6.0")
		{
			//nicht IE und nicht safari
			if(!$.browser.msie && !$.browser.safari)
			{
				//diashow in den screen animieren
				$('.diashow').fadeIn(speed);
				$(".blackback").fadeIn(speed);
			}else{ //IE & safari
				//position ermitteln & diashow in den screen animieren
				var winh = document.documentElement.clientHeight;
				var pos = (winh/2);
				$('.diashow').fadeIn(speed);
				$(".blackback").fadeIn(speed);
			}
		}else{ //IE6
			//transparentes hintergrundbild und alle weiteren anpassungen damit der hintergrund GLEICHZEITIG mit animiert wird wie bei den anderen browsern
			$('.diashow').css({position:"absolute", backgroundImage: "none"});
			
			var dh = $('.diashow').height()+100;
			var dw = $('.diashow').width()+100;
			
			$(".blackback").css({position: "absolute",zIndex:"1",backgroundImage: "none"});
			
			$(".overlay").css("position","absolute");
			$(".diashow").css({zIndex:"20000"});

			//damit die diashow auch im screen ist wenn man weiter runter gescrollt hat
			var scrollpos = document.documentElement.scrollTop;

			var pos = scrollpos+ $('.diashow').height()-100;
						
			//animation der diashow und des transparenten hintergrundes
			$('.diashow').fadeIn(speed);
			$(".blackback").fadeIn(speed);
		}
		
		//Close function um die diashow zu schließen wenn man den close button clicked oder overlay
		function Close()
		{
			//alles aus dem bild animieren
			$(".blackback").fadeOut(speed);
			$('.diashow').fadeOut(speed, function()
			{
				//diashow und transparentes hintergrundbild fuer IE6 loeschen
				$('.diashow').remove();
				$(".blackback").remove();
			});
			//overlay loeschen
			$('.overlay').remove();
			
			//$.cookie('popp', 'zu', { expires: 1 });
		}

		//overlay
		$('.overlay').click(function()
		{
			Close();
		});

		//close button
		$(".close").click(function()
		{
			Close();
		});	
	//}
});

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 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
 *
 *
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                //date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); //tage
				date.setTime(date.getTime() + (options.expires * 60 * 60 * 1000)); //stunden
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};