var jmenu = {
	timer:0,
	timer_main:0,
	runnext:1,
	running:false,
	speedin1:100,
	speedin2:200,
	speedout2:100,
	speedout1:100,
	useDebug:false,
	closetimer:1500,
	openMenu:'',

	stripTags : function(s)
	{
      return  s.replace(/<\/?[^>]+>/gi, '');
 	},

	menuover_main : function(obj)
	{
		this.debug('menuover_main');
		$('.submenu_line').fadeIn(this.speedin1,function(){});
		this.holdmenu_main(obj);
	},

	menuover : function(obj)
	{
		this.holdmenu(obj);

		html=obj.parent().find('.submenu').html();
		this.debug('menuover',obj);

		if (html.replace('\n','')&&(this.stripTags(html)!=this.stripTags(this.openMenu)||this.stripTags(html)!=this.stripTags($('#submenu').html())))
		{
			if (this.running)
			{
				 this.runnext=function(){jmenu.menuover(obj)}
				 return 0;
			}

			if ($('#submenu').html()!=html)
			{
				if ($('#submenu').css('display')=='block')
				{
					this.switchmenu(obj);
				}
				else
				{
					$('#submenu').html(html);
					$('#submenu').slideDown(this.speedin2,jmenu.menuover_done);
				}
			}
		}
		else
		if (this.stripTags(html)!=this.stripTags(this.openMenu))
		{
			if (this.running)
			{
				 this.runnext=function(){jmenu.menuoutnow(obj,1)}
				 return 0;
			}
			else
				jmenu.menuoutnow(obj,1);
		}
	},

	debug : function(text,obj)
	{
		if (this.useDebug)
		if(obj)
			document.getElementById('ajax').innerHTML+=obj.attr('class')+'| '+text+'<br>';
		else
			document.getElementById('ajax').innerHTML+=text+'<br>';
	},

	menuover_done : function(obj)
	{
		//nix :)
	},

	menuout_main : function(obj)
	{
		this.debug('menuout_main',obj);
		window.clearTimeout(this.timer_main);
		this.timer_main=window.setTimeout(function(){jmenu.menuoutnow_main(obj)},this.closetimer);
		this.menuout(obj);
	},

	menuout : function(obj)
	{
		this.debug('menuout',obj);
		window.clearTimeout(this.timer);

		if (this.stripTags($('#submenu').html())!=this.stripTags(this.openMenu))
			this.timer=window.setTimeout(function(){jmenu.menuoutnow(obj)},this.closetimer);
	},

	menuclear : function(obj)
	{
		this.debug('menuclear',obj);
		$('#submenu').html('');
		$('#submenu').css('display','none');
	},

	switchmenu : function(obj)
	{
		this.menuoutnow(obj,function(){jmenu.menuover(obj)})
	},

	menuoutnow : function(obj,after)
	{
			this.debug('menuoutnow',obj);
			if (this.running)
			{
				this.runnext=function(){jmenu.menuout(obj)};
				return 0;
			}

			if ($('#submenu').html()&&$('#submenu').html()!='<div></div>')
			{
				this.running=true;
				$('#submenu').slideUp(this.speedout2,function(){jmenu.menuoutnow_done(obj,after)});
			}
			else
			{
				this.menuoutnow_done(obj,after);
			}
	},

	menuoutnow_main : function(obj,after)
	{
		if (!this.openMenu)
			$('.submenu_line').fadeOut(this.speedout1);
	},

	menuoutnow_done : function(obj,after)
	{
		this.menuclear(obj);
		this.debug('menuoutnow_done ('+after+')',obj);
		this.running=false;
		this.runfunktion(after);

		MYrunnext=jmenu.runnext;
		jmenu.runnext=1;
		this.runfunktion(MYrunnext);

		if (this.openMenu&&!after)
		{
			$('#submenu').html(this.openMenu);
			$('#submenu').slideDown(this.speedin2,jmenu.menuover_done);
		}
	},

	runfunktion : function (funktion)
	{
	   if (funktion!=1&&funktion)
	   	funktion();
	},

	holdmenu : function(obj)
	{
		this.debug('holdmenu',obj);
		window.clearTimeout(this.timer);
		this.holdmenu_main(obj);
	},

	holdmenu_main : function(obj)
	{
		this.debug('holdmenu_main',obj);
		window.clearTimeout(this.timer_main);
	}
}

