var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE);
document.onmousedown = getMouseXY;

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX;
    tempY = e.pageY;
  }
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 200}
  if (tempY < 0){tempY = 0}
}

function Show(divID, preis, artnr)
{

  // catch possible negative values in NS4
 // if (tempX < 0){tempX = 0}
 // if (tempY < 0){tempY = 0}

		document.getElementById(divID).style.left=tempX;
		document.getElementById(divID).style.top=tempY+100;
		document.getElementById(divID).style.display = "block";
		document.preis_form.new_preis.value = preis;
		document.preis_form.artikelnr.value = artnr;

}
//Hide Div
function Hide(divID)
{
 document.getElementById(divID).style.display = "none";
}
//ShowDiv
function show(divID)
{
 document.getElementById(divID).style.display = "block";
}

function make_disabled(tocheck,elem)
{
	if(document.preis_form.tocheck.value = '')
		document.preis_form.Submit.disabled = true;
}


function Validate(form, Component, typ ,divID)
{
	var mForm = document.forms[form];
	var e = mForm.elements[Component].value;

	div = document.getElementById(divID);

	var result = true;

	switch(typ){

	case "string":
		if(e.length == 0){
		result=false;
		div.style.display = "block";
		}
		break;

	case "integer":
		div.style.display = "none";
		if(e.length == 0 ||  e != parseInt(e)){
		result=false;
		div.style.display = "block";
		}
		break;

	case "email":

		if (e.indexOf("@") == -1 || e.indexOf(".") == -1){
		result = false;
		div.style.display = "block";
		}
	default:
	result = true;
	}
}

function brutto2netto()
{

	if(document.form_add_article.mwst.selectedIndex == 0)
	document.form_add_article.article_net_price.value = document.form_add_article.article_price.value;

	if(document.form_add_article.mwst.selectedIndex == 1)
	document.form_add_article.article_net_price.value = document.form_add_article.article_price.value * 0.93;

	if(document.form_add_article.mwst.selectedIndex == 2)
	document.form_add_article.article_net_price.value = document.form_add_article.article_price.value * 0.81;
}

function netto2brutto()
{

	if(document.form_add_article.mwst.selectedIndex == 0)
	document.form_add_article.article_price.value = document.form_add_article.article_net_price.value;

	if(document.form_add_article.mwst.selectedIndex == 1)
	document.form_add_article.article_price.value = document.form_add_article.article_net_price.value * 1.07;

	if(document.form_add_article.mwst.selectedIndex == 2)
	document.form_add_article.article_price.value = document.form_add_article.article_net_price.value * 1.19;
}

function PopUp(URL,Breite,Hoehe)
{
    var Name = "popup";
    var Fensteroptionen = "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0";
    window.open(URL, 'Name', Fensteroptionen + ',width=' + Breite + ',height=' + Hoehe);

}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}