//
function ViewWindow (titolo, listacategorie, listafotografie, nfoto, x, y, direzione, categorie) {
	var obj = new InitVscroll ('divSlide', titolo,x, y, direzione, categorie);
	if (categorie) obj.cScroll.Write(listacategorie);
	obj.vScroll.Write(listafotografie);
	obj.Show();
	return obj;
}
// viewer  delle foto H e V
function BuildVscroll (titolo, MyLayer, categorie, direzione) { // true=horiz- false= vert
var oggetto = MyLayer + "Object";

var	testo='<div id="'+MyLayer+'Drag" onmousedown="InitializeMove(\''+MyLayer+'\')" style="top: 0px; left: 0px; width: '+((direzione==1)? 520 : 215)+'px; height: 30px; visibility: visible">'+TxTHeader(titolo, oggetto, false, categorie)+'</div>'+
'<div id="'+MyLayer+'Comandi" style="position: absolute; top: 30px; left: 0px; width: '+((direzione==1)? 520 : 215)+'px; height: '+((direzione==1)? 120 : ((categorie)? 400 : 310 ))+'px; visibility: visible">'+TxTBody('')+TxTFooter('')+'</div>';

var	orizzontale = ((categorie)? '<div id="'+MyLayer+'CatCont" style="background-color: #000; position: absolute; z-index: 3; top: 32px; left: 3px; width: 140px; height: 110px; visibility: visible; clip: rect(0px 140px 110px 0px); overflow : auto">'+
'	<div id="'+MyLayer+'CatName" style=" position: absolute; z-index: 3; top: 0px; left: 0px; width: 120px; height: 20px; visibility: visible"></div>'+
'</div>' : '' )+
'<div id="'+MyLayer+'PhotoCont" style="background-color: #000; position: absolute; z-index: 3; top:32px; left: '+((categorie)? 145 : 5)+'px; width: '+((categorie)? 370 : 510)+'px; height: 110px; visibility: visible; clip: rect(0px '+((categorie)? 370 : 510)+'px 120px 0px); overflow : auto">'+
'	<div id="'+MyLayer+'Photo" style=" position: absolute; z-index: 3; top: 10px; left: 0px; width: 350px; height:  20px; visibility: visible"></div>'+
'</div>';

var	verticale = ((categorie)?''+
'<div id="'+MyLayer+'CatCont" style="background-color: #000; position: absolute; z-index: 3; top: 32px; left: 10px; width: 200px; height: 80px; visibility: visible; clip: rect(0px 200px 80px 0px); overflow : auto">'+
'		<div id="'+MyLayer+'CatName" style=" position: absolute; z-index: 3; top: 0px; left: 0px; width: 180px; height: 20px; visibility: visible"></div>'+
'</div>' : '')+
'<div id="'+MyLayer+'PhotoCont" style="background-color: #000; position: absolute; z-index: 3; top: '+((categorie)? 130 : 35 )+'px; left: 10px; width: 200px; height: 300px; visibility: visible; clip: rect(0px 200px 300px 0px); overflow : auto">'+
'	<div id="'+MyLayer+'Photo" style=" position: absolute; z-index: 3; top: 0px; left: 30px; width: 130px; height: 20px; visibility: visible"></div>'+
'</div>';
return (testo+((direzione==1)? orizzontale :  verticale ));
}
function InitVscroll (MyLayer, titolo, x, y, direzione, menu) {	
    	this.nlay = (!MyLayer) ? 'div'+Math.round(50000*Math.random()): MyLayer ;
    	this.obj = this.nlay + "Object";    	
    	CreateDiv(this.nlay, x, y, 120, 30);
    	
	this.TTCont = new makeObj(this.nlay);		
	this.TTCont.Write(BuildVscroll (titolo,this.nlay, menu, direzione));	
	this.mCont = new makeObj(this.nlay+'Drag');
	this.xCont = new makeObj(this.nlay+'Comandi');		
	if (menu){ 
		this.cCont = new makeObj(this.nlay+'CatCont');
		this.cScroll = new makeObj(this.nlay+'CatName');
	}	
	this.vCont = new makeObj(this.nlay+'PhotoCont');
	this.vScroll = new makeObj(this.nlay+'Photo');

	this.Show =ShowVScroll;
	this.Kill =KillVScroll;
	this.Hide=HideVScroll
			
	this.TTCont.moveIt(x, y);	 	
   	eval(this.obj + "=this");
    return this
}
// controllo visibilita' viewer
function KillVScroll(categoria){
	this.Hide(categoria);
	this.mCont.show(false); 
	this.TTCont.show(false); 
	noScroll() 
}
function HideVScroll(categoria){
	this.vScroll.show(false);
	this.vCont.show(false);
	if (categoria) {
		this.cScroll.show(false);
		this.cCont.show(false);
	}
	this.xCont.show(false); 
	noScroll() 
}
function ShowVScroll(categoria){
	this.TTCont.show(true);
	this.mCont.show(true);
	this.xCont.show(true);
	if (categoria) {
		this.cCont.show(true);
		this.cScroll.show(true);
	}
	this.vCont.show(true);
	this.vScroll.show(true); 
	if (bw.mac || bw.ns) this.TTCont.scrollHeight += 130;
}