var jcontentmenu = {
	over : function(obj)
	{
		obj.attr('class','item on');
	},

	out : function(obj)
	{
		obj.attr('class','item off');
	},

	click : function(obj)
	{
		location.href=obj.find('a').attr('href');
		return false;
	}
}

var jtransaktion = {
	onitem: null,
	noclick:false,

	over : function(obj)
	{
		if (obj.attr('class')!='item on')
			obj.attr('class','item over');
	},

	out : function(obj)
	{
		if (obj.attr('class')!='item on')
			obj.attr('class','item');
	},

	click : function(obj)
	{
		if (!this.noclick&&obj.attr('class')!='item on')
		{
			if (this.onitem)
				this.close(this.onitem);
			obj.attr('class','item on');
			this.onitem=obj;
		}
	},

	close : function(obj)
	{
		this.onitem.attr('class','item');
		this.onitem=null;
		this.noclick=true;
		window.setTimeout(function(){jtransaktion.noclick=false;},1);
	},

	change : function(obj)
	{
		location.href=obj.attr('value');
	}
}

var jpresse = {
	change : function(obj)
	{
		location.href=obj.attr('value');
	}
}

var jnavigation = {
	back : function(obj)
	{
		location.href=$('.navigator .back a').attr('href');
	},

	next : function(obj)
	{
		location.href=$('.navigator .next a').attr('href');
	}
}

var jselectbox = {
	outtimer:0,
	outtimer2:0,

	click : function(obj)
	{
		obj=obj.parent().find('.jselectunten');
		if (obj.css('display')=='none')
			obj.css('display','block');
		else
			obj.css('display','none');
	},

	itemover  : function(obj)
	{
		this.hold();
		this.hold2();
		obj.attr('class',obj.attr('class')+' over');
	},

	itemout  : function(obj)
	{
		obj.attr('class',obj.attr('class').replace(' over',''));
	},

	getoption : function(select,index)
	{
		option=select.find('option');
		for(getValueObj_i=0;getValueObj_i<=index;getValueObj_i++)
		{
			if (getValueObj_i==index) return option;
			option=option.next();
			if (!option) return null;
		}
	},

	setselect : function(obj,select,neu)
	{
		teile=obj.attr('class').split('_');

		//selectbox
		option=this.getoption(select,teile[1]);
		value=option.attr('value')
		select.val(value);

		//jselectbox
		myobj=obj.parent().children();
		for(deep=0;deep<=myobj.length;deep++)
		if ((option=$(myobj[deep]))&&option.attr('class'))
		{
			mclass=option.attr('class').replace(' on','');
			teile2=mclass.split('_');
			option.attr('class',mclass);
			if (teile2[1]==teile[1])
			{
				option.attr('class',mclass+' on');
				obj.parent().prev().html(option.html());
			}
		}

		//events auf selectbox auslösen
		select.trigger('change');
		select.trigger('click');
	},

	itemclick  : function(obj)
	{
		this.setselect(obj,obj.parent().parent().prev());

		if (obj.attr('class').indexOf('on')==-1)
		{
			this.outnow(obj.parent());
		}
		else
		{
			this.outnow(obj.parent());
		}
	},

	out : function(obj)
	{
		obj=obj.find('.jselectunten');
		this.hold();
		this.outtimer=window.setTimeout(function(){jselectbox.outnow(obj)},400);
	},

	outnow : function(obj)
	{
		obj.css('display','none');
		this.outtimer=0;
	},

	hold : function(obj)
	{
		if (jselectbox.outtimer)
		{
			window.clearTimeout(jselectbox.outtimer);
			jselectbox.outtimer=0;
		}
	},

	hold2 : function(obj)
	{
		if (jselectbox.outtimer2)
		{
			window.clearTimeout(jselectbox.outtimer2);
			jselectbox.outtimer2=0;
		}
	},

	untenover : function(obj)
	{
		this.untenoutnow(obj);
		obj.attr('class',obj.attr('class')+' on');
	},

	untenout : function(obj)
	{
		this.hold2();
		this.outtimer2=window.setTimeout(function(){jselectbox.untenoutnow(obj)},10);
	},

	untenoutnow : function(obj)
	{
		obj.attr('class',obj.attr('class').replace(' on',''));
	}
}

