var
	fm = null;
	ok = null;
	enev = null;
	first = 1;
	akt = '';
	
	//scroll változói		
	speed = 3;
	dir = null;
	mag = null;
	elsoscroll = 0;
	ln = null;
	
	
function mOff(imageName) {
	if ( document.images && akt != imageName ) {
		document[imageName].src = eval(imageName + "off.src");
	}
}

function mOn(imageName) {
	if ( document.images && akt != imageName ) {
		document[imageName].src = eval(imageName + "on.src");
	}
}

function mCli(imageName) {
	if (document.images) {
		document[imageName].src = eval(imageName + "cli.src");
		akt = imageName;
	}
}

function klikk(imageName,imageName2) {
    enev = akt;
    mCli(imageName);
    if (enev!=null && enev!=akt && first != 1) mOff(enev)
    else if (enev!=akt && first!=1) mOff(imageName2)
      else if (imageName!=imageName2) mOff(imageName2);
    if (first==1) first=2;
}
 
// scroll
 
function stopscroll() {
	parent.center.loop = false;
	clearTimeout(parent.center.scrolltimer);
}

function divmag(divName) {
	switch (divName) {
		case "magunk" :
			mag = 620;
			break;
	}
}
		
function scroll(layerName, imgName) {
	if (elsoscroll == 0) { elsoscroll = 1; }
	else { stopscroll(); }
	var page = null;
	dir = imgName;
	ln = layerName;
	parent.center.loop = true;
	scrolltimer = null;
	divmag(layerName);
	if (parent.center.document.layers) { var page = eval(parent.center.document.ln);}
	else {
		if (parent.center.document.getElementById) { var page= eval("parent.center.document.getElementById(ln).style"); }
		else {
			if (parent.center.document.all) { var page = eval(parent.center.document.all.ln.style); }
		}
	}
	var y = parseInt(page.top);
	if (parent.center.loop == true && y > (mag * (-1)) && (mag * (-1)) < 0) {
		if (dir == "dn" && y > (mag * (-1)) - speed ) { page.top = (y - (speed)); }
		else { 
			if (dir == "dn" && y < (mag * (-1)) - speed && y > (mag * (-1))) { parent.center.scrolltimer = setTimeout("stopscroll()", 1); }
			else {
				if (dir == "up" && y < 0) { page.top = (y + (speed)); }
			}
		}
		parent.center.scrolltimer = setTimeout("scroll(ln,dir)", 1);
	}
	else {
		if (dir == "up") {
			page.top = (y + (speed));
			parent.center.scrolltimer = setTimeout("scroll(ln,dir)", 1);
		}
	}
}

function indul(imgName, layerName, merre) {
	mOn(imgName);
	scroll(layerName, merre);
}

function megall(imgName) {
	mOff(imgName);
	stopscroll();
}
//scroll end

function monitor() {
 	if (screen.width <= 800 && fm == null) {
		alert("Kérem, nyomja le az F11 feliratú billentyűt! (Másodszori lenyomásával visszaállíthatja a böngészőjét.)");
		fm++;
	}
}

function gOn(nev) {
	if ( akt != nev ) {
		mOn(nev);
		document.all.music.src = 'wau.wav';
	}
}

var oksa;
function ell() {
	if (document.forms.ar.nev.value != "" && document.forms.ar.cim.value != "" && document.forms.ar.tel.value != "" && ( document.forms.ar.fax.value != "" || document.forms.ar.faxnincs.checked == true ) && document.forms.ar.mail.value != "" && document.forms.ar.problem.value != "") {
		var goodEmail = document.forms.ar.mail.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if ( goodEmail ) {
			oksa = true
			document.forms.ar.action = "mailto:acel-man@acel-man.hu?subject=Árajánlat kérése;";
			document.forms.ar.submit();
		}
		else {
			alert('Helytelen e-mail cím!')
			document.forms.ar.mail.focus()
			document.forms.ar.mail.select()
			oksa = false
		}
	}
	else alert('Nem töltötte ki az adatlapot!');
}

function nyom() {
	if (document.forms.ar.nev.value != "" && document.forms.ar.cim.value != "" && document.forms.ar.tel.value != "" && ( document.forms.ar.fax.value != "" || document.forms.ar.faxnincs.checked == true ) && document.forms.ar.mail.value != "" && document.forms.ar.problem.value != "") {
		window.print();
	}
	else alert('Nem töltötte ki az adatlapot!');
}
