/*
Funzioni di utilita' varia. 
*/


//Reloads the window if Nav4 resized
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


// MX function - mouseover events
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.01
  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 && d.getElementById) x=d.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];}
}



/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	Written by Bugimus 
	Copyright © 1998-2001 Bugimus, all rights reserved.
	You may use this code for non-commercial use provided you leave this comment block intact
	or credit me in your code.  
	A link back to Bugimus' page would be much appreciated but not required.  
	http://bugimus.com/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */

function showPic( imgName, imgCaption, imgWidth, imgHeight, textColor, bgColor ) {
if(textColor=="")textColor="#FFFFFF"
if(bgColor=="")bgColor="#111111"
if(imgWidth<=100)imgWidth=900
if(imgHeight<=100)imgHeight=100
winHeight=imgHeight+20;
w = window.open('','Demo','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,copyhistory=no,width='+imgWidth+',height='+winHeight);
w.document.write( "<html><head><title>OfficinaZEROSEI - "+imgCaption+"</title>" );
w.document.write( "<STYLE TYPE='text/css'>" );
w.document.write( "A {font-family: verdana; font-size: 10px; color: "+textColor+"; text-decoration : none;}" );
w.document.write( "A:Visited {font-family: verdana;font-size: 10px; color: "+textColor+"; }" );
w.document.write( "A:Active { font-family: verdana; font-size: 10px; color: "+textColor+"; }" );
w.document.write( "A:Hover { font-family: verdana; font-size: 10px; color: "+textColor+"; }" );
w.document.write( "IMG {border-color : "+textColor+";}" );
w.document.write( "BODY { font-family: verdana; font-size : 10px; font-weight: normal; color : "+textColor+"; background-color : "+bgColor+"; }" );
w.document.write( "</STYLE>\n" );
w.document.write( "<script language='javascript'>\n");
w.document.write( "IE5=NN4=NN6=false\n");
w.document.write( "if(document.all)IE5=true\n");
w.document.write( "else if(document.getElementById)NN6=true\n");
w.document.write( "else if(document.layers)NN4=true\n");
w.document.write( "function autoSize() {\n");
w.document.write( "if(IE5) self.resizeTo(document.images[0].width+10,document.images[0].height+31+30)\n");
w.document.write( "else if(NN6) self.sizeToContent()\n");
w.document.write( "else top.window.resizeTo(document.images[0].width,document.images[0].height+30)\n");
w.document.write( "self.focus()\n");
w.document.write( "}\n");
w.document.write( "</script>\n");
w.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad=" );
w.document.write( "'javascript:autoSize();'>" );
w.document.write( "<table cellpadding=0 cellspacing=0 border=0><tr><td colspan=3><img src='"+imgName+"' border=0 alt='"+imgCaption+"'></td></tr>" );
w.document.write( "<tr><td align='left'>&nbsp;&nbsp;<a>&copy; OfficinaZEROSEI</a></td>" );
w.document.write( "<td align='center'><a></a></td>" );
w.document.write( "<td align='right'><a href='javascript:top.window.close();'>Chiudi la finestra</a>&nbsp;&nbsp;</td></tr>" );
w.document.write( "</table></body></html>" );
w.document.close();
}


/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
var bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
// Fine funzione Ajax per caricamento dinamico del contenuto


//Popup window: <3 www.save-the-gummy-bears.com
function popup(name,width,height)
{
var popup = window.open("","Images","width=" + width + ",height=" + height + ",toolbar=0, status=0, menubar=0, resizable=0, scrollbars=no, directories=0, dependent=yes");
popup.resizeTo(width,height);
popup.document.open();
popup.document.write("<html><title>Officinazerosei</title><body bgcolor='#FFFFFF' bottommargin=0 rightmargin=0 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><table width='100%' height='100%' border=0 cellspacing=0 cellpadding=0><tr><td align='center' valign='middle'><a href='javascript:self.close();'><img src='" + name + " 'border=0 alt='Clicca dove vuoi per chiudere la finestra.'></a></td></tr></table></body></html>");
popup.document.close();
popup.moveTo((screen.width-width)/2, (screen.height-height)/2); 
popup.focus()
}

//Funzione antispam, by Dubtastic. Il nome di funzione e' case sensitive
//Uso: <a href="javascript:noSpam('contact','yourdomainname.com')">E-mail</a>
function noSpam(user,domain) {
 locationstring = "mailto:" + user + "@" + domain;
 window.location = locationstring;
 }

//Apre una finestra popup
function loadWindow(file,width,height) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(file, '" + id + "', 'width=" + width + ",height=" + height + ",toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0');");
}

//Funzione per il blending delle voci nel menu di navigazione
function lite(obj) {
if(document.all&&!window.opera) {
obj.filters.blendTrans.apply(); 
obj.filters.blendTrans.play(); 
} 
}

//Funzione per l'accessio clienti
function clienti(form) {
user = document.clienti.utente.value;
locationstring = "http://www.officinazerosei.it/clienti/" + user ;
window.location = locationstring;
}