var jhomeimage = {
	pos:new Array(),
	cur:0,
	bilder:new Array(),
	fadespeed:800,
	swapspeed:4000,

	init : function()
	{
		for(i=0;i<this.bilder.length;i++)
			this.pos[i]=0;

		this.pos[0]++;
		window.setInterval(function(){jhomeimage.run()},this.swapspeed);
	},

	run : function()
	{
		$('.homeimage .b').fadeIn(this.fadespeed,this.imagedone);

		$('.homeimage .cb').html(this.bilder[this.cur][0]);
		$('.homeimage .ca').animate({top:80},this.fadespeed);
		$('.homeimage .cb').animate({top:20},this.fadespeed,this.fontdone);
	},

	imagedone : function()
	{
		$('.homeimage .a img').attr('src',$('.homeimage .b img').attr('src'));
		$('.homeimage .b').css('display','none');

		jhomeimage.cur++;
		if (jhomeimage.cur>=jhomeimage.bilder.length)
			jhomeimage.cur=0;

		jhomeimage.pos[jhomeimage.cur]++;
		if (jhomeimage.pos[jhomeimage.cur]>=jhomeimage.bilder[jhomeimage.cur].length)
			jhomeimage.pos[jhomeimage.cur]=1;

		$('.homeimage .b img').attr('src',jhomeimage.bilder[jhomeimage.cur][jhomeimage.pos[jhomeimage.cur]]);
	},

	fontdone : function()
	{
		$('.homeimage .ca').html($('.homeimage .cb').html());
		$('.homeimage .ca').css('top','20px');
		$('.homeimage .cb').css('top','-40px');
	}
}

