//---- menu ------------
function qualeMenu(cont,myBtn){
	nodo=document.getElementById(cont);
	
	for(x=0;nodo.childNodes[x];x++){
		if(nodo.childNodes[x].nodeName == 'A'){
			btn=nodo.childNodes[x];
			btn.style.color="";
		}
	}
	myBtn.style.color="#f00";
}

var menus = new Array(
						new Array('mAzienda','home'),
						new Array('mProdotti','prodotti'),
						new Array('mMondoTata','mondoTata'),
						new Array('mFormazione','formazione'),
						new Array('mContatti','contatti'),
						new Array('mNews','news'),
						new Array('mFaq','faq')
					)
					
function topMenu(){
	nodo=document.getElementById('topMenu');

	for(i=0;i<menus.length;i++){
		menu=menus[i];
		
		var myA = document.createElement('a');
		myA.setAttribute('href', '#');
		myA.setAttribute('onclick', "loadData('"+menu[1]+"','mainContent');");
		var myImg = document.createElement('img');
		myImg.setAttribute('id', 'tm'+i);
		myImg.setAttribute('src', 'gui/images/'+ menu[0] + '.gif');
		myImg.setAttribute('onmouseover', "over('tm"+i+"')");
		myImg.setAttribute('onmouseout', "out('tm"+i+"')");
		myImg.setAttribute('border', 0);
		myA.appendChild(myImg);
		nodo.appendChild(myA);
	}
}
function selTopMenu(sel){
// 	selTopMenu('tm"+i+"')
	nodo=document.getElementById(sel);
	new_src=srcName(nodo.src);
	nodo.src='gui/images/' + new_src + '_o.gif';
}

function over(img){
	nodo=document.getElementById(img);
	new_src=srcName(nodo.src);
	nodo.src='gui/images/' + new_src + '_o.gif';
}

function out(img){
	nodo=document.getElementById(img);
	new_src=srcName(nodo.src);
	new_src=new_src.substr(0,new_src.length-2)
	nodo.src='gui/images/' + new_src + '.gif';
}

function topClick(sel){
	tm=document.getElementById('topMenu');
	img=sel.src;
	alert(img)
}

function srcName(nome){
	x = nome.lastIndexOf("/")
	nome = nome.substr(x+1)
	x = nome.lastIndexOf(".gif")
// 	alert( nome.substr(0, x) )
	return nome.substr(0, x);
}

function selLinea(myBtn,liv){
   //alert(myBtn)
	if( typeof myBtn  == 'object' )
		myBtn=myBtn;
	else
		var myBtn=$(myBtn);

// 	alert(myBtn.id + ' | top: ' + myBtn.offsetTop + ' | src: '+ myBtn.src + ' | width: '+ myBtn.width)
// 	alert(myBtn.id + ' | top: ' + myBtn.posTop)
	var oDiv=$('linea'+liv)
	if(oDiv)
		oDiv.parentNode.removeChild(oDiv)
	l=147;
	var oDiv=document.createElement('DIV');
	oDiv.style.cssText='position:absolute;top:'+ (myBtn.offsetTop + 5) +'px;left:'+ (myBtn.width + 26) +'px;width:'+ (l-myBtn.width-24) +'px;border-top:solid 1px #C7DDE7'
	oDiv.id='linea'+liv;
// 	oDiv.innerHTML='&nbsp;';
	myBtn.parentNode.appendChild(oDiv)

}


function loaded(pag){
// // 	alert(pag)
	if(pag == 'list01' || pag == 'list02')
		if(sel>0){
			var extra=''
			if(t != '')
				extra='&t='+t
				
			loadData('tipo&rb='+ sel + extra,'tipo');
			var pr=MM_findObj('prodotti');
			pr.src= 'gui/html/blank_prod1.html';
// 			alert('a'+sel)
			selLinea('a'+sel,1)
			
		}
		
}

// begin absolutely positioned scrollable area object scripts 
/*                       
Extension developed by David G. Miles (www.z3roadster.net/dreamweaver)
Original Scrollable Area code developed by Thomas Brattli 
To add more shock to your site, visit www.DHTML Shock.com
*/

function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
    return this 
} 
bw=new verifyCompatibleBrowser() 
 
 
var speed=50 
 
var loop, timer 
 
function Container(obj){
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
	return this;
}

function ConstructObject(obj,container){ 
// 	nest=(!nest) ? '':'document.'+nest+'.' 
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
	this.up=MoveAreaUp;
	this.down=MoveAreaDown; 
	this.MoveArea=MoveArea; this.x; this.y; 
	this.obj = obj + "Object" 
	eval(this.obj + "=this")
	this.container=container 
	return this 
} 
function MoveArea(x,y){ 
    this.x=x;this.y=y 
    this.css.left=this.x
    this.css.top=this.y 
} 
 
