//////////////////////////////////////
// JavaScript for AC Autocheck /
//
// version: 0.1
// date   : 09/2007
// author : Patrick Tietz for netformic
// email  : 
// website: http://www.netformic.de
//////////////////////////////////////
// updated: --/----
// from   :
//////////////////////////////////////
version = "n3";

function emptyIfNotStd(fieldvalue,fieldlocation) {
	if (fieldlocation.value == fieldvalue || fieldlocation.value == "") {
		fieldlocation.value =""
	}
}

function fillIfEmpty(fieldvalue,fieldlocation) {
	if (fieldlocation.value == "") {
		fieldlocation.value = fieldvalue;
	}
}

function openImage(x) {
	Image = window.open("fileadmin/templates/scripts/mp30/show_image.php?image=" + x, "image", "width=400,height=400,left=100,top=200,toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no");
	Image.focus();
}

function openELN(x,y) {
	//eln.location.href = 'http://eln.de/testmonat/?uid='+x;
	if (y=='eln') {
		window.open('http://eln.de/','_blank');
	}
	if (y=='testmonat') {
		window.open('http://eln.de/testmonat/?uid='+x,'_blank');
	}
}

//new window
var newwin;
function popup(url,name,eigenschaften)
{
newwin = window.open(url,name,eigenschaften);
setTimeout('newwin.focus();',200);
}

function lLiker() { // copies values from "Rechnungsanschrift" to "Lieferanschrift"
	x = document.getElementsByName('r_firma')[0];
	y = document.getElementsByName('l_firma')[0];
	y.value = x.value;
	x = document.getElementsByName('r_vorname')[0];
	y = document.getElementsByName('l_vorname')[0];
	y.value = x.value;
	x = document.getElementsByName('r_nachname')[0];
	y = document.getElementsByName('l_nachname')[0];
	y.value = x.value;
	x = document.getElementsByName('r_strasse')[0];
	y = document.getElementsByName('l_strasse')[0];
	y.value = x.value;
	x = document.getElementsByName('r_nummer')[0];
	y = document.getElementsByName('l_nummer')[0];
	y.value = x.value;
	x = document.getElementsByName('r_plz')[0];
	y = document.getElementsByName('l_plz')[0];
	y.value = x.value;
	x = document.getElementsByName('r_ort')[0];
	y = document.getElementsByName('l_ort')[0];
	y.value = x.value;
	x = document.getElementsByName('r_land')[0];
	y = document.getElementsByName('l_land')[0];
	y.selectedIndex = x.selectedIndex;
	x = document.getElementById('lliker');
	x.setAttribute("href", "JavaScript:reset_l();");
	x.innerHTML = "Zurücksetzen";
}

function reset_l() {
	x = document.getElementsByName('l_firma')[0];
	x.value = "";
	x = document.getElementsByName('l_vorname')[0];
	x.value = "";
	x = document.getElementsByName('l_nachname')[0];
	x.value = "";
	x = document.getElementsByName('l_strasse')[0];
	x.value = "";
	x = document.getElementsByName('l_nummer')[0];
	x.value = "";
	x = document.getElementsByName('l_plz')[0];
	x.value = "";
	x = document.getElementsByName('l_ort')[0];
	x.value = "";
	x = document.getElementsByName('l_land')[0];
	x.selectedIndex = 0;
	x = document.getElementById('lliker');
	x.setAttribute("href", "JavaScript:lLiker();");
	x.innerHTML = "Wie Rechnungsanschrift";
}

function changePrice() {
	x = document.priceform.size.options[document.priceform.size.options.selectedIndex].value;
	var z = document.getElementById('price');
	if (x && z) {
		y = window.location.pathname + window.location.search;
		location.href = y + '&size=' + x;
	}
}

/*
	Written by Jonathan Snook, http://www.snook.ca/jonathan
	Add-ons by Robert Nyman, http://www.robertnyman.com
*/

function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

/*<![CDATA[*/
<!--

  // JS function for uncrypting spam-protected emails:
function UnCryptMailto(s) {	//
	var n=0;
	var r="";
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(1));
	}
	return r;
}
  // JS function for uncrypting spam-protected emails:
function linkTo_UnCryptMailto(s)	{	//
	location.href=UnCryptMailto(s);
}
		

// -->
/*]]>*/