// JavaScript Document
function getCookieVal (offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
        endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
        return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
    }
   return null;
}

function SetCookie (name, value) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
    }

function DeleteCookie() {
   var exp = new Date();
   exp.setTime (exp.getTime() - 1000000000);  // This cookie is history (changed -1 to make it previous time)
   var cval = GetCookie ('DemoName');
   document.cookie ='DemoName' + "=" + cval + "; expires=" + exp.toGMTString();
   alert("The cookie has been deleted.");
}



var GB_ANIMATION = true;

$(document).ready(function(){
	/* CONTENT ENGINE */
	var content = $('#content');
	content.html($('#site1').html());
	$('ul.submenu>li>a').click(function () {
		// aktiv setzen
		$('ul.submenu>li>a').removeClass('aktiv');
		$(this).addClass('aktiv');
		// content füllen
		var src = $($(this).attr("href"));
		content.html(src.html());
		this.blur();
		// slider reseten
		content.css('overflow', 'auto');
		content.css('height', 'auto');
		if (content.innerHeight() > 465){
			content.css('height', '495px');
			jQuery.each(jQuery.browser, function(i) {
			  if($.browser.msie){
			     content.css('overflow', 'scroll');
			  }else{
	  			content.css('overflow', '-moz-scrollbars-vertical');
				}
			});
		}else{
			content.css('overflow', 'hidden');
		}
		return false;
	});		


	/* Main Menu */
    $("ul.mainmenu li img").hover(
      function () {
      	var newsrc = $(this).attr('src').replace(/_off.gif/g, '_on.gif');
        $(this).attr('src', newsrc);
      }, 
      function () {
      	if (!$(this).hasClass('open')){
	      	var newsrc = $(this).attr('src').replace(/_on.gif/g, '_off.gif');
	        $(this).attr('src', newsrc);
		}
      }
    );
    $("a.obensub").click(function () {
		$('ul.sub:visible').slideUp('slow');
		$(this).parent().find('ul.sub:hidden').slideDown('slow');
		return false;
	});
	
	$('.mainmenu a').click(function(){
		site =  $(this).attr('href');
		SetCookie ('thispage', site);
		return true;
	});
	$('.mainmenu').ready(function() {
    var sPath = window.location.pathname;
		var site = sPath.substring(sPath.lastIndexOf('\/') + 1);
		// var site = GetCookie ('thispage');
		var activMenuItem = $(this).find("a[href='"+site+"']>img");
		
		if (activMenuItem){
			activMenuItem.parent().parent().parent().css('display', 'block');
			activMenuItem.parent().parent().parent().css('height', 'auto');
	
			activMenuItem.parent().parent().find('ul.sub').css('display', 'block');
			activMenuItem.parent().parent().find('ul.sub').css('height', 'auto');
			
			var newPic = activMenuItem.attr('src').replace(/_off.gif/g, '_on.gif');
			activMenuItem.addClass('open');
			activMenuItem.attr('src', newPic);
		}
		return false;
	});
	
	
	

	/* mehr Link */
    $('.more').click(function () {
    	$(this).blur();
    	var detailtext = $(this).parent().find('.fulltext');
		if(detailtext.is(':hidden')) {
			$(this).text('close...');
			detailtext.slideDown('slow');
			return false;
		} else {
			$(this).text('more...');
			detailtext.slideUp('slow');
			return false;
		}
    });
    
    
    /* Tooltip */
	$('.tooltip').tooltip({ showURL: false, positionRight: true });
    
	// Greybox
	$("a.greyboximage").click(function(){
		var t = this.title || this.innerHTML || this.href;
		GB_show(t,this.href,399,600);
		return false;
	});
	
	$("a.greybox").click(function(){
		var t = this.title || this.innerHTML || this.href;
		GB_show(t,this.href,530,798);
		return false;
	});
	
	
	
	
});
  

//////////////////// scroll ////////////////////////////////////////////////////////////////////////////
jQuery.getPos = function (e) { var l = 0; var t  = 0; var w = jQuery.intval(jQuery.css(e,'width')); var h = jQuery.intval(jQuery.css(e,'height')); var wb = e.offsetWidth; var hb = e.offsetHeight; while (e.offsetParent){ l += e.offsetLeft + (e.currentStyle?jQuery.intval(e.currentStyle.borderLeftWidth):0); t += e.offsetTop  + (e.currentStyle?jQuery.intval(e.currentStyle.borderTopWidth):0); e = e.offsetParent; } l += e.offsetLeft + (e.currentStyle?jQuery.intval(e.currentStyle.borderLeftWidth):0); t  += e.offsetTop  + (e.currentStyle?jQuery.intval(e.currentStyle.borderTopWidth):0); return {x:l, y:t, w:w, h:h, wb:wb, hb:hb}; };jQuery.getClient = function(e) { if (e) { w = e.clientWidth; h = e.clientHeight; } else { w = (window.innerWidth) ? window.innerWidth : (document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.offsetWidth;
h = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.offsetHeight; } return {w:w,h:h}; }; jQuery.getScroll = function (e) { if (e) { t = e.scrollTop; l = e.scrollLeft; w = e.scrollWidth; h = e.scrollHeight; } else  { if (document.documentElement && document.documentElement.scrollTop) { t = document.documentElement.scrollTop; l = document.documentElement.scrollLeft; w = document.documentElement.scrollWidth; h = document.documentElement.scrollHeight; } else if (document.body) { t = document.body.scrollTop; l = document.body.scrollLeft; w = document.body.scrollWidth; h = document.body.scrollHeight; } } return { t: t, l: l, w: w, h: h }; }; jQuery.intval = function (v) { v = parseInt(v); return isNaN(v) ? 0 : v; }; jQuery.fn.ScrollTo = function(s) { o = jQuery.speed(s); return this.each(function(){ new jQuery.fx.ScrollTo(this, o); }); }; jQuery.fx.ScrollTo = function (e, o) { var z = this;
z.o = o; z.e = e; z.p = jQuery.getPos(e); z.s = jQuery.getScroll(); z.clear = function(){clearInterval(z.timer);z.timer=null}; z.t=(new Date).getTime(); z.step = function(){ var t = (new Date).getTime(); var p = (t - z.t) / z.o.duration; if (t >= z.o.duration+z.t) { z.clear(); setTimeout(function(){z.scroll(z.p.y, z.p.x)},13); } else { st = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.y-z.s.t) + z.s.t; sl = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.x-z.s.l) + z.s.l; z.scroll(st, sl); } }; z.scroll = function (t, l){window.scrollTo(l, t)}; z.timer=setInterval(function(){z.step();},13); };


/**
 * SWFObject v1.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
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,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"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(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={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.push(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");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_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");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_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(_23,_24){
var _25=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_25=new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(var i=3;axo!=null;i++){
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
_25=new deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_23&&_25.major>_23.major){return _25;}
if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){
try{_25=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}
catch(e){}}}
return _25;};
deconcept.PlayerVersion=function(_29){
this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0;
this.minor=parseInt(_29[1])||0;
this.rev=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(q){
var _2d=q.indexOf(_2b+"=");
var _2e=(q.indexOf("&",_2d)>-1)?q.indexOf("&",_2d):q.length;
if(q.length>1&&_2d>-1){
return q.substring(q.indexOf("=",_2d)+1,_2e);
}}return "";}};
if(Array.prototype.push==null){
Array.prototype.push=function(_2f){
this[this.length]=_2f;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject; // for backwards compatibility
var SWFObject=deconcept.SWFObject;



function HideContent(d) {
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
document.getElementById(d).style.display = "block";
}
function ReverseDisplay(d) {
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}