function MoveAreaDown(move){ 
	if(this.y>-this.scrollHeight+this.container.clipHeight-30){ 
    this.MoveArea(0,this.y-move) 
    if(loop) setTimeout(this.obj+".down("+move+")",speed) 
	} 
} 
function MoveAreaUp(move){ 
	if(this.y<0){ 
    this.MoveArea(0,this.y-move) 
    if(loop) setTimeout(this.obj+".up("+move+")",speed) 
	} 
} 
 
function PerformScroll(speed){
	if(initialised){ 
		loop=true; 
		if(speed>0) 
			objScroller.down(speed) 
		else 
			objScroller.up(speed) 
	} 
} 
 
function CeaseScroll(){ 
    loop=false 
    if(timer) clearTimeout(timer) 
} 
var initialised; 
function InitialiseScrollableArea(n){ 
	var objContainer=new ConstructObject('divContainer'+n) 
	var  objScroller=new ConstructObject('divContent'+n,'divContainer'+n) 
	objScroller.MoveArea(0,0) 
	objContainer.css.visibility='visible' 
	var initialised=true;
     
} 
// end absolutely positioned scrollable area object scripts 

function CaricamentoImg(imgPath, lang){
//FORNI
    JeForni=new Image
    JeForni.src="../"+imgPath+"/"+lang+"/eForni.gif"
    
    JeForni_o=new Image
    JeForni_o.src="../"+imgPath+"/"+lang+"/eForni_o.gif"
        
    JiForni=new Image
    JiForni.src="../"+imgPath+"/iForni.jpg"

    JiForni_o=new Image
    JiForni_o.src="../"+imgPath+"/iForni_o.jpg"    

//PIANI COTTURA
    JePianiCottura=new Image
    JePianiCottura.src="../"+imgPath+"/"+lang+"/ePianiCottura.gif"
    
    JePianiCottura_o=new Image
    JePianiCottura_o.src="../"+imgPath+"/"+lang+"/ePianiCottura_o.gif"
        
    JiPianiCottura=new Image
    JiPianiCottura.src="../"+imgPath+"/iPianiCottura.jpg"

    JiPianiCottura_o=new Image
    JiPianiCottura_o.src="../"+imgPath+"/iPianiCottura_o.jpg"

//CUCINE
    JeCucine=new Image
    JeCucine.src="../"+imgPath+"/"+lang+"/eCucine.gif"
    
    JeCucine_o=new Image
    JeCucine_o.src="../"+imgPath+"/"+lang+"/eCucine_o.gif"
        
    JiCucine=new Image
    JiCucine.src="../"+imgPath+"/iCucine.jpg"

    JiCucine_o=new Image
    JiCucine_o.src="../"+imgPath+"/iCucine_o.jpg"         
   
   //LAVELLI
    JeLavelli=new Image
    JeLavelli.src="../"+imgPath+"/"+lang+"/eLavelli.gif"
    
    JeLavelli_o=new Image
    JeLavelli_o.src="../"+imgPath+"/"+lang+"/eLavelli_o.gif"
        
    JiLavelli=new Image
    JiLavelli.src="../"+imgPath+"/iLavelli.jpg"

    JiLavelli_o=new Image
    JiLavelli_o.src="../"+imgPath+"/iLavelli_o.jpg"
    
    //MONOBLOCCHI
    JeMonoblocchi=new Image
    JeMonoblocchi.src="../"+imgPath+"/"+lang+"/eMonoblocchi.gif"
    
    JeMonoblocchi_o=new Image
    JeMonoblocchi_o.src="../"+imgPath+"/"+lang+"/eMonoblocchi_o.gif"
        
    JiMonoblocchi=new Image
    JiMonoblocchi.src="../"+imgPath+"/iMonoblocchi.jpg"

    JiMonoblocchi_o=new Image
    JiMonoblocchi_o.src="../"+imgPath+"/iMonoblocchi_o.jpg"
    
    //PIANI ATTREZZATI
    JePianiattrezzati=new Image
    JePianiattrezzati.src="../"+imgPath+"/"+lang+"/ePianiattrezzati.gif"
    
    JePianiattrezzati_o=new Image
    JePianiattrezzati_o.src="../"+imgPath+"/"+lang+"/ePianiattrezzati_o.gif"
        
    JiPianiattrezzati=new Image
    JiPianiattrezzati.src="../"+imgPath+"/iPianiattrezzati.jpg"

    JiPianiattrezzati_o=new Image
    JiPianiattrezzati_o.src="../"+imgPath+"/iPianiattrezzati_o.jpg"
    
    //RUBINETTI
    JeRubinetti=new Image
    JeRubinetti.src="../"+imgPath+"/"+lang+"/eRubinetti.gif"
    
    JeRubinetti_o=new Image
    JeRubinetti_o.src="../"+imgPath+"/"+lang+"/eRubinetti_o.gif"
        
    JiRubinetti=new Image
    JiRubinetti.src="../"+imgPath+"/iRubinetti.jpg"

    JiRubinetti_o=new Image
    JiRubinetti_o.src="../"+imgPath+"/iRubinetti_o.jpg"
}

