/*rounded*/
;(function(jQuery){var expr=(function(){if(!jQuery.browser.msie)return false;var div=document.createElement('div');try{div.style.setExpression('width','0+0');}catch(e){return false;}return true;})();function sz(el,p){return parseInt(jQuery.css(el,p))||0;};function hex2(s){var s=parseInt(s).toString(16);return(s.length<2)?'0'+s:s;};function gpc(node){for(;node&&node.nodeName.toLowerCase()!='html';node=node.parentNode){var v=jQuery.css(node,'backgroundColor');if(v=='rgba(0, 0, 0, 0)')continue;if(v.indexOf('rgb')>=0){var rgb=v.match(/\d+/g);return'#'+hex2(rgb[0])+hex2(rgb[1])+hex2(rgb[2]);}if(v&&v!='transparent')return v;}return'#ffffff';};function getWidth(fx,i,width){switch(fx){case'round':return Math.round(width*(1-Math.cos(Math.asin(i/width))));case'cool':return Math.round(width*(1+Math.cos(Math.asin(i/width))));case'sharp':return Math.round(width*(1-Math.cos(Math.acos(i/width))));case'bite':return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));case'slide':return Math.round(width*(Math.atan2(i,width/i)));case'jut':return Math.round(width*(Math.atan2(width,(width-i-1))));case'curl':return Math.round(width*(Math.atan(i)));case'tear':return Math.round(width*(Math.cos(i)));case'wicked':return Math.round(width*(Math.tan(i)));case'long':return Math.round(width*(Math.sqrt(i)));case'sculpt':return Math.round(width*(Math.log((width-i-1),width)));case'dog':return(i&1)?(i+1):width;case'dog2':return(i&2)?(i+1):width;case'dog3':return(i&3)?(i+1):width;case'fray':return(i%2)*width;case'notch':return width;case'bevel':return i+1;}};jQuery.fn.rounded=function(o){if(this.length==0){if(!jQuery.isReady&&this.selector){var s=this.selector,c=this.context;jQuery(function(){jQuery(s,c).rounded(o);});}return this;}o=(o||"").toLowerCase();var keep=/keep/.test(o);var cc=((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);var sc=((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);var width=parseInt((o.match(/(\d+)px/)||[])[1])||10;var re=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;var fx=((o.match(re)||['round'])[0]);var edges={T:0,B:1};var opts={TL:/top|tl/.test(o),TR:/top|tr/.test(o),BL:/bottom|bl/.test(o),BR:/bottom|br/.test(o)};if(!opts.TL&&!opts.TR&&!opts.BL&&!opts.BR)opts={TL:1,TR:1,BL:1,BR:1};var strip=document.createElement('div');strip.style.overflow='hidden';strip.style.height='1px';strip.style.backgroundColor=sc||'transparent';strip.style.borderStyle='solid';return this.each(function(index){var pad={T:parseInt(jQuery.css(this,'paddingTop'))||0,R:parseInt(jQuery.css(this,'paddingRight'))||0,B:parseInt(jQuery.css(this,'paddingBottom'))||0,L:parseInt(jQuery.css(this,'paddingLeft'))||0};if(typeof this.style.zoom!=undefined)this.style.zoom=1;if(!keep)this.style.border='none';strip.style.borderColor=cc||gpc(this.parentNode);var cssHeight=jQuery.curCSS(this,'height');for(var j in edges){var bot=edges[j];if((bot&&(opts.BL||opts.BR))||(!bot&&(opts.TL||opts.TR))){strip.style.borderStyle='none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');var d=document.createElement('div');jQuery(d).addClass('jquery-rounded');var ds=d.style;bot?this.appendChild(d):this.insertBefore(d,this.firstChild);if(bot&&cssHeight!='auto'){if(jQuery.css(this,'position')=='static')this.style.position='relative';ds.position='absolute';ds.bottom=ds.left=ds.padding=ds.margin='0';if(expr)ds.setExpression('width','this.parentNode.offsetWidth');else
ds.width='100%';}else if(!bot&&jQuery.browser.msie){if(jQuery.css(this,'position')=='static')this.style.position='relative';ds.position='absolute';ds.top=ds.left=ds.right=ds.padding=ds.margin='0';if(expr){var bw=sz(this,'borderLeftWidth')+sz(this,'borderRightWidth');ds.setExpression('width','this.parentNode.offsetWidth - '+bw+'+ "px"');}else
ds.width='100%';}else{ds.margin=!bot?'-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px':(pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';}for(var i=0;i<width;i++){var w=Math.max(0,getWidth(fx,i,width));var e=strip.cloneNode(false);e.style.borderWidth='0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';bot?d.appendChild(e):d.insertBefore(e,d.firstChild);}}}});};jQuery.fn.unrounded=function(){jQuery('div.jquery-rounded',this).remove();return this;};})(jQuery);
/*flash*/
(function(){var e=typeof jQuery=="function";function i(){if(c.done){return false}var k=document;if(k&&k.getElementsByTagName&&k.getElementById&&k.body){clearInterval(c.timer);c.timer=null;for(var j=0;j<c.ready.length;j++){c.ready[j].call()}c.ready=null;c.done=true}}var c=e?jQuery:function(j){if(c.done){return j()}if(c.timer){c.ready.push(j)}else{c.ready=[j];c.timer=setInterval(i,13)}};function f(k,j){if(j){for(key in j){if(j.hasOwnProperty(key)){k[key]=j[key]}}}return k}function g(j){switch(h(j)){case"string":j=j.replace(new RegExp('(["\\\\])',"g"),"\\$1");j=j.replace(/^\s?(\d+)%/,"$1pct");return'"'+j+'"';case"array":return"["+b(j,function(m){return g(m)}).join(",")+"]";case"function":return'"function()"';case"object":var k=[];for(var l in j){if(j.hasOwnProperty(l)){k.push('"'+l+'":'+g(j[l]))}}return"{"+k.join(",")+"}"}return String(j).replace(/\s/g," ").replace(/\'/g,'"')}function h(k){if(k===null||k===undefined){return false}var j=typeof k;return(j=="object"&&k.push)?"array":j}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function b(j,m){var l=[];for(var k in j){if(j.hasOwnProperty(k)){l[k]=m(j[k])}}return l}function a(q,s){var o=f({},q);var r=document.all;var m='<object width="'+o.width+'" height="'+o.height+'"';if(r&&!o.id){o.id="_"+(""+Math.random()).substring(9)}if(o.id){m+=' id="'+o.id+'"'}o.src+=((o.src.indexOf("?")!=-1?"&":"?")+Math.random());if(o.w3c||!r){m+=' data="'+o.src+'" type="application/x-shockwave-flash"'}else{m+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}m+=">";if(o.w3c||r){m+='<param name="movie" value="'+o.src+'" />'}o.width=o.height=o.id=o.w3c=o.src=null;for(var j in o){if(o[j]!==null){m+='<param name="'+j+'" value="'+o[j]+'" />'}}var n="";if(s){for(var l in s){if(s[l]!==null){n+=l+"="+(typeof s[l]=="object"?g(s[l]):s[l])+"&"}}n=n.substring(0,n.length-1);m+='<param name="flashvars" value=\''+n+"' />"}m+="</object>";return m}function d(l,o,k){var j=flashembed.getVersion();f(this,{getContainer:function(){return l},getConf:function(){return o},getVersion:function(){return j},getFlashvars:function(){return k},getApi:function(){return l.firstChild},getHTML:function(){return a(o,k)}});var p=o.version;var q=o.expressInstall;var n=!p||flashembed.isSupported(p);if(n){o.onFail=o.version=o.expressInstall=null;l.innerHTML=a(o,k)}else{if(p&&q&&flashembed.isSupported([6,65])){f(o,{src:q});k={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title};l.innerHTML=a(o,k)}else{if(l.innerHTML.replace(/\s/g,"")!==""){}else{l.innerHTML="<h2>Flash version "+p+" or greater is required</h2><h3>"+(j[0]>0?"Your version is "+j:"You have no flash plugin installed")+"</h3>"+(l.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='http://www.adobe.com/go/getflashplayer'>here</a></p>");if(l.tagName=="A"){l.onclick=function(){location.href="http://www.adobe.com/go/getflashplayer"}}}}}if(!n&&o.onFail){var m=o.onFail.call(this);if(typeof m=="string"){l.innerHTML=m}}if(document.all){window[o.id]=document.getElementById(o.id)}}window.flashembed=function(k,l,j){if(typeof k=="string"){var m=document.getElementById(k);if(m){k=m}else{c(function(){flashembed(k,l,j)});return}}if(!k){return}var n={width:"100%",height:"100%",allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:null,onFail:null,expressInstall:null,w3c:false};if(typeof l=="string"){l={src:l}}f(n,l);return new d(k,n,j)};f(window.flashembed,{getVersion:function(){var l=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var k=navigator.plugins["Shockwave Flash"].description;if(typeof k!="undefined"){k=k.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var m=parseInt(k.replace(/^(.*)\..*$/,"$1"),10);var q=/r/.test(k)?parseInt(k.replace(/^.*r(.*)$/,"$1"),10):0;l=[m,q]}}else{if(window.ActiveXObject){try{var o=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(p){try{o=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");l=[6,0];o.AllowScriptAccess="always"}catch(j){if(l[0]==6){return l}}try{o=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(n){}}if(typeof o=="object"){k=o.GetVariable("$version");if(typeof k!="undefined"){k=k.replace(/^\S+\s+(.*)$/,"$1").split(",");l=[parseInt(k[0],10),parseInt(k[2],10)]}}}}return l},isSupported:function(j){var l=flashembed.getVersion();var k=(l[0]>j[0])||(l[0]==j[0]&&l[1]>=j[1]);return k},domReady:c,asString:g,getHTML:a});if(e){jQuery.tools=jQuery.tools||{version:{}};jQuery.tools.version.flashembed="1.0.3";jQuery.fn.flashembed=function(k,j){var l=null;this.each(function(){l=flashembed(this,k,j)});return k.api===false?this:l}}})();

function openwindow(url) {
	var theWindow_popup = window.open(url,'popup','width=670,height=710,status=0,menubar=0,resizable=yes, scrollbars=yes');
	if (theWindow_popup){
		theWindow_popup.focus();
	}
	return false;
}

/*jQuery*/
jQuery(function (){
	var amenu_news = jQuery('#amenu_news');
	var amenu_news_parent = jQuery(amenu_news).parent('#news_archiv');
	if (amenu_news.length && amenu_news_parent.length == 0){ // 
		jQuery('#archivList_news').before(amenu_news);
	}
	
	var corner1 = jQuery('.corner_ul_archiv','#col3_content'),
	corner2 = jQuery('.archiv_inactiv,.archiv_activ','#col3_content');
	if(jQuery.browser.msie){
		corner1.rounded('10px').css('width','470px');
		corner2.rounded('8px');
	}
	if (jQuery('#markenkarussell').length) {
		flashembed(
			'markenkarussell', 
			{src:'http://www.servicebund.de/fileadmin/swf/markenkarussell/markenkarussell.swf',wmode:'opaque',width:'515',height:'70'}
		);
	}
	if (jQuery.browser.msie && jQuery.browser.version.substr(0,3)=="6.0"){
		jQuery("#vnavmenu li").hover(
			function() {
				jQuery(this).addClass("iehover");//.css({'border':'1px solid blue'});
			},
			function() {
				jQuery(this).removeClass("iehover");//.css({'border':'0'});
			}
		);
	}
	jQuery("#vnavmenu li.hassub").hover(
			function() {
				jQuery(this).children('a').addClass("jsHover");
			},
			function() {
				jQuery(this).children('a').removeClass("jsHover");
			}
	);
	
	var url = window.location.href;
	var service_box = jQuery('#box_container');
	
	if (service_box.length){
		var box_over_objs = jQuery(service_box).children('div.box_item');
		var duration = 350;
		var thisheight = 110;
		var newelem;
		var oldelem;
		
		jQuery(box_over_objs).each(function(i){
			var ob = this;
			jQuery(ob).mouseenter(function(){
				newelem = jQuery(ob).children('div.box_item_image');
				oldelem = jQuery(service_box).children('div.box_item').children('div.active');
		        var i = setInterval(function(){
		        	doHover(newelem,oldelem,thisheight, duration);
		            clearInterval(i);
		        }, duration);
			}, function(){
		        clearInterval(i);
		    });
		});
	}
	jQuery('div.mH').click(function(){
		var help_msg = jQuery(this).parent().next('span.mHT').html();
		e_box = showErrorMsg(help_msg,160);
		showDialogBox(e_box,'Hinweis');
		jQuery(e_box).show();
		return false;
	});
	jQuery('div.code_submit input').click(function(){
		var input_value = jQuery('input#magazine_code_input').val();
		var i_v_l = input_value.length;
		if (i_v_l > 6 || i_v_l < 1){
			e_box = showErrorMsg('Magazincode muss zwischen 1 und 6 Zeichen enthalten.','',160);
			showDialogBox(e_box,'Fehler');
			jQuery(e_box).show();
			return false;
		} else {
			 var answer = jQuery.ajax({
				  url: url,
				  data: {eID: 'aj',magazinecode: input_value},
				  async: false
			}).responseText;
			 
			if (answer == '-1'){
				e_box = showErrorMsg('Magazincode existiert nicht.','',155);
				showDialogBox(e_box,'Hinweis');
				jQuery(e_box).show();
				return false;
			} else {
				return true;
			}
		}
	});
	//forms error marker
	var error_container = jQuery('div.error_container');
	if (error_container.length){
		var ul_error = jQuery(error_container).children('ul.errors');
		var form_table = jQuery(error_container).next().children('table.formTable');
		var temp_header = '';
		jQuery.each(jQuery(ul_error).children(), function(i, n){
			var s_str = jQuery(n).html();
			jQuery(form_table).find('label[for*="' + s_str + '"]').css({'color':'red'});
			if (s_str === 'Email'){
				var error_header = jQuery(error_container).children('span.error_header');
				jQuery(error_header).html(jQuery(error_header).html() + ' | E-Mail Adresse ist ungültig');
			}
		});
	}
	
	var login_form = jQuery('form.tx-newloginbox-pi1-form'),
	newsletterinput = jQuery('input.newsletterinput'),
	newsletterinputhtml = jQuery(newsletterinput).val();
	jQuery(newsletterinput).focus(function(){jQuery(this).val('');});
	jQuery(newsletterinput).blur(function(){
		if (jQuery(this).val().length === 0) {
			jQuery(this).attr('value',newsletterinputhtml);
		}
	});
	
	if (login_form.length){
		var label_un = jQuery(login_form).find('label.username');
		var label_pwd = jQuery(login_form).find('label.password');
		var input_un = jQuery(login_form).find('input[name="user"]');
		var input_pwd = jQuery(login_form).find('input[name="pass"]');
		label_un.hide();
		label_pwd.hide();
		input_un.addClass('userBG');
		input_pwd.addClass('pwdBG');
		jQuery(input_un).focus(function(){jQuery(this).removeClass('userBG');});
		jQuery(input_pwd).focus(function(){jQuery(this).removeClass('pwdBG');});
		jQuery(input_un).blur(function(){
			if(jQuery(this).val().length === 0) {
				jQuery(this).addClass('userBG');
			}
		});
		jQuery(input_pwd).blur(function(){
			if(jQuery(this).val().length === 0) {
				jQuery(this).addClass('pwdBG');
			}
		});
	}
});

function doHover(newelem, oldelem, thisheight, duration){
	if (!newelem.is(':visible') && !oldelem.is(':animated')){
		jQuery(newelem).animate(
			{height: thisheight},
			{step: function(n, fx){
				newelem.height(thisheight - n);
			},
			duration: duration
		});
		jQuery(oldelem).animate(
			{height: 'hide'},
			{step: function(n, fx){
				newelem.height(thisheight - n);
			},
			duration: duration
		});
		 // switch classes for headers
		oldelem.addClass('inactive').removeClass('active');
		newelem.addClass('active').removeClass('inactive');
	}
}

function showErrorMsg(msg){
	var error_box = jQuery("#errorBox");
	var error_msg = jQuery("#errorMsg");
	jQuery(error_msg).html(msg);
	return error_box;
}

function showDialogBox(msg,title,height){
	var dialog_box = jQuery("#dialog");
	jQuery(dialog_box).dialog('destroy');
	jQuery(dialog_box).attr('title',title);
	jQuery(dialog_box).html(msg);
	jQuery(dialog_box).dialog({
		bgiframe: true,
		height: height,
		modal: true,
		resizable: false,
		buttons: {
			Ok: function() {
				jQuery(this).dialog('close');
			}
		}
	});
}