// JavaScript Document
// Scripting by: andrea.bettoni@ideaup.com



function addbookmark()
{
bookmarkurl="http://www.esseci-antincendio.it/"
bookmarktitle="ESSECI S.r.l. - Safety and Anti-Fire Systems"
if (document.all) window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function popImg(quale,forma) { 
quale = quale.toLowerCase();
var ImgSrc = quale.replace('_s.jpg','.jpg')
var imgToPop = "zoom.asp?src=" + ImgSrc  ;
// switch statement
switch(forma) {
	case 0:
		return false
	break;
	case "A": 
		larg=300; 
		alt=400; 
	break;
	case "X":
		larg=400; 
		alt=600; 
	break;
	case "P":
		larg=780; 
		alt=400; 
	break;
	default:
		larg=400; 
		alt=300; 
	break;
					}
toptop=(screen.height/2)-(alt/2)
leftleft=(screen.width/2)-(larg/2); 
window. open(imgToPop,'imgpopwindow','top='+toptop+',left='+leftleft+',scrollbars=no,resizable=no,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function controlla() { 
//var x = document.images[0].src;
var x = document.images.zoompic.height;
if (x <= 50) {  
//alert(x);
document.images[0].src = "../jpg/blank.jpg"
}
} 

function popISO() { 
var UrlToOpen = "/iso_eng.htm";
larg=505; 
alt=565; 
toptop=20; //(screen.height/2)-(alt/2)
leftleft=(screen.width/2)-(larg/2); 
searchWin = window. open(UrlToOpen,'formwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function popModulo(param) { 
var UrlToOpen = "/FRA/modulo_fra.asp?s=" + param;
larg=505; 
alt=580; 
toptop=20; //(screen.height/2)-(alt/2)
leftleft=(screen.width/2)-(larg/2); 
searchWin = window. open(UrlToOpen,'isowindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function popModuloEng(param) { 
var UrlToOpen = "/FRA/modulo_fra.asp?s=" + param;
larg=505; 
alt=580; 
toptop=20; //(screen.height/2)-(alt/2)
leftleft=(screen.width/2)-(larg/2); 
searchWin = window. open(UrlToOpen,'isowindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function mappaZoom(param) { 
var UrlToOpen = "/FRA/mappa_fra.htm";
larg=600; 
alt=500; 
toptop=(screen.height/2)-(alt/2)
leftleft=(screen.width/2)-(larg/2); 
searchWin = window. open(UrlToOpen,'formwindow','top='+toptop+',left='+leftleft+',scrollbars=no,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function popForm() { 
larg=480; 
alt=350; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('','popup','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=no,status=no,location=no,toolbar=no'); 
} 

function popNewsletter() { 
larg=480; 
alt=350; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('','newspop','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=no,status=no,location=no,toolbar=no'); 
} 


function popFAQ() { 
larg=640; 
alt=480; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('/FAQ/index.asp','faqWin','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=YES,status=no,location=no,toolbar=no'); 
} 


function disclaimer() { 
larg=640; 
alt=480; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('/FRA/disclaimer_fra.htm','disclaimerWin','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=YES,status=no,location=no,toolbar=no'); 
} 

function privacy() { 
larg=640; 
alt=480; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('/FRA/disclaimer_fra.htm#PRIVACY','disclaimerWin','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=YES,status=no,location=no,toolbar=no'); 
} 

function regolamento() { 
larg=640; 
alt=480; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('/FRA/disclaimer_fra.htm#REG','disclaimerWin','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=YES,status=no,location=no,toolbar=no'); 
} 

function popFormContenuti() { 
larg=480; 
alt=380; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('','popup','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=no,status=no,location=no,toolbar=no'); 
} 

function validaMailContenuti(aux) {
	var Errmsg = "";
	Errmsg += "\n\r   Cet e-mail semble être invalide...   \n\r";
if ((document.form2.email.value == "") || (document.form2.email.value.indexOf('@') == -1) || (document.form2.email.value.indexOf('.') == -1)) {
alert(Errmsg);
return false ;
} else {  
popFormContenuti();
return true ;
}
}

function validaMail(aux) {
	var Errmsg = "";
	Errmsg += "\n\r   Cet e-mail semble être invalide...   \n\r";
if ((document.form2.email.value == "") || (document.form2.email.value.indexOf('@') == -1) || (document.form2.email.value.indexOf('.') == -1)) {
alert(Errmsg);
return false ;
} else {  
popForm();
return true ;
}
}

function validaNewsletter(aux) {
	var Errmsg = "";
	Errmsg += "\n\r   Cet e-mail semble être invalide...   \n\r";
if ((aux == "") || (aux.indexOf('@') == -1) || (aux.indexOf('.') == -1)) {
alert(Errmsg);
return false ;
} else {  
popNewsletter();
return true ;
}
}

	function checkLogin() {
if ((document.loginform.nome_utente.value == "")||(document.loginform.password_utente.value == "")) {
alert('Vous douvez inserer nom et mot de passe!');
return false
} else
{
return true
}
}

	function checkLoginEng() {
if ((document.loginform.nome_utente.value == "")||(document.loginform.password_utente.value == "")) {
alert('Vous douvez inserer nom et mot de passe!');
return false
} else
{
return true
}
}


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 maiuscola(str){
var strOut;
str = new String(str);
strOut = str.toUpperCase();
document.modulocomm.provincia.value = strOut;
}


function checkFields() {
missinginfo = "";

if (document.modulocomm.nomeazienda.value == "") {
missinginfo += "\n     -  Nome de entreprise";
}

//if (document.modulocomm.settore.value == "") {
//missinginfo += "\n     -  Settore merceologico";
//}

if (document.modulocomm.responsabile.value == "") {
missinginfo += "\n     -  Nom et prenom";
}

if (document.modulocomm.indirizzo.value == "") {
missinginfo += "\n     -  Addresse";
}

if (document.modulocomm.city.value == "") {
missinginfo += "\n     -  Cité";
}

if (document.modulocomm.provincia.value == "") {
missinginfo += "\n     -  State/Province";
}

if (document.modulocomm.cap.value == "") {
missinginfo += "\n     -  ZIP code";
}

if (document.modulocomm.telefono.value == "") {
missinginfo += "\n     -  Telephone";
}

if ((document.modulocomm.email.value == "") || (document.modulocomm.email.value.indexOf('@') == -1) || (document.modulocomm.email.value.indexOf('.') == -1)) {
missinginfo += "\n     -  E-mail";
}

if (document.modulocomm.dettaglio.value == "") {
missinginfo += "\n     -  Demande";
}

if (missinginfo != "") {

missinginfo2 = "Vous n'avez pas inséré le champ(s) obligatoire suivant:\n" ;

missinginfo2 += missinginfo ;
alert(missinginfo2);
return
}
else {
document.modulocomm.action="/FRA/SENDMAIL_FRA.ASP";
document.modulocomm.submit();
}
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function checkJS() { // verifica javascript attivo
document.modulocomm.flag.value = "js_ok";
}


/***********************************************
* 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="/img/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"
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