var jteaser = {
	swapspeed:3000,
	fadetime:500,
	movetime:400,
	teaser:new Array('teaser_a','teaser_b','teaser_c','teaser_e','teaser_f'),
	useDebug:0,
	animationrun:new Array(),

	init : function()
	{
		window.setInterval(function(){jteaser.run()},this.swapspeed);
	},

	debug : function(text,obj)
	{
		if (this.useDebug)
		if(obj)
			document.getElementById('ajax').innerHTML+=obj.attr('class')+'| '+text+'<br>';
		else
			document.getElementById('ajax').innerHTML+=text+'<br>';
	},

	run : function()
	{

		for(i=0;i<jteaser.teaser.length;i++)
		if (teaser=jteaser.teaser[i])
		{
			if( $('.'+teaser+' .autoload a').html())
			{
				url=$('.'+teaser+' .autoload a').attr('href').split('?');
				html = $.ajax({
		      url: url[0],
		      global: false,
		      type: "GET",
		      data: url[1],
		      dataType: "html",
		      async:false
			   }
				).responseText;
				$('.'+teaser+' .b.load').html(html);
				this.show($('.'+teaser+' .b.load'));
			}
		}

	},

	click : function(obj)
	{
		this.debug('click');
		obj.unbind();
		if (obj.attr('class').indexOf('next')!=-1||obj.attr('class').indexOf('prev')!=-1)
		{
			this.load(obj);
		}
		else
		if (obj.parent().find('.link a'))
		{

			if (obj.parent().find('.link a').attr('target')=='newsletter') {
				popup(obj.parent().find('.link a').attr('href'),730,730);
			} else if (obj.parent().find('.videolink a').attr('target')=='_blank') {

			} else if (obj.parent().find('a.noscriptlink').hasClass('noscriptlink')) {

			} else {
				location.href=obj.parent().find('.link a').attr('href');
			}

		}
	},

	load : function(obj)
	{
		url=obj.find('a').attr('href').split('?');
		this.debug(url);
		if (url)
		{
			html = $.ajax({
	      url: url[0],
	      global: false,
	      type: "GET",
	      data: url[1],
	      dataType: "html",
	      async:false
		   }
			).responseText;
			obj.parent().parent().find('.load').html(html);
			this.show(obj.parent().parent().find('.load'),obj);
		}
	},

	show : function(obj,obj2)
	{
		if (!jteaser.animationrun[obj.parent().attr('class')])
		{
			jteaser.animationrun[obj.parent().attr('class')]=1;

			if (jQuery.browser.msie)
			{
				obj.parent().find('.load .ba').get(0).style.removeAttribute('filter');
				obj.parent().find('.show .ba').get(0).style.removeAttribute('filter');
				if (obj.parent().find('.load .bb').html())
				{
					obj.parent().find('.load .bb').get(0).style.removeAttribute('filter');
					obj.parent().find('.show .bb').get(0).style.removeAttribute('filter');
				}
			}

			move='autoload';
			if (obj2)
				move=obj2.attr('class');

			if (move=='next')
			{
				obj.find('.bm div').css('left','-220px');
				obj.css('display','block');
				obj.find('.bm div').animate({left:0},jteaser.movetime);
				obj.parent().find('.show .bm div').animate({left:420},jteaser.movetime,function(){jteaser.fin(obj)});
			}

			if (move=='prev')
			{
				obj.find('.bm div').css('left','420px');
				obj.css('display','block');
				obj.find('.bm div').animate({left:0},jteaser.movetime);
				obj.parent().find('.show .bm div').animate({left:-220},jteaser.movetime,function(){jteaser.fin(obj)});
			}

			if (move=='autoload')
			{
				obj.parent().find('.show').fadeOut(this.fadetime);
				obj.parent().find('.load').fadeIn(this.fadetime,function(){jteaser.fin(obj)});
			}
		}
	},

	fin : function(obj)
	{
		if (obj.parent().find('.load').html()!='fin')
		{
			obj.parent().find('.show').html(obj.html());
			obj.parent().find('.show').css('display','block');
			obj.parent().find('.load').css('display','none');
			obj.parent().find('.load').html('fin');
			obj.parent().find('.show .bm div').css('left','0px');
			jload.teaserbind();//rebind
			jteaser.animationrun[obj.parent().attr('class')]=0;
		}
	}
}

