function CheckFields(form_) {
	if ( form_.login_name.value == "") {
		alert("Inserire una E-Mail");
		return false;
	}
	if  ( form_.login_pwd.value == "") {
		alert("Inserire una Password");
		return false;
	}
	return true;
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function LoginBox(ch_id, path) {
username = getCookie('AG_UserLogin');
userlabel = Base64.decode(getCookie('AG_UserLabel'));
if (username!=null && username!="") {
document.write('<a href="'+path+'/1,1641,'+ch_id+'_NWL,00.html" class="linkbold">utente: '+userlabel+'</a>\n');
document.write('<a class="linknormal" href="/logout/1,2855,,00.html">logout</a>\n');
} else {
document.write('login:\n');
document.write('</div>\n');
document.write('<div id="logintestata">\n');
document.write('<form method=post name=user_login_top action="/01NET/AG_NewsletterExt_CheckDB/1,1694,,00.html">\n');
document.write('<input type=hidden name=ch_id value="'+ch_id+'">\n');
document.write('<input type=text name="login_name" size=22 maxlength=50 value="email" onfocus="if(this.value==\'email\')this.value=\'\';">\n');
document.write('<input type=password name="login_pwd" size=22 maxlength=20 value="*****" onfocus="if(this.value==\'*****\')this.value=\'\';">\n');
document.write('<input type=submit name=submit_login value="entra" onClick="return(CheckFields(this.form));" class="entra">\n');
document.write('</form>\n');
}
}

function VisualizzaRegistrazione(ch_id, path) {
var
  noUdbChannel = 51 // per energia 24, per ora	
username = getCookie('AG_UserLogin');
if (username==null || username=="") {
	if (ch_id != noUdbChannel) {
		formtipo = 'UDB'
	} else {
		formtipo = 'NWL'
	}
document.write('<a href="'+path+'/1,1641,'+ch_id+'_'+formtipo+',00.html"> registrati</a>\n');
}
}
