//listi funktsioonid
//richard tõnnis
//rix@multiscript.ee
//sept.2006
function showtable(id){
td = document.getElementById(id);
if (td.style.display == 'none'){
td.style.display = '';
}
else {
td.style.display = 'none';	
}
}
function avaWin(pilt,laius,korgus) { 
uusWin= open("", "displayWindow", "width="+laius+",height="+korgus+",status=no,toolbar=no,menubar=no"); 
uusWin.document.open(); 
uusWin.document.write("<html><head><title>Foto"); 
uusWin.document.write("</title></head> <body topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\" onclick=\"window.close(this);\" oncontextmenu=\"return false;\" style=\"background-color: #FFFFFF; cursor:crosshair;\">"); 
var tee=pilt; 
uusWin.document.write("<img src=\""+tee+"\">"); 
uusWin.document.write("</body></html>"); 
uusWin.document.close();   
} 
function emailcontrol(datav){
var email_address = document.getElementById(datav).value;        
at = email_address.indexOf('@');
dot = email_address.indexOf('.');
if(at == -1 || dot == -1 || dot <= at + 1 || dot == 0 || dot == email_address.length - 1){
alert('Viga, palun sisesta korrektne e-mail');
return false;
}
//user_name = email_address.substr(0, at);
//domain_name = email_address.substr(at + 1, email_address.length);                  
return true;
}
function valuecontrol(value){
if (value.length < 1){
alert('Viga, palun sisesta korrektne nimi');
return false;
}
else {
return true;	
}	
}
function soovitacontrol(email,nimi){
if (emailcontrol(email) == true && valuecontrol(nimi) == true){
return true;
}
else {
return false;
}	
}
var eb = '';
var c = '#d4d5d9';
var moz = 0;
var t = '';
function b_over(eButton,col)
	{
	clearTimeout(t);
	var zx = document.getElementById(eButton);
	zx.style.backgroundColor = col;
	eb = eButton;
	//alert(zx.style.backgroundColor);
	if (moz == 0){
	t = setTimeout("b_over(eb,'')",100);
	moz = 1;
	}
	else {
	t = setTimeout("b_over(eb,c)",100);
	moz = 0;
	}
	}
function b_out(eButton)
	{
	clearTimeout(t);
	eButton.style.backgroundColor = "";
	}
