function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

wmtt = null;
function updateWMTT(e) {
    x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
    y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
    if (wmtt!=null) {
    wmtt.style.left = (x + 15) + "px";
    wmtt.style.top 	= (y + 15) + "px";
    }
}

function showWMTT(id) {
    wmtt = document.getElementById(id);
    wmtt.style.display = "block"
}

function hideWMTT() {
	wmtt.style.display = "none";
}
function showTech(nummer,pic){
	div1 = document.getElementById('tech_info_'+nummer);
    div1.style.display = "";
	
	highstatus = document.getElementById('techpic_high');
	highstatus.src = pic; 
	
	div2 = document.getElementById('techpic_high_div');
	div2.style.display = "";
}
function hideTech(){
    div1.style.display = "none";
	div2.style.display = "none";
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function check_cc(type) {
		var missing	='missing!';
		if (type==1){
			var missing	='fehlt!';
		}
		var status = 0

		if ((document.cc.cardholder.value.length=="0") || (document.cc.cardholder.value==missing)) {
		document.cc.cardholder.style.backgroundColor = "#dadad8";
		document.cc.cardholder.value = missing;
		status = 1;
		}
		
		if ((document.cc.cardno.value.length!=16) || (document.cc.cardno.value==missing) || isNaN(document.cc.cardno.value)) {
		document.cc.cardno.style.backgroundColor = "#dadad8";
		if ((document.cc.cardno.value==missing) || isNaN(document.cc.cardno.value)) document.cc.cardno.value = missing;
		status = 1;
		}
		
		if ((document.cc.cvc.value.length<3) || (document.cc.cvc.value.length>4) || (document.cc.cvc.value==missing) || isNaN(document.cc.cvc.value)) {
		document.cc.cvc.style.backgroundColor = "#dadad8";
		if ((document.cc.cvc.value==missing) || isNaN(document.cc.cvc.value)) document.cc.cvc.value = missing;
		status = 1;
		}
		
		if ((document.cc.cardtype.value.length=="0")) {
		document.cc.cardtype.style.backgroundColor = "#dadad8";
		status = 1;
		}
		
		if ((document.cc.expyear.value.length=="0")) {
		document.cc.expyear.style.backgroundColor = "#dadad8";
		status = 1;
		}
		
		if ((document.cc.expmonth.value.length=="0")) {
		document.cc.expmonth.style.backgroundColor = "#dadad8";
		status = 1;
		}


	return !status;
	}


function check_confirm(strAlert) {
	var status=0;
		if (!document.confirmform.terms.checked) {
		document.confirmform.terms.style.backgroundColor = "#dadad8"; //FF macht's nicht, IE?
		window.alert(strAlert);
		status = 1;
		}

	return !status;
	}
	



function check_login(type) {
		var missing	='missing!';
		if (type==1){
			var missing	='fehlt!';
		}
		var status = 0

		if ((document.loginform.user.value.length=="0") || (document.loginform.user.value==missing)) {
		document.loginform.user.style.backgroundColor = "#dadad8";
		document.loginform.user.value = missing;
		status = 1;
		}
		if (document.loginform.rnew) {
			if (!document.loginform.rnew[0].checked) {
				if ((document.loginform.pass.value.length=="0") || (document.loginform.pass.value==missing)) {
				document.loginform.pass.style.backgroundColor = "#dadad8";
				document.loginform.pass.value = "missing";
				status = 1;
				}
			}
		}
	return !status;
	}

function check_login2(type) {
		var missing	='missing!';
		if (type==1){
			var missing	='fehlt!';
		}
		var status = 0

		if ((document.loginform.user.value.length=="0") || (document.loginform.user.value==missing)) {
			document.loginform.user.style.backgroundColor = "#dadad8";
			document.loginform.user.value = missing;
			status = 1;
		}
	return !status;
	}

function check_passchange(type) {
		var missing	='missing!';
		if (type==1){
			var missing	='fehlt!';
		}
		var status = 0

		if ((document.passchange.oldpass.value.length=="0") || (document.passchange.oldpass.value==missing)) {
		document.passchange.oldpass.style.backgroundColor = "#dadad8";
		document.passchange.oldpass.value = missing;
		status = 1;
		}

		if ((document.passchange.newpass.value.length=="0") || (document.passchange.newpass.value==missing)) {
		document.passchange.newpass.style.backgroundColor = "#dadad8";
		document.passchange.newpass.value = missing;
		status = 1;
		}

		if ((document.passchange.newpassc.value.length=="0") || (document.passchange.newpassc.value==missing)) {
		document.passchange.newpassc.style.backgroundColor = "#dadad8";
		document.passchange.newpassc.value = missing;
		status = 1;
		}

	return !status;
	}

function check_mail(type) {
		var missing	='missing!';
		if (type==1){
			var missing	='fehlt!';
		}
		var status = 0

		if ((document.login.user.value.length=="0") || (document.login.user.value==missing)) {
		document.login.user.style.backgroundColor = "#dadad8";
		document.login.user.value = missing;
		status = 1;
		}

	return !status;
	}
	
	function check_login_mail() {
		var status = 0

		if ((document.pwd.email.value.length=="0") || (document.pwd.email.value=="#")) {
		document.pwd.email.style.backgroundColor = "#dadad8";
		status = 1;
		}


	return !status;
	}

	function setFirst_login(strField) {
		document.loginform[strField].select()
		document.loginform[strField].style.backgroundColor = "#FFFFFF";
		document.loginform[strField].style.borderColor = "#666666";

	}


	function setFirst_profil(strField) {
		document.profil[strField].select()
		document.profil[strField].style.backgroundColor = "#FFFFFF";
	}


	function setFirst_passchange(strField) {
		document.passchange[strField].select()
		document.passchange[strField].style.backgroundColor = "#FFFFFF";
	}
	
	function setFirst_cc(strField) {
		document.cc[strField].select()
		document.cc[strField].style.backgroundColor = "#FFFFFF";
	}

	function setMenue_cc(strField) {
		document.profil[strField].style.backgroundColor = "#FFFFFF";
	}

	function setMenue_profil(strField) {
		document.profil[strField].style.backgroundColor = "#FFFFFF";
	}

	function setMenue_cc(strField) {
		document.profil[strField].style.backgroundColor = "#FFFFFF";
	}

	function check_user(type,existing) {
		var missing	='missing!';
		if (type==1){
			var missing	='fehlt!';
		}
		var status = 0
		missingBg = "#dadad8";
		
		if ((document.profil.firstname.value.length=="0") || (document.profil.firstname.value==missing)) {
		document.profil.firstname.style.backgroundColor = missingBg;
		document.profil.firstname.value = missing;
		status = 1;
		}
		
		if ((document.profil.surname.value.length=="0") || (document.profil.surname.value==missing)) {
		document.profil.surname.style.backgroundColor = missingBg;
		document.profil.surname.value = missing;
		status = 1;
		}
		
		if (document.profil.country.value.length=="0") {
		document.profil.country.style.backgroundColor = missingBg;
		status = 1;
		}
		
		if ((document.profil.email.value.length=="0") || (document.profil.email.value==missing)) {
		document.profil.email.style.backgroundColor = missingBg;
		document.profil.email.value = missing;
		status = 1;
		}
		
		if (existing != 1) {
			
			if ((document.profil.pass.value.length=="0") || (document.profil.pass.value==missing)) {
			document.profil.pass.style.backgroundColor = missingBg;
			document.profil.pass.value = missing;
			status = 1;
			}
			if ((document.profil.password_confirm.value.length=="0") || (document.profil.password_confirm.value==missing)) {
			document.profil.password_confirm.style.backgroundColor = missingBg;
			document.profil.password_confirm.value = missing;
			status = 1;
			}
			
			if (document.profil.password_confirm.value!=document.profil.pass.value) {
			document.profil.password_confirm.style.backgroundColor = missingBg;
			document.profil.password_confirm.value = missing;
			document.profil.pass.style.backgroundColor = missingBg;
			document.profil.pass.value = missing;
			status = 1;
			}
		}
		
		if ((document.profil.street.value.length=="0") || (document.profil.street.value==missing)) {
		document.profil.street.style.backgroundColor = missingBg;
		document.profil.street.value = missing;
		status = 1;
		}

		
		if ((document.profil.no.value.length=="0") || (document.profil.no.value==missing)) {
		document.profil.no.style.backgroundColor = missingBg;
		document.profil.no.value = missing;
		status = 1;
		}
		
		if ((document.profil.zip.value.length=="0") || (document.profil.zip.value==missing)) {
		document.profil.zip.style.backgroundColor = missingBg;
		document.profil.zip.value = missing;
		status = 1;
		}
		
		if ((document.profil.city.value.length=="0") || (document.profil.city.value==missing)) {
		document.profil.city.style.backgroundColor = missingBg;
		document.profil.city.value = missing;
		status = 1;
		}
		
		// Wenn Mobiltelefon angegeben ist, kann Telefon ausgelassen werden
		if (((document.profil.phone.value.length=="0") || (document.profil.phone.value==missing)) && ((document.profil.mobile.value.length=="0") || (document.profil.mobile.value==missing))) {
		document.profil.phone.style.backgroundColor = missingBg;
		document.profil.phone.value = missing;
		status = 1;
		}
		
		if ((document.profil.country.value.length=="0") || (document.profil.country.value=="please select")) {
		document.profil.country.style.backgroundColor = missingBg;
		status = 1;
		}
		

	return !status;
	}
	
	function setFirst_contact(strField) {
		document.contact[strField].select()
	}


function showHelp(layerID) {
//	pos=findPos(document.getElementById(layerID));
	document.getElementById(layerID).style.visibility = 'visible';
	document.getElementById(layerID).style.display = 'block';
	document.getElementById(layerID).style.marginTop = '-138px';
	document.getElementById(layerID).style.marginLeft= '-300px';
}

function hideHelp(layerID) {
	document.getElementById(layerID).style.visibility = 'hidden';
	document.getElementById(layerID).style.display = 'none';

	if (document.getElementsByName('deliveries')[0]) {
		document.getElementsByName('deliveries')[0].style.visibility = 'visible'; 
	}
}
function cr_zoom(pic){
	scroll(0,0);
	d = document;
	d.getElementById('blacklayer').style.display = '';
	d.getElementById('zoomlayer').style.display = '';
	d.getElementById('zoompic').src = pic;
	//Effect.Appear("zoomlayer", {duration: 1});
	if(d.getElementById('div2hide')){
		d.getElementById('div2hide').style.display = 'none';
	}
}
function cr_zoomout(){
	d = document;
	d.getElementById('blacklayer').style.display = 'none';
	d.getElementById('zoomlayer').style.display = 'none';
	d.getElementById('zoompic').src = 'clear.gif';
	if(d.getElementById('div2hide')){
		d.getElementById('div2hide').style.display = '';
	}
}
function cr_partsout(){
	d = document;
	d.getElementById('blackparts').style.display = 'none';
	d.getElementById('partslayer').style.display = 'none';
	d.getElementById('innerparts').innerHTML = '<div align="center"><img src="fileadmin/images/loading_popup.gif" /></div>';
	if(d.getElementById('div2hide')){
		d.getElementById('div2hide').style.display = '';
	}
}
function cr_parts(uid,type){
	scroll(0,0);
	d = document;
	d.getElementById('blackparts').style.display = '';
	d.getElementById('partslayer').style.display = '';
	var url = "index.php";
	var pars = "eID=cr_ajax&powerpartID="+uid+"&isotype="+type;
	var myAjax = new Ajax.Request(url, {method: "get", parameters: pars, onComplete: updateDiv});
	if(d.getElementById('div2hide')){
		d.getElementById('div2hide').style.display = 'none';
	}
}
function updateDiv(orgRequest) {
	var xmldoc = orgRequest.responseXML;
	xmldoc.getElementsByTagName("data")[0].normalize();					
	var result = xmldoc.getElementsByTagName("data")[0].firstChild.data;
	document.getElementById("innerparts").innerHTML = result;
}

function buttonline(id,i){
	var j = 0;
	d = document;

	while (d.getElementById(id+j)){
		if(j==i){
			d.getElementById(id+j).style.display = 'none';
			d.getElementById(id+j+'_h').style.display = '';
			d.getElementById(id+j+'_p2c').style.display = '';
		}else{
			d.getElementById(id+j).style.display = '';
			d.getElementById(id+j+'_h').style.display = 'none';
			d.getElementById(id+j+'_p2c').style.display = 'none';
		}
		j++;
	}
	
}

function showSocial(id) {
    soci = document.getElementById(id);
    soci.style.display = "inline"
}

function hideSocial(id) {
    soci = document.getElementById(id);
	soci.style.display = "none";
}
