// JavaScript Document
function hidestatus()
{
	window.status = '';
	return true
}


function browsers ()
{
	// For Opera 
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type = "OP"; 
	// FOR IE
	if (document.all) type = "IE";
	// For Netscape 4
	if (document.layers) type = "NN";
	// For Netscape 6 and up
	if (!document.all && document.getElementById) type = "MO";
	return type;

}
if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover = hidestatus;
document.onmouseout = hidestatus;

function left_navBar( tableCellRef, hoverFlag, navStyle ) 
{
	if ( hoverFlag ) 
	{
		switch ( navStyle ) 
		{
			case 1:
				tableCellRef.style.backgroundColor = '#249bba';
				if (document.getElementsByTagName)
				{
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#ffffff';
				}
				break;
			default:
				if ( document.getElementsByTagName ) 
				{
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000000';
				}
		}
		
	} else 
	{
		switch ( navStyle )
		{
			case 1:
				tableCellRef.style.backgroundColor = '#ffffff';
				if (document.getElementsByTagName)
				{
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000000';
				}
				break;
			default:
				if ( document.getElementsByTagName ) 
				{
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000000';
				}
		}
	}
}

function left_navBarClick (tableCellRef, navStyle, url) 
{
	left_navBar( tableCellRef, 0, navStyle);
	left_goTo (url);
}

function left_goTo (url) {
	window.location.href = url;
}

function SendForm ()
{
	form = document.forma;
	if (form)
	{
		if (form.onoma.value == "")
		{
			alert ("Το όνομα ΠΡΕΠΕΙ οπωσδήποτε να συμπληρωθεί");
			form.onoma.focus ();
			return false;
		}
		if (form.eponimo.value == "")
		{
			alert ("Το επίθετο ΠΡΕΠΕΙ οπωσδήποτε να συμπληρώθει");
			form.eponimo.focus ();
			return false;
		}
		if (form.address.value == "")
		{
			alert ("Η ταχυδρομική διεύθυνση ΠΡΕΠΕΙ οπωσδήποτε να συμπληρώθει");
			form.address.focus ();
			return false;
		}
		if (form.zip_code.value == "")
		{
			alert ("Ο Ταχυδρομικός Κώδικάς σας ΠΡΕΠΕΙ οπωσδήποτε να συμπληρώθει");
			form.zip_code.focus ();
			return false;
		}
		if (form.city.value == "")
		{
			alert ("Το όνομα της πόλης διαμονής σας ΠΡΕΠΕΙ οπωσδήποτε να συμπληρώθει");
			form.city.focus ();
			return false;
		}
		if (form.country.value == "")
		{
			alert ("Η χώρα προέλευσής σας ΠΡΕΠΕΙ οπωσδήποτε να συμπληρώθει");
			form.country.focus ();
			return false;
		}
		if (form.phone.value == "")
		{
			alert ("Ο αριθμός τηλεφώνου σας ΠΡΕΠΕΙ οπωσδήποτε να συμπληρώθει");
			form.phone.focus ();
			return false;
		}
		form.sub01.disabled = true;
		form.sub02.disabled = true;
		form.submit ();
	}
}

function Step01 ()
{
	form = document.forma;
	if (form)
	{
		form.sub01.disabled = true;
		form.sub02.disabled = true;
		form.submit ();
	}
}

function ConfirmOrder ()
{
	form = document.forma;
	if (form)
	{
		form.sub01.disabled = true;
		form.sub02.disabled = true;
		form.submit ();
	}
}

function RejectOrder (pid)
{
	form = document.forma;
	if (form)
	{
		form.sub01.disabled = true;
		form.sub02.disabled = true;
	}
	location.href = "index.php?pid=" + pid + "&act=off";
}

function Print (sname, sid)
{
	w = screen.availWidth/2;
	h = screen.availHeight/2 - 40;
	path="/iframes/print_order.php?"+sname+"="+sid;
  	features = "width="+w+",height="+h+",left=0,top=0";
  	features += ",screenX=0,screenY=0";
  	features += ",scrollbars=1,resizable=1,location=0";
  	features += ",menubar=0,toolbar=0,status=0";
	window.open(path, '', features);
}


// contact
var ie4 = document.all;
var ns6 = document.getElementById && !document.all;
function trim(s) 
{
	while (s.substring(0, 1) == ' ') 
	{
		s = s.substring(1, s.length);
  	}
	while (s.substring(s.length-1, s.length) == ' ') 
	{
		s = s.substring(0, s.length-1);
	}
	return s;
}

function isEmail (str) 
{
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(str) && r2.test(str));
}


function FormSend ()
{
	focusField();
	regEmailExp = "/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i";
	if (trim (form01.elements['names'].value) == '')
	{
		alert ('Δεν έχετε συμπληρώσει το πεδίο "Ονοματεπώνυμο"');
		form01.elements['names'].value = '';
		form01.elements['names'].focus();
		return false;
	}
	if (trim (form01.elements['email'].value) == '')
	{
		alert ('Δεν έχετε συμπληρώσει το πεδίο "E-mail"');
		form01.elements['email'].value = '';
		form01.elements['email'].focus();
		return false;
	
	} else
	{
		email = trim (form01.elements['email'].value);
		if (!isEmail (email))
		{
			alert ('Αυτό το e-mail δεν είναι σωστό');
			form01.elements['email'].value = '';
			form01.elements['email'].focus();
			return false;
		}
	}
	
	if (trim (form01.elements['notes'].value) == '')
	{
		alert ('Δεν έχετε συμπληρώσει το πεδίο "Σημειώσεις"');
		form01.elements['notes'].value = '';
		form01.elements['notes'].focus();
		return false;
	}
	if (ie4 || ns6)
	{
		obj = document.getElementById ? document.getElementById ('button') : document.all.button;
		obj.style.visibility = 'hidden'; 
	}
	document.form01.submit();
}

function focusField()
{
	if (form01.elements['names'])
	{
		form01.elements['names'].focus();
	}
}