var jajax_form = {
	old_errors:new Array(),

	submit : function()
	{
		url=$('.form').parent().parent().parent().find('form').attr('action');
		formname=$('.form').parent().parent().parent().find('form').attr('name');
		html = $.ajax({
     url: url,
     global: false,
     type: 'POST',
     data: this.post(formname),
     dataType: "html",
     async:false
	   }
		).responseText;
		this.check_error(html);
	},

	post : function (formname)
	{
	 var elemente= new Array();
	 elemente['text']=1;
	 elemente['password']=1;
	 elemente['hidden']=1;
	 elemente['textarea']=1;
	 elemente['checkbox']=2;
	 elemente['select-one']=1;
	 elemente['select-multiple']=3;
	 elemente['radio']=4;

		mytest='';
		count='';
		num=0;
		i=0;
		while(obj=document.forms[formname].elements[i++])
		{
			if (elemente[obj.type]==1)
			{
				if (mytest!='') mytest+='&';
				mytest=mytest+obj.name+'='+escape(obj.value);
			}

			if (elemente[obj.type]==2)
			{
				if (mytest!='') mytest+='&';
				if (obj.checked)	myvalue=obj.value; else myvalue='';
				mytest=mytest+obj.name+'='+escape(myvalue);
			}

			if (elemente[obj.type]==3)
				for(ix=0;ix<=obj.options.length-1;ix++)
					if (obj.options[ix].selected)
					{
						if (mytest!='') mytest+='&';
						mytest=mytest+obj.name.replace(/\[\]/,'['+ix+']')+'='+escape(obj.options[ix].value);
					}

			if (elemente[obj.type]==4)
				if (obj.checked)
				{
					if (mytest!='') mytest+='&';
					mytest=mytest+obj.name+'='+escape(obj.value);
				}

		}
		return mytest;
	},

	check_error : function(errors)
	{
		//alert(errors);
		teile=errors.split('|');
		for(key in this.old_errors)
		if(this.old_errors[key])
		{
			if (document.getElementById(key))
			{
				if (this.old_errors[key]!=1)
					document.getElementById(key).className=this.old_errors[key];
				else
					document.getElementById(key).className='no_error';
			}
			this.old_errors[key]=0;
		}

		if (teile[0]!='ok'){
			for(i in teile)
			if (teile[i])
			{
				if (teile[i] == 'errortext')
				{
					document.getElementById('error').innerHTML = teile[(i*1)+1];
				}

				if (document.getElementById(teile[i]))
				{
					this.old_errors[teile[i]]=document.getElementById(teile[i]).className;
					if (!this.old_errors[teile[i]]) this.old_errors[teile[i]]=1;
					document.getElementById(teile[i]).className+=' error';
				}
			}
		}

		if (teile[0]=='ok')
		{
			if (teile[1])
			{
				teile[1]=teile[1].replace(/&amp;/g,'&');
				location.href=teile[1];
			}
			if (teile[2])
			{
				teile[2]=teile[2].replace(/&amp;/g,'&');
				eval(teile[2]);
			}
		}
	},

	un_check_error:function()
	{
		for(key in this.old_errors)
		if(this.old_errors[key])
		{
			if (document.getElementById(key))
			{
				if (this.old_errors[key]!=1)
					document.getElementById(key).className=this.old_errors[key];
				else
					document.getElementById(key).className='no_error';
			}
			this.old_errors[key]=0;
		}
	}
}

var jajax_nl_login = {
	open : function()
	{
		$('.nl_login_form').css('display','block');
	},

	close : function()
	{
		$('.nl_login_form').css('display','none');
	}
}

