var mouseCoord = {x:0, y:0};
document.onmousemove = function(ev) {
        if (ev) { // FF
                mouseCoord.x = ev.pageX;
                mouseCoord.y = ev.pageY;
        } else if (event) { // IE6 & IE7
                mouseCoord.x = event.clientX;
                mouseCoord.y = event.clientY;
        }
        return false;
};


function toggleModelnumberSearch(artikelmodellnummer1) {
	$("#"+artikelmodellnummer1).toggle();
	hideBubble();
}

var doShowBubble = false;
function showBubble(div,color) {
	doShowBubble = true;
	window.setTimeout(function(){
		showShowBubble(div,color)
	},500);
}
function showShowBubble(div,color) {
	if (doShowBubble) {
		$("#bubblewrapper").css("top",$(div).offset().top-90);
		$("#bubblewrapper").css("left",mouseCoord.x+10);
		$("#bubblewrapper").show();
		$("#bubble .bubblerot").hide();
		$("#bubble .bubblegruen").hide();
		$("#bubble .bubbleblau").hide();
		$("#bubble .bubble"+color).show();
	}
}
function hideBubble() {
	doShowBubble = false;
	window.setTimeout("hideHideBubble()",100);
}
function hideHideBubble() {
	if (!doShowBubble) {
		$("#bubblewrapper").hide();
		$("#bubble .bubblerot").hide();
		$("#bubble .bubblegruen").hide();
		$("#bubble .bubbleblau").hide();
	}
}

function toggleRegisterTab(nr) {
	$("#register1").hide();
	$("#registertab1").removeClass("aktiv");
	$("#register2").hide();
	$("#registertab2").removeClass("aktiv");
	$("#register"+nr).show();
	$("#registertab"+nr).addClass("aktiv");
}

var actImage = 1;
var imageCounter = 0;
function loadImage(imageNr, srcBase) {
	$("#zubehoerdetail .flash").hide();
	$("#zubehoerdetail .imagegross").show();
	if ($("#image"+imageNr+"link").length>0) {
		$(".blaettern a").each(function(i){
			$("#image"+(i+1)+"link").removeClass("aktiv");
			imageCounter = i;
		});
		$("#image"+imageNr+"link").addClass("aktiv");
		$("#wechselbild").attr("src",eval("image"+imageNr+"Src"));
		actImage = imageNr;
		$("#blaetternlinks").attr("src",srcBase+"/blaettern_links_act.gif");
		$("#blaetternrechts").attr("src",srcBase+"/blaettern_rechts_act.gif");
	}
	if (imageNr<=1) {
		$("#blaetternlinks").attr("src",srcBase+"/blaettern_links_pas.gif")
	} else if (imageNr>=imageCounter-2) {
		$("#blaetternrechts").attr("src",srcBase+"/blaettern_rechts_pas.gif")
	}
}
function showFlash() {
	$("#zubehoerdetail .imagegross").hide();
	$("#zubehoerdetail .flash").show();
}
function hideFlash() {
	$("#zubehoerdetail .flash").hide();
	$("#zubehoerdetail .imagegross").show();
}

/*modelnumber assistant call. all other functions are defined within the fnhelper project itself.*/
function showAssitant() {
	var height = 0;
	if (window.innerHeight) {
		height = window.innerHeight;
	} else if (document.body && document.body.clientHeight) {
		height = document.body.clientHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		height = document.documentElement.clientHeight;
	}
	var scrollTop = 0;
	if (window.pageYOffset) {
		scrollTop = window.pageYOffset;
	} else if (document.body && document.body.scrollTop) {
		scrollTop = document.body.scrollTop;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		scrollTop = document.documentElement.scrollTop;
	}
	
	$("select").hide();
	$("#modellnummerassistenttransparent").height($(document).height());
	$("#modellnummerassistent").css("left",($(document).width()-725)/2);
	$("#modellnummerassistent").css("top",(height-500)/2+scrollTop);
	$("#modellnummerassistenttransparent").show();
	/*$.ajax({
		type: "GET",
		url: "modellnummerassistent.html",
		success: function(msg){
			$("#modellnummerassistent").html(msg);
		}
	})*/

	$("#modellnummerassistent").show();
}
function hideAssitant() {
	$("select").show();
	$("#modellnummerassistent").hide();
	$("#modellnummerassistenttransparent").hide();
}
