statusestuote = new Array();

function confirmSubmit(text){
	var agree = confirm(text);
	if(agree)
		return true;
	else
		return false;
}

function toggle(id){
	if(document.getElementById){
		var lid = document.getElementById('tiedot'+id);
		if(statusestuote[id]){
			statusestuote[id] = 0;
			lid.className = 'hidelist';
		} else {
			statusestuote[id] = 1;
			lid.className = 'showlist';
		}
		
	}
}

function changeimage(imgname, newsrc){
	document[imgname].src = newsrc;
}

function checkform(form){
	checkme = form.maara.value;
	if(!checkme.match(/^\d+$/)){
		alert('Aseta määrä')
		return false;
	}
	return true;
}
function checkorder(form, oldcustomer){
	checkme = form.etunimet.value;
	if(!checkme.match(/^[a-zåäöëöïüÿáéýúíóàèùìòãñõâêûîô ]{2,}$/i)){
		alert('Tarkista etunimi')
		return false;
	}
	checkme = form.sukunimi.value;
	if(!checkme.match(/^[a-zåäöëöïüÿáéýúíóàèùìòãñõâêûîô ]{2,}$/i)){
		alert('Tarkista sukunimi')
		return false;
	}
	checkme = form.email.value;
	if(!checkme.match(/^[\w\.]+@[\w\.]+\.\w{2,4}$/i)){
		alert('Tarkista sähköpostiosoite')
		return false;
	}
	checkme = form.katuosoite.value;
	if(!checkme.match(/^[\wa-zåäöëöïüÿáéýúíóàèùìòãñõâêûîô ]{2,}$/i)){
		alert('Tarkista katuosoite')
		return false;
	}
	checkme = form.postinumero.value;
	if(!checkme.match(/^\d{5}$/)){
		alert('Tarkista postinumero')
		return false;
	}
	checkme = form.postitoimipaikka.value;
	if(!checkme.match(/^[a-zåäöëöïüÿáéýúíóàèùìòãñõâêûîô ]{2,}$/i)){
		alert('Tarkista postitoimipaikka')
		return false;
	}
	if(!oldcustomer && !form.agree.checked){
		alert('Tilataksesi sinun on hyväksyttävä kauppapaikan ehdot')
		return false;
	}
	return true;
}

function openwindow(lan, imgname){
	window.open("imagepopup.cgi?pic="+document[imgname].src+"&lan="+lan,"boreuspopup","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=803,height=823");
}
function openwindow2(url){
	window.open(url,"boreuspopup","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=500");
}