var jload = {
	load : function()
	{
		this.extendjquery();
		this.selectbox();
		this.setmenuwidth();
		this.checksubmenu();
		this.menu();
		this.contentmenu();
		this.transaktion();
		this.transaktion_modul();
		this.presse_news();
		this.navigation();
		this.footer();
		this.image();
		this.textlink();
		this.homeimage();
		this.teaserbind();
		this.teaserstart();
		this.ajaxform();
		this.nl_login();
	},

	extendjquery : function()
	{
		jQuery.fn.outerHTML = function(s)
		{
			return (s)
			? this.before(s).remove()
			: jQuery("<p>").append(this.eq(0).clone()).html();
		};
	},

	nl_login : function()
	{
		if ($('.nl_login').html())
		{
			$('.nl_login').bind('click',function(){jajax_nl_login.open();return false});
			$('.nl_login_form .close').bind('click',function(){jajax_nl_login.close();return false});
		}
	},

	ajaxform : function()
	{
		if ($('.form').html())
		{
			$('.form .fbutton').bind('click',function(){jajax_form.submit(this);return false});
		}
	},

	textlink : function()
	{
		if ($('.text').html())
		{
			for(link in $('.text a'))
				if ($('.text a')[link].nodeType == 1)
				//if ($($('.text a')[link]).attr('target')=='_blank')
				{
					mclass=$($('.text a')[link]).attr('class');
					if (mclass)
						mclass+' ';
					mclass+='arrow';
					$($('.text a')[link]).attr('class',mclass);
				}
		}
	},

	teaserbind : function()
	{
		if ($('.hometeaser').html())
		{
			for(i=0;i<jteaser.teaser.length;i++)
			if (teaser=jteaser.teaser[i])
			{
				$('.'+teaser+' .b div').unbind();
				$('.'+teaser+' .bm').bind('click',function(){jteaser.click($(this))});
				$('.'+teaser+' .next').bind('click',function(){jteaser.click($(this))});
				$('.'+teaser+' .prev').bind('click',function(){jteaser.click($(this))});
			}
		}
	},

	teaserstart : function()
	{
		if ($('.hometeaser').html())
		{
			jteaser.init();
		}
	},

	homeimage : function()
	{
		if ($('.homeimage').html())
		{
			jhomeimage.init();
		}
	},

	image : function()
	{
		if ($('.image').html())
		{
			for(images in $('.image'))
				if ($('.image')[images].nodeType == 1)
					if ($($('.image')[images]).position().left!=45)
						$($('.image')[images]).attr('class',$($('.image')[images]).attr('class')+' next');
		}
	},

	selectbox : function()
	{
		selects=document.getElementsByTagName('select');
		for(select=0;select<=selects.length-1;select++)
		if ($(selects[select]).attr('class')=='jselect')
		{
			jselect=$(selects[select]);

			html='';
			html+='<div class="jselectbox jselect" style="width:'+(jselect.width()+5)+'px">';
			html+='<div class="jselectoben" >'+selects[select].options[selects[select].selectedIndex].text+'</div>';
			html+='<div class="jselectunten" style="width:'+(jselect.width()-2+5)+'px">';

			for(i=0;i<=selects[select].length-1;i++)
			{
				on='';
				if (selects[select].selectedIndex==i) on='on ';
				html+='<div class="jselectitem '+on+'_'+i+'_">'+selects[select].options[i].text+'</div>';
			}

			html+='</div></div>';
			$(jselect).css('display','none');
			$(jselect).replaceWith(jselect.outerHTML()+html);
		}

		$('.jselectbox').bind('mouseover',jselectbox.hold);
		$('.jselectbox .jselectoben').bind('mouseover',jselectbox.hold);
		$('.jselectbox .jselectoben').bind('click',function(){jselectbox.click($(this))});
		$('.jselectbox').bind('mouseout',function(){jselectbox.out($(this))});
		$('.jselectbox .jselectunten .jselectitem').bind('mouseover',function(){jselectbox.itemover($(this))});
		$('.jselectbox .jselectunten .jselectitem').bind('mouseout',function(){jselectbox.itemout($(this))});
		$('.jselectbox .jselectunten').bind('mouseover',function(){jselectbox.untenover($(this))});
		$('.jselectbox .jselectunten').bind('mouseout',function(){jselectbox.untenout($(this))});
		$('.jselectbox .jselectunten .jselectitem').bind('click',function(){jselectbox.itemclick($(this))});
		$('.jselectbox .jselectunten .jselectitem.on').bind('click',function(){jselectbox.itemclick($(this))});
	},

	navigation : function()
	{
		if ($('.navigator').html())
		{
			$('.navigator .back').bind('click',function(){jnavigation.back($(this))});
			$('.navigator .next').bind('click',function(){jnavigation.next($(this))});

			back=$('.navigator .back a').html().split('|');
			if (back[1]*1<=0)
				$('.navigator .back').css('visibility','hidden');

			next=$('.navigator .next a').html().split('|');
			if (next[1]*1>next[0]*1)
				$('.navigator .next').css('visibility','hidden');
		}
	},

	transaktion : function()
	{
		if ($('.transaktionen').html())
		{
			$('.transaktionen .liste .item').bind('mouseover',function(){jtransaktion.over($(this))});
			$('.transaktionen .liste .item').bind('mouseout',function(){jtransaktion.out($(this))});
			$('.transaktionen .liste .item').bind('click',function(){jtransaktion.click($(this))});
			$('.transaktionen .liste .item .info .id').bind('click',function(){jtransaktion.close($(this))});
			$('.transaktionen select').bind('change',function(){jtransaktion.change($(this))});
			$('.transaktionen select').width($('.transaktionen select').width()+5);
		}
		if ($('.transaktionen_startseite').html())
		{
			$('.transaktionen_startseite .item').bind('mouseover',function(){jtransaktion.over($(this))});
			$('.transaktionen_startseite .item').bind('mouseout',function(){jtransaktion.out($(this))});
		}
	},

	transaktion_modul : function()
	{
		if ($('.transaktionen_modul').html())
		{
			$('.transaktionen_modul .b .item').bind('mouseover',function(){jtransaktion.over($(this))});
			$('.transaktionen_modul .b .item').bind('mouseout',function(){jtransaktion.out($(this))});
			$('.transaktionen_modul .b .item').bind('click',function(){jtransaktion.click($(this))});
			$('.transaktionen_modul .b .item .info .id').bind('click',function(){jtransaktion.close($(this))});
		}
	},

	presse_news : function()
	{
		if ($('.presse_news').html())
		{
			$('.presse_news select').bind('change',function(){jpresse.change($(this))});
			$('.presse_news select').width($('.jpresse select').width()+5);

			for (key in $('.presse_news .liste .item .b'))
			if ((obj=$('.presse_news .liste .item .b')[key])&&obj.nodeType == 1)
			{
				obj=$(obj);
				if (obj.find('.bc').html())
				{
					obj.find('.ba').html('<span>'+obj.find('.ba').html()+'</div>');
					obj.find('.ba span').bind('click',obj.find('.bc').attr('onclick'));
				}
			}

		}
	},

	menu : function()
	{
		if ($('.mainmenu').html())
		{
			$('.mainmenu').bind('mouseover',function(){jmenu.menuover_main($(this))});
			$('.mainmenu').bind('mouseout',function(){jmenu.menuout_main($(this))});
			$('.mainmenu .item a').bind('mouseover',function(){jmenu.menuover($(this))});
			$('.mainmenu .item a').bind('mouseout',function(){jmenu.menuout($(this))});
			$('.mainmenu .submenu_line').bind('mouseover',function(){jmenu.holdmenu($(this))});
			$('.mainmenu .submenu_line').bind('mouseout',function(){jmenu.menuout($(this))});
			$('#submenu').bind('mouseout',function(){jmenu.menuout($(this))});
			$('#submenu').bind('mouseover',function(){jmenu.holdmenu($(this))});
			$('.content').bind('mouseover',function(){jmenu.menuout($(this))});
		}
	},

	contentmenu : function()
	{
		if ($('.contentmenu .item').html())
		{
			$('.contentmenu .item').bind('mouseover',function(){jcontentmenu.over($(this))});
			$('.contentmenu .item').bind('mouseout',function(){jcontentmenu.out($(this))});
			$('.contentmenu .item').bind('click',function(){return jcontentmenu.click($(this))});
		}
	},

	footer : function()
	{
		if (footerheight=$('.footer').height())
		{
			$('.footer .altmenu .item').height(footerheight);
			$('.footer .footermenu').height(footerheight);
		}
	},

	checksubmenu : function()
	{
		if (jmenu.openMenu=$('#submenu').html())
		{
			$('#submenu').css('display','block');
			$('.mainmenu .submenu_line').css('display','block');
		}
	},

	setmenuwidth : function()
	{
		if (menulist=$('.mainmenu .menu').children())
		{
			width=0;
			num=0;
			for(key in menulist)
				if (menulist[key].nodeType == 1&&$(menulist[key]).attr('class')!='end')
				{
					num++;
					width+=$(menulist[key]).width();
				}

			allwidth=$('.mainmenu .menu').width()-width;
			onewidth=Math.round((allwidth/num)/2);

			for(key in menulist)
				if (menulist[key].nodeType == 1&&$(menulist[key]).attr('class')!='end')
				{
					if (key!=0)
						$(menulist[key]).css('margin-left',onewidth+'px');
					$(menulist[key]).css('padding-left',onewidth+'px');
				}
		}
	}
}

$(document).ready(function()
{
	jload.load();
});



var jvideo = {
		videobind : function(id)
		{
			$("a[rel^='video"+id+"']").prettyPhoto({
				theme:'light_square',
				iframe_markup: '<iframe src="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
				social_tools: false,
				opacity: 0.70,
				horizontal_padding: 20
			});
		}
	}

/*
$(document).ready(function() {
	if ($("a[rel^='video']").length > 0) {
		jvideo.videobind();
	}
});
*/



