// JScript Custom by: andrea.bettoni@ideaup.com
// (c) 2006 AzzurroGroup - Torino

function addbookmark(){
url="http://azzurrogroup.it/"
title="AreAzzurro - Area riservata ai Consorziati AzzurroGroup"
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("\n\rPremere i tasti: CTRL+D (Netscape) oppure CTRL+T (Opera)\n\rPer aggiungere questo sito nei segnalibri...\n\r");
  }
}
function addbookmark2(){
url="http://azzurrogroup.it/_download_renson.asp"
title="AzzurroGroup - AREA CATALOGHI RENSON"
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("\n\rPremere i tasti: CTRL+D (Netscape) oppure CTRL+T (Opera)\n\rPer aggiungere questo sito nei segnalibri...\n\r");
  }
}

function confermaLog() { // richiede all'utente conferma dell'azione
var x = '\n\rSiete sicuri di voler eliminare il record selezionato?\n\r';
  return confirm(x);
}

function confermaEvadiLog() { // richiede all'utente conferma dell'azione
var x = '\n\rSpostare il record selezionato nell\'archivio Log?\n\r';
  return confirm(x);
}

function confermaForn() { // richiede all'utente conferma dell'azione
var a = '\n\rSiete sicuri di voler eliminare il fornitore selezionato?\n\r';
  return confirm(a);
}

function confermaEliminaProdotto(aux) { // richiede all'utente conferma dell'azione
var b = '\n\rEliminare definitivamente l\'articolo'+aux+'?\n\r';
  return confirm(b);
}

function confermaArt() { // richiede all'utente conferma dell'azione
var c = '\n\rSiete sicuri di voler eliminare l\'articolo selezionato?\n\r';
  return confirm(c);
}

function confermaCancellaTutto() { // richiede all'utente conferma dell'azione
var d = '\n\rSiete sicuri di voler cancellare tutto il contenuto del carrello?\n\r';
  return confirm(d);
}


	function checkSearchCodice() {
if (document.searchFormCodice.codice.value == "") {
alert('\n\rDovete inserire un codice da ricercare!\n\r');
return false
} else
{
return true
}
}
	function checkSearchDescrizione() {
if (document.searchFormDescrizione.descrizione.value == "") {
alert('\n\rDovete inserire almeno un termine da ricercare!\n\r');
return false
} else
{
return true
}
}


function vediCarrello() { 
larg=780; 
alt=500; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('/_carts/cart.asp','cartWindow','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=yes,status=no,location=no,toolbar=no'); 
} 

function popLog(aux) { 
var Url ='/_admin_log_popup.asp';
var str = '?ID='+String(aux);
var strUrl= Url+str;
larg=780; 
alt=500; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open(strUrl,'logWindow','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=yes,status=no,location=no,toolbar=no'); 
} 


	function checkSearch() {
if (document.searchform.parole.value == "") {
alert('\n\rDovete inserire almeno un termine di ricerca!\n\r');
return false
} else
{
return true
}
}

	function checkAzienda() {
if (document.aziendaform.id.value == "0") {
alert('\n\rDovete selezionare una azienda fornitore!\n\r');
return false
} else
{ return true }
}


	function checkFornitore() {
if (document.formAggiungiFornitori.nome_fornitore.value == "") {
alert('\n\rNon avete inserito la ragione sociale del fornitore!\n\r');
return false
} else
{ return true }
}

	function checkArticolo() {
strErr="";
strAvviso="\n\rDovete inserire i seguenti dati:\n\r";
if (document.formAggiungiArticoli.codice.value == "") strErr += "Codice Articolo\n\r";
if (document.formAggiungiArticoli.descrizione.value == "") strErr += "Descrizione Articolo\n\r";
if (document.formAggiungiArticoli.finitura.value == "") strErr += "Finitura\n\r";
if (strErr!=""){ 
alert(strAvviso+strErr);
return false;
} else { 
return true;
}
}


function privacyRenson() { 
larg=640; 
alt=480; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('/privacy.htm','privacy','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=yes,status=no,location=no,toolbar=no'); 
} 


function checkRenson() {
missinginfo = "";
if (document.modulocomm.nomecognome.value == "") {
missinginfo += "\n     -  Nome e Cognome";
}

if (document.modulocomm.nomeazienda.value == "") {
missinginfo += "\n     -  Ragione sociale";
}

if (document.modulocomm.settore.value == "") {
missinginfo += "\n     -  Attivitā svolta";
}

if (document.modulocomm.indirizzo.value == "") {
missinginfo += "\n     -  Indirizzo";
}

if (document.modulocomm.city.value == "") {
missinginfo += "\n     -  Cittā";
}
if (document.modulocomm.provincia.value == "") {
missinginfo += "\n     -  Provincia";
}

if (document.modulocomm.cap.value == "") {
missinginfo += "\n     -  CAP";
}
if ((document.modulocomm.email.value == "") || (document.modulocomm.email.value.indexOf('@') == -1) || (document.modulocomm.email.value.indexOf('.') == -1)) {
missinginfo += "\n     -  E-mail";
}

if ((document.modulocomm.email.value!=document.modulocomm.email2.value)||(document.modulocomm.email2.value=="")) {
missinginfo += "\n     -  La e-mail di conferma non corrisponde!";
}

if (missinginfo != "") {
missinginfo2 = "Non risultano inseriti correttamente i seguenti dati:\n" ;
missinginfo2 += missinginfo ;
alert(missinginfo2);
return false
} else { 


document.modulocomm.action="_sendmail_renson.asp";;
document.modulocomm.submit();
return true    
}
}
function selezionaR(id) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
  selDiv.style.color = "#00307B";
	selDiv.style.fontWeight = "Bold";
}
function deselezionaR(id) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
		selDiv.style.color = "#000080";
		selDiv.style.fontWeight = "normal";
}

