/**
 * jQuery Default Value Plugin v1.0
 * Progressive enhancement technique for inital input field values
 *
 * The MIT License
 * 
 * Copyright (c) 2007 Paul Campbell (pauljamescampbell.co.uk)
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * @param		String
 * @return		Array
 */
function setColorForBasket (itemID,color) {
	$("#gelb").removeClass("button-activ");
	$("#beige").removeClass("button-activ");
	$("#rot").removeClass("button-activ");
	$("#kirsche").removeClass("button-activ");
	$("#blau").removeClass("button-activ");
	$("#silber").removeClass("button-activ");
	$("#schokolade").removeClass("button-activ");
	$("#schwarz").removeClass("button-activ");
	$("#"+color).addClass("button-activ");
	document.getElementById("buytop").value = itemID;
	

}
(function($){$.fn.defaultvalue=function(){var d=this;var e=arguments;var c=0;return(d.each(function(){var a=$(this);var b=e[c++];if($.trim(a.val())==""){a.val(b).addClass("inputDimmer")}a.focus(function(){if(a.val()==b){a.val("").removeClass("inputDimmer")}a.blur(function(){if(a.val()==""){a.val(b).addClass("inputDimmer")}})})}))}})(jQuery)
//use from here the next one, above ist under free license
function formSubmit(a){var b=a;while(b&&b.tagName.toLowerCase()!="form"){b=b.parentNode}if(b){b.submit()}}

function ask(question,url){if(confirm(question)){document.location.href=url}}

function toggleCod(show) {
	/*
	$("#paymentInfo").find("div").each(function(i) {
		$(this).hide();
	});
	*/
	if(!show){$("div#pl_nn").hide();$("div#payinfo_nn").removeAttr("style")}else{$("div#pl_nn").show()}
}

$(document).ready(function(){
	// Funktion für "Zurück"-Buttons/-Links
	$("button.btnBack, a.btnBack").click(function(e) {
		history.back();
		e.preventDefault();
	});
	
	$("a#closeMessageBoxLink").click(function(){$("div#messageBox").hide();return false});
	$("#searchInput").defaultvalue("Suchbegriffe");
	
	
	$("div.options a").click(function() {
		$("div.contentNaviRider > div.active").removeClass("active")
		$("div.panes div.active").removeClass("active");
		$("div.panes > div:first").hide();
		$("div.panes > div:second").hide();
		$("div.panes > div:last").show();
		$("div.contentNaviRider > div:last").addClass("active")
	});
	
	
	//$("div.panes > div:visible").hide();
	
	
	$("ul.tabs").tabs("div.panes > div");
	
	
	
	
	
	if($("div.contentNaviRider > div.active").size()==0){$("div.panes > div:first").show();$("div.contentNaviRider > div:first").addClass("active")}else{var counter=0;$("div.contentNaviRider > div").each(function(){if($(this).hasClass("active")){$("div.panes > div:eq("+counter+")").show();return false}counter++})}
	$("div.contentNaviRider > div").click(function(){if(this.id=="pressreport"){$("div.article:hidden, div.spacer:hidden").show();$("div.report:visible").hide()}var index=$("div.contentNaviRider > div").index(this);$("div.panes > div:visible").hide();$("div.panes > div:eq("+index+")").show();$("div.contentNaviRider > div.active").removeClass("active");$(this).addClass("active")});

	/* fill out (content-width) the Navigation-Tabs */
	var padding=17;var maxWidth=$("div.contentNaviRider").width()-1;var cumSum=0;
	$("div.contentNaviRider > * > div.riderContent").each(function(){ cumSum+= $(this).width() + padding; });
	$("div.contentNaviRider > * > div.riderContent").each(function(){var selfWidth=$(this).width()+padding;$(this).width(Math.round(selfWidth/cumSum*maxWidth-padding))});

	/* is there is an anker registered, jump to tab & Content */
	if (window.location.hash) {
		var jumpMarks=window.location.hash;
		var counter=0;
		$(".contentNaviRider a").each(function(){
			var linkName=this.href;
			if (linkName.substring(linkName.length - jumpMarks.length) == jumpMarks) { return false; }
			counter++;
		})
		if (counter+1 <= $(".contentNaviRider a").size() ) {
			/* make selected rider visible */
			$("div.contentNaviRider > div.active").removeClass("active"); $("div.contentNaviRider > div:eq("+counter+")").addClass("active");
			/* make selected content visible */
			$("div.panes > div:visible").hide(); $("div.panes > div:eq("+counter+")").show();
		}
	}
});
function swapstarimg(count) {
	var maxStars = 5;
	var filename = '';
	var filePathOn = '/pix/icn_orange_star.gif';
	var filePathOff = '/pix/icn_grey_star.gif';
	var i = 1;
	var itemName = ""; 
	var submittedStars = document.getElementById('submittedStars');
	submittedStars.value = count;
	for(i = 1;i <= maxStars;i++)
	{
		var itemName = i+"-star"; 

		if(i <= count)
		{
			document.images[itemName].src = filePathOn;
		}
		else
		{ 
			document.images[itemName].src = filePathOff;
		}            
	}	
}

function togglerightmenu(){aTmp=new Array();bTmp=new Array();cTmp=new Array();cookieData=new Array();if(document.cookie){aTmp=document.cookie.split(" ");for(i=0;i<aTmp.length;i++){bTmp=aTmp[i].split("\=");for(j=0;j<bTmp.length;j++){cTmp=bTmp[j].split(",");cookieData[cTmp[0]]=bTmp[1]}}if(cookieData["menuStatus"]=='false'||!cookieData["menuStatus"]){$.ajax({type:"POST",url:"setNavi.go",data:"menu=0",success:function(msg){document.cookie="menuStatus=true;path=/";$("#personalNavigation").hide()}});return true}else{$.ajax({type:"POST",url:"setNavi.go",data:"menu=1",success:function(msg){document.cookie="menuStatus=false;path=/";$("#personalNavigation").show()}});return false}}else{$("#berletNavigator").show();return false}}
function swapnavimg(name){var filename='';var filePath='/pix/';var bStatus;bStatus=togglerightmenu();if(bStatus==false){filename='icn_moveout.gif'}else{filename='icn_movedown.gif'}filePath=filePath+filename;document.images[name].src=filePath}
function mailxrebuild(mailtext){var front="";var back="";for(var x=0;x<=mailtext.length;x++){if(x%2==0){front=front+mailtext.charAt(x)}else{back=mailtext.charAt(x)+back}}var complete_text=front+back;document.write(complete_text)}