var swapImageSrc = "";
function swapImage(caller, src){
	swapImageSrc = src;
	swapImageFunc(caller,src);
}
function swapImageFunc(caller, src){
	caller.src = src;
}


//functions for the overlay window

	function onEndClip(){
		closeOverlay();	
	}
	function closeOverlay(){
		$("#ScreenOverlay").hide();
	}

var popup = null;


/* popup funktions */
function ShowPopup(url,param){
	if(popup != null){
		popup.close();
	}
	popup  = window.open(url,"_blank",param);
	popup.moveTo(100, 100);
	popup.document.bgColor = "#FFFFFF";
	popup.focus();
}



function OpenCalculator(lang){
	ShowPopup('http://www.be-quiet.net/calculator.php?websiteLang='+lang,'width=830,height=600,dependent=yes,resizable=yes,location=no,status=no,toolbar=no,scrollbars=yes');
}
function OpenTipSelector(lang){
	ShowPopup('http://www.be-quiet.net/be-quiet.net/index.php?StoryID=592&websiteLang='+lang,'width=645,height=480,dependent=no,resizable=no,location=no,status=no,toolbar=no,scrollbars=no');
}
function Show360(productno){
	ShowPopup('./data/media/_pms/new/'+productno.toLowerCase()+'/360/start.html','width=402,height=285,dependent=yes,resizable=no,location=no,status=no,toolbar=no');
}
function openImagePopup(img_src, img_width, img_height) 
{ 
  img_width = parseInt(img_width) + 20; 
  img_height = parseInt(img_height) + 20; 
  ShowPopup(img_src, 'width=' + img_width + ',height=' + img_height + ',toolbar=no,statusbar=no,scrollbars=no,menubar=no'); 
}




function switchContent(blockid)
{
	$("#content_navi .link > *").removeClass();
	$("#content_navi .link > *").addClass("menue base");
	
	$("#t_"+blockid).addClass("menue selected");
	
	$("#all-content  > *").css("visibility", "hidden");
	$("#all-content  > *").css("display", "none");
	
	$("#"+blockid).css("visibility", "visible");
	$("#"+blockid).css("display", "block");
}

function ShowSubMenu(id)
{
	$('.submenu').hide();
	$("#g_"+id).show("slow");
	
	$('.menulink > .childlink a').removeClass();
	$('.menulink > .childlink a').addClass("menue base");
	
	$("#t_"+id).addClass("menue selected");

}
function ShowMenu(id)
{
	$('.menulink').hide(); 
	$('#m_'+id).show('slow');
}

/* function for the search field */
$(document).ready(function(){
	$("#search").val("");
	$("#search").blur(function(){
			if($(this).val().length == 0){
				$(this).addClass("empty").removeClass("focus");
			}		
			else{
				$("#SearchDoc").submit();
			}
	});	
	$("#search").focus(function(){
		$(this).removeClass("empty").addClass("focus");			
	});	
	$("#search").mousedown(function(){
		$(this).removeClass("empty");			
	});
});

$.fn.cycle.defaults.speed   = 900;
$.fn.cycle.defaults.timeout = 6000;

$('#fade').cycle({ 
    fx:    'fade', 
    speed:  1500 
 });