/************************************
* Java Script written custom by:
* Andrea M. Bettoni per: IdeaUp Torin
MENU ON-OFF SCRIPTING START
*************************************/
var enablepersist="yes" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)

if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
ccollect[inc++]=alltags[i]
}
}

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
getElementbyClass("switchcontent")
if (enablepersist=="on" && typeof ccollect!="undefined"){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate
/************************************
MENU ON-OFF SCRIPTING END
*************************************/

/**********************************************
  Encrypt Email script
  ORIGINAL MADE BY: DYNAMIC DRIVE
***********************************************/
function doEmail() {
var emailarray5227= new Array(115,116,114,111,112,115,64,105,110,114,101,116,101,46,105,116)
var postemail5227=''
for (i=0;i<emailarray5227.length;i++)
postemail5227+=String.fromCharCode(emailarray5227[i])
document.write('<a href="mailto:'+postemail5227+'?subject=Information request from: www.strops.it">'+postemail5227+'</a>')
}
function doEmail2() {
var emailriddlerarray=[105,110,102,111,64,105,100,101,97,117,112,46,99,111,109]
var encryptedemail_id33='' //variable to contain encrypted email 
for (var i=0; i<emailriddlerarray.length; i++)
encryptedemail_id33+=String.fromCharCode(emailriddlerarray[i])
document.write('<a href="mailto:'+encryptedemail_id33+'?subject=Technical assistance needed on: WWW.STROPS.IT">'+encryptedemail_id33+'</a>');
}
/************************************
 FUNZIONI CUSTOM DI SERVIZIO
*************************************/

function lostPwd() { 
larg=600; 
alt=200; 
toptop=parseInt((screen.height/2)-(alt/2));
leftleft=parseInt((screen.width/2)-(larg/2)); 
searchWin = window. open('/english/lostpwd.htm','pwdwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=no,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function logOut() { 
larg=620; 
alt=200; 
toptop=parseInt((screen.height/2)-(alt/2));
leftleft=parseInt((screen.width/2)-(larg/2)); 
searchWin = window. open('/english/logout.asp','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('E-MAIL ADDRESS NOT VALID!');
} else {
stringa="/english/lostp";
stringa+="wd2.asp";
document.lost.action=stringa;
document.lost.submit();
} 
} 

function seleziona(id) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
  selDiv.style.color = "#008030";
//	selDiv.style.fontWeight = "Bold";
}
function deseleziona(id) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
		selDiv.style.color = "#000000";
//		selDiv.style.fontWeight = "Normal";
}