function seleziona(id) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
  selDiv.style.color = "#00307B";
	selDiv.style.fontWeight = "Bold";
}
function deseleziona(id) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
		selDiv.style.color = "#000000";
		selDiv.style.fontWeight = "Normal";
}

function changeClass(id,CSSclass) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
  selDiv.style.className = CSSclass;
	//selDiv.style.fontWeight = "Bold";
	if (document.searchform.parole.value == "Inserite i termini di ricerca...") {
// statements
document.searchform.parole.value = "";
}
}
function resetClass(id,CSSclass) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
  selDiv.style.className = CSSclass;
//		selDiv.style.fontWeight = "Normal";
	if (document.searchform.parole.value == "") {
// statements
document.searchform.parole.value = "Inserite i termini di ricerca...";
}
}

function getElemento(quale) {
var elemento;
if(document.getElementById)
elemento = document.getElementById(quale);
else
elemento = document.all[quale];
return elemento;
}

function popSendMail(aux) { 
larg=640; 
alt=480; 
toptop=(screen.height/2)-(alt/2)
leftleft=(screen.width/2)-(larg/2);
url='email_newuser.asp?id='+parseInt(aux);
searchWin = window. open(url,'sendmailwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=no,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 
//
function controllaLogin(){
missinginfo="";
missinginfoheader="Non avete inserito i seguenti dati:\n\r"
if (document.loginform.nome_utente.value == "") {
missinginfo += "\nNome utente";
}
if (document.loginform.password_utente.value == "") {
missinginfo += "\nPassword";
}
if (missinginfo != "") {
alert(missinginfoheader+missinginfo);
return false
} else {
return true
} 
 }

function lostPwd() { 
larg=640; 
alt=200; 
toptop=parseInt((screen.height/2)-(alt/2));
leftleft=parseInt((screen.width/2)-(larg/2)); 
searchWin = window. open('/lostpwd.htm','pwdwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=no,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function checkPwdMail()  {
if ((document.lost.email.value == "")||(document.lost.email.value.indexOf('@') == -1)||(document.lost.email.value.indexOf('.') == -1)) {
alert('Indirizzo di e-mail non valido!');
} else {
stringa="/lostp";
stringa+="wd2.asp";
document.lost.action=stringa;
document.lost.submit();
} 
} 

function popReqSendMail() { 
larg=640; 
alt=480; 
toptop=(screen.height/2)-(alt/2)
leftleft=(screen.width/2)-(larg/2);
searchWin = window.open('about:blank','reqMail','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=no,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 


function confermaInvio(cons) {
var stringa = '\n\rVerrā inviata questa richiesta di contatto al Consorziato:\n\r';
stringa+=cons+'\n\r A mezzo e-mail automatica... Procedere con l\'operazione?';
if (confirm(stringa)) {
 return true
} else {
	alert('Azione annullata!')
return false
} 
} 

function ChiudieRicarica() { 
parent.opener.location.reload();
self.close();
} 

function ChiudieVaiVia() { 
parent.opener.location.href='/default.asp';
self.close();
} 

function doUpdate(nomeForm) { 
var qualeForm=getElemento(nomeForm);
qualeForm.submit();
} 

/*
function confermaInvio(cons) {
strAct="ema";
strAct+="il_re";
strAct+="quest.asp"
var stringa = '\n\rInviare questa richiesta al consorziato:\n\r';
stringa+=cons+'?\n\r';
document.reqForm.action = strAct;
if (confirm(stringa)) {
popReqSendMail();
 return true
} else {
	alert('Azione annullata!')
return false
} 
} 
*/

/***********************************************
* ToolTip Original Script by DynamicDrive
* Customized by: andrea.bettoni@ideauptorino.it
***********************************************/

var offsetfromcursorX=12 // x offset of tooltip
var offsetfromcursorY=10 // y offset of tooltip
var offsetdivfrompointerX=10 // x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 // y offset of tooltip DIV relative to pointer image. 
// Tip: Set it to (height_of_pointer_image-1).
document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="/images/tooltip.gif">') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
if (pointerobj) pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip


