 // ajax
$(document).ready(function() {
// 	info_box_top=parseInt($("#info_box").css("top"));
// 	alert(info_box_top);
	akt_wkshort();
});
function put_wk(id) {
	$("#wizard").fadeTo(1,0.1);
	$("#info_box").show().html("<p><h2>Daten werden geladen...</h2><br /><br /><img src='../images/bildlayer/loader.gif' width='208' height='13'></p>");
	//var gposy=window.pageYOffset;
	var gposy=0;
	var gposx=0;
	if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		gposy = document.body.scrollTop;
		gposx = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	// Fucking IE
		gposy = document.documentElement.scrollTop;
		gposx = document.documentElement.scrollLeft;
	}
	//var ypos=eval(gposy+info_box_top);
	ypos=ypos+"px";
	debug(ypos);
	$("#info_box").css("top",ypos);
	id=escape(id);
	$.ajax({
		type: "POST",
		url: "../ajax/put_wk.php",
		data: "id="+id
			,
		success: function(msg){
			$("#info_box").show().html(msg);
			$("#wizard").fadeTo(1,1.0);
			akt_wkshort();
			setTimeout("info_box()",5000);
		}
	});
}
function akt_wkshort() {
	if (document.cookie) {
		var c=document.cookie;
		c.match(/SesID=([0-9a-zA-Z]+)/g);
		c = RegExp.$1;
	}
	$("#wk_short").html("<p><h2>Daten werden geladen...</h2><br /><br /><img src='../images/bildlayer/loader.gif' width='208' height='13'></p>");
	$.ajax({
		type: "POST",
		url: "../ajax/wkshort.php",
		data: "mynick="+c
			,
		success: function(msg,textStatus){
			$("#wk_short").html(msg);
		}
	});
}

function show_detail(quelle,id,artbez) {
	savedpage=$("#wizard").html();
	gposy=0;
	gposx=0;
	if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		gposy = document.body.scrollTop;
		gposx = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	// Fucking IE
		gposy = document.documentElement.scrollTop;
		gposx = document.documentElement.scrollLeft;
	}
	$("#wizard").html("<p><h2>Daten werden geladen...</h2><br /><br /><img src='../images/bildlayer/loader.gif' width='208' height='13'></p>");
	$.ajax({
		type: "POST",
		url: "../ajax/detail.php",
		data: "id="+id
			+"&quelle="+quelle
			+"&artbez="+artbez
			,
		success: function(msg){
			$("#wizard").html(msg);
			scrollTo(0,0);
		}
	});
}
function print_savedpage() {
	$("#wizard").html(savedpage);
	scrollTo(gposx,gposy);
}

function get_wizard(id,wert,hersteller,modell,wizard) {
	$("#wizard").html("<p><h2>Daten werden geladen...</h2><br /><br /><img src='../images/bildlayer/loader.gif' width='208' height='13'></p>");
	id=escape(id);
	wert=escape(wert);
	if (wizard=="geraet") {
		var myurl="../ajax/gwizard.php";
	} else if (wizard=="fahrzeug") {
		var myurl="../ajax/fwizard.php";
	}
	if (wizard=="geraet" || wizard=="fahrzeug") {
		$.ajax({
			type: "POST",
			url: myurl,
			data: "id="+id
				+"&wert="+wert
				+"&hersteller="+hersteller
				+"&modell="+modell
				,
			success: function(msg){
				$("#wizard").html(msg);
			}
		});
	} else {
		debug(wizard);
	}
}

function get_gwizard(id,wert,hersteller,modell) {
	$("#wizard").html("<p><h2>Daten werden geladen...</h2><br /><br /><img src='../images/bildlayer/loader.gif' width='208' height='13'></p>");
	id=escape(id);
	wert=escape(wert);
	$.ajax({
		type: "POST",
		url: "../ajax/gwizard.php",
		data: "id="+id
			+"&wert="+wert
			+"&hersteller="+hersteller
			+"&modell="+modell
			,
		success: function(msg){
			$("#wizard").html(msg);
		}
	});
}

function get_fwizard(id,wert,hersteller,modell) {
	$("#wizard").html("<p><h2>Daten werden geladen...</h2><br /><br /><img src='../images/bildlayer/loader.gif' width='208' height='13'></p>");
// 	wert=escape(wert);
	$("#dfeld").html("wizard");
	$.ajax({
		type: "POST",
		url: "../ajax/fwizard.php",
		data: "id="+id
			+"&wert="+wert
			+"&hersteller="+hersteller
			+"&modell="+modell
			,
		success: function(msg){
			$("#wizard").html(msg);
		}
	});
}

function get_swizard(id,wert) {
	$("#wizard").html("<p><h2>Daten werden geladen...</h2><br /><br /><img src='../images/bildlayer/loader.gif' width='208' height='13'></p>");
	id=escape(id);
	wert=escape(wert);
	$.ajax({
		type: "POST",
		url: "../ajax/swizard.php",
		data: "id="+id
			+"&wert="+wert
			,
		success: function(msg){
			$("#wizard").html(msg);
		}
	});
}
function seite_sonstige_artikel(anz,start,art,produktgruppe) {
	$("#ajax_artikel_liste").html("<p><h2>Daten werden geladen...</h2><br /><br /><img src='../images/bildlayer/loader.gif' width='208' height='13'></p>");
	anz=escape(anz);
	start=escape(start);
	art=escape(art);
	produktgruppe=produktgruppe;
	$.ajax({
		type: "POST",
		url: "../ajax/seite_sonstige_artikel.php",
		data: "anz="+anz
			+"&start="+start
			+"&art="+art
			+"&produktgruppe="+produktgruppe
			,
		success: function(msg){
			$("#ajax_artikel_liste").html(msg);
		}
	});
}

function print_pic(bild,feldid,wizard,id,artbez) {
	$.ajax({
		type: "POST",
		url: "ajax/print_pic.php",
		data: "bild="+bild
			+"&wizard="+wizard
			+"&id="+id
			+"&artbez="+artbez
			,
		success: function(msg){
			vfeld="#"+feldid;
			$(vfeld).html(msg);
		}
	});
}
function info_box() {
	$("#info_box").toggle();
}
function debug(msg) { if ($('#debug').length == 0) $('body').prepend('<div id="debug" style="background:white;color:firebrick;"></div>'); $('#debug').append("<br />" + msg); }
//
