var pvm = null; //preview menu
function init(){
	pvm = document.getElementById("previewmenu");
	pvm.currentPos = -198;
	pvm.moveTimer = null;
	pvm.move = function(from,to){
		var direction = (from - to)/ Math.abs(from - to);
		var increments = direction*15
		
		if(to == this.currentPos)
		{
			clearInterval(this.moveTimer);	
			return;
		}
		if(direction > 0)
		{
			if(this.currentPos- increments > to)
			{
				this.currentPos = this.currentPos - increments;				
			}
			else
			{
				this.currentPos = to;
				clearInterval(this.moveTimer);					
			}
		}
		else			
		{
			if(this.currentPos- increments < to)
			{
				this.currentPos = this.currentPos - increments;				
			}
			else
			{
				this.currentPos = to;
				clearInterval(this.moveTimer);					
			}
			
		}			
		this.style.top = this.currentPos + 'px';
		
	}
	pvm.hide = function(){
		clearTimeout(this.moveTimer);
		this.moveTimer = setInterval('pvm.move(-198,-110)',100);
		//this.style.top = '-110px';
	}
	pvm.show = function(){
		clearTimeout(this.moveTimer);
		this.moveTimer = setInterval('pvm.move(-110,-198)',100);
		//this.style.top = '-198px';
	}
	pvm.onmouseout = function(){
		this.hideTimer =setTimeout('pvm.hide();',300);	
	}
	pvm.onmouseover = function(){
		clearTimeout(this.hideTimer);
	}		
	pvm.hideTimer = null;
	var pvmTab = document.getElementById("titletab");
	pvmTab.onmouseover = function(){
		pvm.show();
		clearTimeout(pvm.hideTimer);
	}
	
	//pvm.hideTimer = setTimeout('pvm.show();',500);	
	pvm.hideTimer = setTimeout('pvm.hide();',2100);	
}
function getItem(id){
	vmiGlob.controlling.controller.pauseAllLoading();

	vmiGlob.controlling.controller._currentDOM = null;
	document.getElementById("demo").innerHTML = '<img id="'+id+'" style="z-index:1; position:relative; top:0px; left:0px" rotating ="duration:1" zooming="enable:1" src="images/Preview/'+id+'.jpg" border="0" />'
	var HTMLElement = document.getElementById(id);
	HTMLElement.vmi= null;

	vmiGlob.modeling.initDOM(HTMLElement,['rotating']);
}