
function iOn(img) {	if (document.images) document[img].src = "images/" + img + 'b.gif' }
function iOf(img) {	if (document.images) document[img].src = "images/" + img + '.gif' }

function imgOn(img) {	if (document.images) document[img].src = "en/img/" + img + 'b.gif' }
function imgOf(img) {	if (document.images) document[img].src = "en/img/" + img + '.gif' }

function mnuOn(img) { if (document.images) document[img].src = 'en/mnu/' + img + 'b.gif' }
function mnuOf(img) {	if (document.images) document[img].src = "en/mnu/" + img + '.gif' }


function PrlI() {	
	for (i=1;i<6;i++) PrlImage('en/mnu/m'+i+'b.gif')
	for (i=1;i<3;i++) PrlImage('images/lang'+i+'b.gif')
	for (i=0;i<arguments.length;i++) 
		PrlImage('en/mnu/'+arguments[i])
}

var img = new Array() 

function PrlImage(im) {
	if (document.images) {
		img[img.length] = new Image()
		img[img.length-1].src = im
	}
}

function SndAdd(s) {
	var f=document.f_add
	if (!f.amount.value) {alert('Please enter the number of pieces!'); f.amount.focus();}
	else if (f.amount.value<=0 || Math.round(f.amount.value) != f.amount.value ) {alert('Quantity must be a positive cardinal number!'); f.amount.focus();}
	else if (f.siz &&  !f.siz.value) {alert('Please enter the size!'); f.siz.focus();}
	else if (s) f.submit(); else return true;
	return false;
}

function DelConf() {	return window.confirm('Do you want to delete this item from the order sheet?') }

function DelConfX() {	return window.confirm('Do you want to delete all items from the order sheet?') }

function SndReg() { 
	var f=document.f_rg
	if (!f.fname.value) {alert('Please enter your name!'); f.fname.focus();}
	else if (!f.surname.value) {alert('Please enter your surname!'); f.surname.focus();}
	else if (!f.email.value) {alert('Please enter your e-mail!'); f.email.focus();}
	else if (!isemail(f.email.value)) { alert('Please enter a valid e-mail address!');f.email.focus();}
	else if (!f.pass.value) {alert('Please enter your password!'); f.pass.focus();}
	else if (!f.pass2.value) {alert('Please enter your password again!'); f.pass2.focus();}
	else if (f.pass.value!=f.pass2.value) {alert('Entered passwords do not match, please enter them again!'); f.pass.focus();}
	else return true;
	return false;
}

function isemail(t) {
	if (t.indexOf("@") < 1 || t.indexOf("@") != t.lastIndexOf("@") || t.lastIndexOf(".") < t.lastIndexOf("@")+2  || t.lastIndexOf(".") > (t.length-3) || t.lastIndexOf(".") < (t.length-4)) return false
	else return true
}

function SndLG() {
	var f=document.f_lg
	if (f.email.value && f.pass.value) f.typ[0].checked=true
	if (! (f.typ[0].checked ||f.typ[1].checked)) {alert('Please select login or registration!');return false;}
	else if(f.typ[0].checked ) {
		if (!f.email.value) {alert('Please enter your e-mail!'); f.email.focus();return false;}
		else if (!f.pass.value) {alert('Please enter your password!'); f.pass.focus();return false;}
		else return true;
	}
	else return true;
}

function SndSN(url) {
	var f=document.f_sn
	if (f.typ[0].checked) return true;
	else if (f.typ[1].checked) {
		if (navigator.appName=="Microsoft Internet Explorer" && navigator.appVersion.indexOf('MSIE 4')>-1)	document.location=url+'&ie4=1';
		else window.open(url,'fax','toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width=600,height="580"top=1,left=1')
	}
	else {alert('Please select a way of sending the order sheet!');}

	return false;
}

function SndLH() {
	var f=document.f_lh
	if (!f.email.value) {alert('Please enter your e-mail!'); f.email.focus();return false;}
	else return true;
}

function SndS() {
	var f=document.f
	if (!f.txt.value) {alert('Please enter a product name or catalog id of a product!'); f.txt.focus();return false;}
	else return true;
}

function TheMap() {
	window.open("map.html","Mapa","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=360,height=600,top=1,left=1")
	return false
}