function checkLogin() {
if ((document.loginform.nome_utente.value != "")&&(document.loginform.password_utente.value != "")) {
var larg=750; 
var alt=parseInt(screen.height*0.8);//600;
var toptop=10;//(screen.height/2)-(alt/2);
var leftleft=(screen.width)-(larg); 
window.open('','listwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
document.loginform.action='/english/_checkuser.asp';
document.loginform.submit();
} else {
alert('You must insert a valid username and password!!');
document.loginform.nome_utente.value='';
document.loginform.password_utente.value='';
document.loginform.nome_utente.select();
return false
}
}

function checkPromoEng() {
if (document.promoform.password_strops.value != "") {
document.promoform.action="/english/promo_engine.asp"
document.promoform.submit();
} else {
alert('Please insert a valid password!');
document.promoform.password_strops.value='';
document.promoform.nome_strops.focus();
return false
}
}

/*
function popUp(aux) { 
var larg=800; 
var alt=parseInt(screen.height-90);//600; 
var url = new String(aux);
if ((url == "undefined")||(url == "")||(url == "0")) url = "errore.htm";
var toptop=10;//(screen.height/2)-(alt/2);
var leftleft=(screen.width/2)-(larg/2); 
window.open(url,'catwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 
*/

function popcatalogo(){
window.open('/popcatalogo01.htm','catwindow','width=790,height=580,scrollbars=yes,resizable=yes');
}

function popCert(i){
i==1?url="/cert1.htm":url="/cert2.htm";
var larg=490; 
var alt=700; 
var toptop=(screen.height/2)-(alt/2);
var leftleft=(screen.width/2)-(larg/2); 
window.open(url,'certwindow','top='+toptop+',left='+leftleft+',scrollbars=no,resizable=no,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
}

function chiudiPagina() { 
top.window.close();
} 

function popUp(aux) { 
var larg=800; 
var alt=parseInt(screen.height*0.8);//600;
var url = new String(aux);
if ((url == "undefined")||(url == "")||(url == "0")) url = "errore.htm";
var toptop=10;//(screen.height/2)-(alt/2);
var leftleft=(screen.width/2)-(larg/2); 
window.open(url,'catwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 


function popCat(x) { 
var aux=new String(x);
if ((x=="undefined")||(aux=="0")||(aux=="000")||(aux==""))  { 
url = "/english/errore.htm";
 } else { 
url = "/english/_engine.asp?id="+aux+"&t=c";
 } 
var larg=750; 
var alt=parseInt(screen.height*0.8);//parseInt(screen.height-90);//600;
var toptop=10;//(screen.height/2)-(alt/2);
var leftleft=10; 
window.open(url,'catwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function popX() { 
url = "/english/errore.htm";
var larg=750; 
var alt=parseInt(screen.height*0.8);//parseInt(screen.height-90);//600;
var toptop=10;//(screen.height/2)-(alt/2);
var leftleft=10; 
window.open(url,'catwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no');
} 


function popX(x) { 
var aux=new String(x); 
if ((x=="undefined")||(x=="0")||(!x)||(x=="")) x=0
var url = "/english/_engine.asp?id="+aux+"&t=x";
var larg=750; 
var alt=parseInt(screen.height*0.8);//600;
var toptop=10;//(screen.height/2)-(alt/2);
var leftleft=10; 
window.open(url,'catwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function popList(x) { 
var aux=new String(x);
if ((aux=="undefined")||(aux=="0")||(aux=="000")||(aux==""))  { 
url = "/english/errore_eng.htm";
 } else { 
url = "/english/_engine.asp?id="+aux+"&t=l";
 } 
var larg=750; 
var alt=parseInt(screen.height*0.8);//600;
var toptop=10;//(screen.height/2)-(alt/2);
var leftleft=(screen.width)-(larg); 
window.open(url,'listwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 


function popY(x) { 
var aux=new String(x);
var url = "/english_engine_eng.asp?id="+aux+"&t=y";
var larg=750; 
var alt=parseInt(screen.height*0.8);//600;
var toptop=10;//(screen.height/2)-(alt/2);
var leftleft=(screen.width)-(larg); 
window.open(url,'listwindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function popNovita(aux) { 
var larg=770;
var alt=550;
var url = "/english/errore_eng.htm";
if (aux==1) url = "/english/novita01.htm";
if (aux==2) url = "/english/novita02.htm";
var toptop=10;//(screen.height/2)-(alt/2);
var leftleft=(screen.width/2)-(larg/2); 
searchWin = window. open(url,'novitawindow','top='+toptop+',left='+leftleft+',scrollbars=yes,resizable=yes,width='+larg+',height='+alt+',status=no,location=no,toolbar=no'); 
} 

function popForm() { 
larg=495; 
alt=535; 
toptop=20;//(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('/form/modulo_eng.asp','popup','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=yes,status=no,location=no,toolbar=no'); 
} 

function popModulo() { 
larg=495; 
alt=535; 
toptop=20;//(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('/form/modulo_eng.asp','popup','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('/form/disclaimer.htm','disclaimerWin','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=YES,status=no,location=no,toolbar=no'); 
} 

function registrazione() { 
var larg=750; 
var alt=parseInt(screen.height*0.8);//600;
var toptop=10;//(screen.height/2)-(alt/2);
var leftleft=(screen.width)-(larg); 
window.open('/english/registrazione.asp','listwindow','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=YES,status=no,location=no,toolbar=no'); 
} 


function condizioni() { 
larg=640; 
alt=480; 
toptop=(screen.height/2)-(alt/2); 
leftleft=(screen.width/2)-(larg/2); 
window.open('/condizioni_vendita.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('/form/disclaimer.htm','disclaimerWin','top='+toptop+',left='+leftleft+',width='+larg+',height='+alt+',scrollbars=YES,status=no,location=no,toolbar=no'); 
} 

function seleziona(id) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
  selDiv.style.color = "#008000";
	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 = "";
strAct="";
strAct+="/form/SEN";
strAct+="DMAI";
strAct+="L_ENG.ASP";

if (document.modulocomm.nomeazienda.value == "") {
missinginfo += "\n     -  Enterprise Name";
}

//if (document.modulocomm.settore.value == "") {
//missinginfo += "\n     -  Settore merceologico";
//}

if (document.modulocomm.responsabile.value == "") {
missinginfo += "\n     -  Contact Name";
}

if (document.modulocomm.indirizzo.value == "") {
missinginfo += "\n     -  Address";
}

if (document.modulocomm.city.value == "") {
missinginfo += "\n     -  City";
}

if (document.modulocomm.provincia.value == "") {
missinginfo += "\n     -  State/Province";
}

if (document.modulocomm.cap.value == "") {
missinginfo += "\n     -  ZIP";
}

if (document.modulocomm.telefono.value == "") {
missinginfo += "\n     -  Phone";
}

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     -  Request detail";
}

if (missinginfo != "") {

missinginfo2 = "You have not inserted the following mandatory field(s):\n" ;

missinginfo2 += missinginfo ;
alert(missinginfo2);
return
}
else {
document.modulocomm.action=strAct;
document.modulocomm.submit();
}
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function checkJS() { // verifica javascript attivo
document.modulocomm.flag.value = "js_ok";
}


/***********************************************
* Funzioni standard MacroMedia ottimizzate da:
* Andrea M. Bettoni per: IdeaUp Torino
************************************************/

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

MM_preloadImages('/img/loading.gif','js/indicator.gif','/graphics/navbar/01-chisiamo_eng_over.png','/graphics/navbar/02-dovesiamo_eng_over.png','/graphics/navbar/03-cataloghi_eng_over.png','/graphics/navbar/04-novita_eng_over.png','/graphics/navbar/05-promozioni_eng_over.png','/graphics/navbar/06-ecommerce_eng_over.png','/graphics/navbar/07-contatti_eng_over.png','/graphics/flags/btn_ita_over.gif','/graphics/flags/btn_eng_over.gif','/graphics/flags/btn_go_fra_over.gif')

/**********************************************************
* ToolTip Script by DynamicDrive optimized by: A.M. Bettoni
***********************************************************/

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="style/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


