 /***************************************************************************
 *                            mimeEffect.js
 *                            -------------------
 *   version              : 0.5.4
 *   copyright            : GPL v2
 *   email                : info@mrmime.net
 *   author               : Emiliano Matarazzo
 *
 ***************************************************************************
 *                                 Comments
 *                            -------------------
 *  Javascript Graphics Effects Library
 *
 ***************************************************************************/

	var IE = document.all ? true : false;
	/* GENERIC FUNCTIONS ***************************************************/

	function mimeCleanChildren (obj) {
		var l = obj.childNodes.length;
		var realChildren = new Array();
		for (var i=0;i<l;i++){
			var child = obj.childNodes[i];
			if (child.nodeType == 3){
			   obj.removeChild(child);
			   l--;
		    }
		}
		return;
	}
	
	
	function getCurrentStyle (obj) {
	    if (obj.currentStyle != null)
	        return obj.currentStyle;
	    if (window.getComputedStyle != null)
	        return window.getComputedStyle(obj, null);
	    return null;
	}
	
	
	function mimeSetOpacityId (id,opacity) {
		var obj = document.getElementById(id);
		mimeSetOpacity(obj,opacity);
	}
	
	
	function mimeSetOpacity (obj,opacity) {
	    obj.style.opacity = (opacity / 100);
	    obj.MozOpacity = (opacity / 100);
	    obj.KhtmlOpacity = (opacity / 100);
	    obj.style.filter = "alpha(opacity=" + opacity + ")";
	    if (opacity == 100) obj.style.zIndex = 10;
	    if (opacity == 0) obj.style.zIndex = 0;
	}
	
	
	function mimeGetOpacity (id) {
		var obj = document.getElementById(id);
		var opa = null;
		if (IE){ 
			opa = obj.style.filter;
			opa = opa.match ('[0-9]+');			
			if (opa == null) 
				opa = 1;
			else
				opa = opa[0];
			return (opa == 100) ? opa/100 : opa;
		}
		opa = (obj.style.opacity == "") ? 1 : obj.style.opacity;		
		opa = opa;
		return opa; 
	}
		
				
	/* FADE TRANSICTIONS ***************************************************/
		
	function mimeMakeTransactions (id,transactiontime,keeptime) {			
		var timestep = transactiontime / 100;	
		mimeInizializeFade(id);		
		mimeDoTransaction (id,0,98,timestep,keeptime);									
	}
	
	
	function mimeDoTransaction (id,i,opa,tstep,keeptime) {
		var obj = document.getElementById(id);
		mimeCleanChildren (obj);
		var children = obj.childNodes;	
		var childNumber = obj.childNodes.length;
		var next = (i+1)%childNumber;			
		mimeSetOpacity(obj.childNodes[i],opa);
		mimeSetOpacity(obj.childNodes[next],(100-opa));			
		if (opa <= 0) {
			i = next;
			opa = 90;
			setTimeout("mimeDoTransaction('"+id+"',"+i+","+(opa-1)+","+tstep+","+keeptime+")",keeptime);
		}						
		else
			setTimeout("mimeDoTransaction('"+id+"',"+i+","+(opa-1)+","+tstep+","+keeptime+")",tstep);
	}
	
	
	function mimeInizializeFade (id) {
		var obj = document.getElementById(id);		
		mimeCleanChildren (obj);
		var lim = obj.childNodes.length;			
		for (var i=0; i<lim; i++){				
			if (i==0) {
				mimeSetOpacity(obj.childNodes[i],100);
			}					
			else {
				mimeSetOpacity(obj.childNodes[i],0);
			}				
			obj.childNodes[i].style.position 	= 'absolute';
			obj.childNodes[i].style.top 		= '0px';
			obj.childNodes[i].style.left 		= '0px';
		}			
	}
		
		
	/* FADE function mime **************************************************/			
														
	function mimeFade (id,from,to,millisec) {
		var obj = document.getElementById(id);
		mimeSetOpacity(obj,from);
		var timestep = millisec / 50;		
		//var valuestep = Math.abs(from-to) / 50;
		var valuestep = 5;
		var step = (from>=to) ? (valuestep*-1) : valuestep;
		mimeDoFade(id,from,to,step,timestep);
	}
	
	
	function mimeDoFade (id,opa,to,step,timestep) {
		var obj = document.getElementById(id);
		mimeSetOpacity(obj,opa);
		if ( (step < 0) && (opa <= to) ) return;
		if ( (step > 0) && (opa >= to) ) return;
		setTimeout("mimeDoFade('"+id+"',"+(opa+step)+","+to+","+step+","+timestep+")",timestep);			
	}
		
		
	/* GESTIONE RESIZE VERTICALE *******************************************/
		
	function mimeChangeVerticalSize (id,start,finish,millisec) {						   
		var timestep = millisec / ((finish-start)/0.5);
		var obj = document.getElementById(id);
		obj.style.height = start + "px";
		if (start > finish)
			mimeDoVerticalResize (id,finish,start,0,millisec,timestep,-1);
		else
			mimeDoVerticalResize (id,start,finish,0,millisec,timestep,1);
	}
	
	
	function mimeDoVerticalResize (id,start,finish,curTime,totalTime,timeStep,multiplier) {
		var step = getPos(curTime,totalTime,start,finish);								
		var obj = document.getElementById(id);
		obj.style.height = (parseInt(obj.style.height) + (step*multiplier)) + "px";						
		if (parseInt(obj.style.height) > finish) return;			
		setTimeout("mimeDoVerticalResize('"+id+"',"+start+","+finish+","+(curTime+timeStep)+","+totalTime+","+timeStep+","+multiplier+")",timeStep);			
	}
	
	
	function mimeGetPos (time,totTime,p1,p2) {
	    var value = p1 + (Math.pow(((1.0 / totTime) * time),2) * (p2 - p1));
    	return value;
	}
    	

	/* SETTING GLOBAL SCROLL VARIABLE **************************************/
    	
	var scrollingDiv = new Array();
	
	function mimeChangeScrollStatus (id,stat) {	    	
    	scrollingDiv[id] = stat;
	}
    	
    	
	/* MANAGE ALL SCROLLS **************************************************/
    	    	
	function mimeMakeScroll (id,verse,speed,keepTime,stoppable) {
    	var obj = document.getElementById(id);	    	    	
    	scrollingDiv[id] = 1;
    	// Reading Width and Height property depending on how I have set it (from css file or inline style)
    	obj.style.overflow = "hidden";
    	var objStyle = getCurrentStyle(obj);
    	var cHeight = parseInt(objStyle.height);
    	var cWidth  = parseInt(objStyle.width);
    	
    	/*
    	var cHeight = (obj.clientHeight > 0) ? obj.clientHeight : parseInt(obj.style.height);
    	var cWidth  = (obj.clientWidth > 0) ? obj.clientWidth : parseInt(obj.style.width);
    	*/
    	if (mimeInizializeScroll(id,cHeight,cWidth,verse,stoppable) < 0) return;
    	switch (verse) {
	    	case 'top'   : setTimeout("mimeDoScroll('"+id+"',0,'"+verse+"',"+speed+","+cHeight+","+keepTime+")",keepTime); break;
	    	case 'bottom': setTimeout("mimeDoScroll('"+id+"',0,'"+verse+"',"+speed+","+cHeight+","+keepTime+")",keepTime); break;
	    	case 'right' : setTimeout("mimeDoScroll('"+id+"',0,'"+verse+"',"+speed+","+cWidth+","+keepTime+")",keepTime);  break;
	    	case 'left'  : setTimeout("mimeDoScroll('"+id+"',0,'"+verse+"',"+speed+","+cWidth+","+keepTime+")",keepTime);  break;    		
    	}
	}
	
	
	// Inizialize children of container DIV
	function mimeInizializeScroll (id,cHeight,cWidth,verse,stoppable) {
    	var obj = document.getElementById(id);	
    	obj.style.position = "relative";
    	mimeCleanChildren(obj);
    	
		var lim = obj.childNodes.length;
		if (lim == 1) return -1;
		for (var i=0; i<lim; i++) {				
			obj.childNodes[i].style.position = 'absolute';			
			if (stoppable){
				obj.childNodes[i].style.cursor = 'pointer';
				obj.childNodes[i].setAttribute ('onmouseover',"mimeChangeScrollStatus('"+id+"',0)");
				obj.childNodes[i].setAttribute ('onmouseout' ,"mimeChangeScrollStatus('"+id+"',1)");
			}
			//Setting offset and position of master DIV children
			switch (verse) {
				case 'top'   : obj.childNodes[i].style.top    = ((Math.min(1,i))*cHeight)+'px'; break;
	    		case 'bottom': obj.childNodes[i].style.bottom = ((Math.min(1,i))*cHeight)+'px'; break;
	    		case 'right' : obj.childNodes[i].style.right  = ((Math.min(1,i))*cWidth)+'px';  break;
	    		case 'left'  : obj.childNodes[i].style.left   = ((Math.min(1,i))*cWidth)+'px';  break;
			}								
		}	    		
	}
	
	
	// Setting the properties to make 
	function mimeDoScroll (id,i,verse,transtime,pixel,keepTime) {	    
    	// If mouse over DIV, I'll go in a cicle callingmyself widthout changes every 2sec
    	if (scrollingDiv[id] == 0){
	    	setTimeout("mimeDoScroll('"+id+"',"+i+",'"+verse+"',"+transtime+","+pixel+","+keepTime+")",2000);
		}
		else {				    								
			var obj = document.getElementById(id);
			var children = obj.childNodes;	
			var childNumber = obj.childNodes.length;
			var next = (i+1)%childNumber;
			//Calcolo il tempo di clock della transizione
			var clock = Math.round(transtime / pixel);
			var realClock = 30 / clock;
			var step = Math.ceil(Math.min(5, Math.max(1,realClock)));
			clock = clock * step;

			// Depending on witch align im doing, I will change the style value			
			switch (verse){
				case 'top'   : obj.childNodes[i].style.top       = (parseInt(obj.childNodes[i].style.top)    - step) +'px';
							   obj.childNodes[next].style.top    = (parseInt(obj.childNodes[next].style.top) - step) +'px';
							   currentValue = parseInt(obj.childNodes[next].style.top);
							   break;
	    		case 'bottom': obj.childNodes[i].style.bottom    = (parseInt(obj.childNodes[i].style.bottom)    - step) +'px';
							   obj.childNodes[next].style.bottom = (parseInt(obj.childNodes[next].style.bottom) - step) +'px';
							   currentValue = parseInt(obj.childNodes[next].style.bottom);
							   break;
	    		case 'right' : obj.childNodes[i].style.right     = (parseInt(obj.childNodes[i].style.right)     - step) +'px';
							   obj.childNodes[next].style.right  = (parseInt(obj.childNodes[next].style.right)  - step) +'px';
							   currentValue = parseInt(obj.childNodes[next].style.right);
	    					   break;
	    		case 'left'  : obj.childNodes[i].style.left      = (parseInt(obj.childNodes[i].style.left)      - step) +'px';
							   obj.childNodes[next].style.left   = (parseInt(obj.childNodes[next].style.left)   - step) +'px';
							   currentValue = parseInt(obj.childNodes[next].style.left);
	    					   break;
			}
			// If currentValue is 0, a single transiction has been just completed. I have to reset the value
			// to inizialize value																				
			if (currentValue <= 0) {
				switch (verse){
					case 'top'   : obj.childNodes[i].style.top = pixel + 'px'; break;
		    		case 'bottom': obj.childNodes[i].style.bottom = pixel + 'px'; break;
		    		case 'right' : obj.childNodes[i].style.right = pixel + 'px'; break;
		    		case 'left'  : obj.childNodes[i].style.left = pixel + 'px'; break;
				}					
				i = next;				
				setTimeout("mimeDoScroll('"+id+"',"+i+",'"+verse+"',"+transtime+","+pixel+","+keepTime+")",keepTime);
			}						
			else
				setTimeout("mimeDoScroll('"+id+"',"+i+",'"+verse+"',"+transtime+","+pixel+","+keepTime+")",clock);
		}
	}
	
	/* MIME MARQUEE **************************************************/
	var activeMarquee = new Array();
	
	function mimeChangeMarqueeStatus (id,stat) {	    	
		activeMarquee[id] = stat;
	} 
	
	function mimeMarquee(id,speed,verse,stoppable){
		
		speed = (6 - speed) * 20;
		
		var obj = document.getElementById(id);
		obj.style.whiteSpace = "nowrap";
		obj.style.overflow   = "hidden";
		obj.style.position   = "relative";		
		
		activeMarquee[id] = 1;
		
		var width = obj.style.width;
		width = 0;
		
		var child 		= document.createElement("DIV");		
		var brother		= document.createElement("DIV");
		/*
		if (stoppable){			
			child.setAttribute ('onmouseover',"mimeChangeMarqueeStatus('"+id+"',0)");
			child.setAttribute ('onmouseout' ,"mimeChangeMarqueeStatus('"+id+"',1)");
			child.style.cursor = 'pointer';			
			brother.setAttribute ('onmouseover',"mimeChangeMarqueeStatus('"+id+"',0)");
			brother.setAttribute ('onmouseout' ,"mimeChangeMarqueeStatus('"+id+"',1)");
			brother.style.cursor = 'pointer';			
		}
		*/
		
		child.innerHTML 		= obj.innerHTML+'&nbsp;';
		brother.innerHTML 		= obj.innerHTML+'&nbsp;';
		obj.innerHTML = "";
		obj.appendChild (child);
		obj.appendChild (brother);
		
		
		child.style.position 	= "absolute";
		child.style.zIndex 		= 100;
		brother.style.position 	= "absolute";
		brother.style.zIndex 	= 100;
		
		//var multiplier = (verse == 'left') ? 1 : -1;
		
		switch (verse){
			case 'left'	: child.style.left = width; break;
			case 'right': child.style.right = width; break;
		}
										
		child.style.top 		= "0px";		
		brother.style.top 		= "0px";
		child.style.whiteSpace 	= "nowrap";
		brother.style.whiteSpace= "nowrap";
				
		var effectiveWidth = parseInt(child.offsetWidth);
		var width = parseInt (width);
		
		switch (verse){
			case 'left' : brother.style.left 	= (width+effectiveWidth)+"px"; break;
			case 'right': brother.style.right	= (width+effectiveWidth)+"px"; break;
		}
						
		//mimeDoMarquee(id,speed,effectiveWidth,width,(width+effectiveWidth),verse);
		setTimeout("mimeDoMarquee('"+id+"',"+speed+","+effectiveWidth+","+width+","+(width+effectiveWidth)+",'"+verse+"')",2000);
	}
	
	function mimeDoMarquee(id,speed,totalWidth,offset1,offset2,verse){
		var father = document.getElementById(id);
		var child  = father.firstChild;
		var brother = child.nextSibling;
		/*
		if (activeMarquee[id] == 0){
			setTimeout("mimeDoMarquee('"+id+"',"+speed+","+totalWidth+","+offset1+","+offset2+",'"+verse+"')",2000);
		}
		*/				
		offset1  -= 1;
		offset2  -= 1;
		
		switch (verse){
			case 'left': child.style.left  		= offset1 +'px';
						 brother.style.left  	= offset2 +'px';
						 break;
			case 'right':child.style.right  	= offset1 +'px';
			 			 brother.style.right  	= offset2 +'px';
			 			 break;
		}

		var width = parseInt(father.style.width);
		if (offset1 <= ((totalWidth)*-1)){		
			switch (verse){
				case 'left': child.style.left = totalWidth +"px"; break;
				case 'right': child.style.right = totalWidth +"px"; break;
			}			
			offset1 = totalWidth;
		}
		if (offset2 <= ((totalWidth)*-1)){
			switch (verse){
				case 'left': brother.style.left = totalWidth +"px"; break;
				case 'right': brother.style.right = totalWidth +"px"; break;
			}			
			offset2 = totalWidth;
		}
		setTimeout("mimeDoMarquee('"+id+"',"+speed+","+totalWidth+","+offset1+","+offset2+",'"+verse+"')",speed);
	}
	
	/* MIME OPEN GENTLY **************************************************/
	
	var mimeObjsOpens = new Array();
	
	//Inizializzazione di base per entrambi i tipi di aperture
	function mimeOpenCommonInitialize (id){
		var obj = document.getElementById(id);
		
		var child = document.createElement("DIV");		
		
		child.innerHTML = obj.innerHTML;
		obj.innerHTML = "";
		obj.style.position = "relative";
		obj.style.overflow = "hidden";		
			
		child.style.position = "absolute";
		child.style.top		 = "0px";		
		obj.appendChild (child);		
		mimeObjsOpens[id] = new Array();
		hideLinks(id);
	}
	
	//This method comments links to avoid the activation of link when container is not focused
	function hideLinks(id){
		var obj = document.getElementById(id);
		var cc  = obj.innerHTML;

		var totalLinks 	= cc.match (/\<a(.*?)\>/ig);
		for (var i=0; i < totalLinks.length; i++){
			cc = cc.replace(totalLinks[i],"<!--"+totalLinks[i]+"-->");				
		}			
		cc = cc.replace(/\<\/a\>/ig,"<!--</a>-->");
		obj.innerHTML = cc;	
	}
	
	function showLinks(id){
		var obj = document.getElementById(id);
		var cc  = obj.innerHTML;
		cc = cc.replace(/\<!--/ig,"");
		cc = cc.replace(/--\>/ig,"");
		obj.innerHTML = cc;
	}
	
	//Inizializzazione di base per l'apertura Verticale
	function mimeOpenHeightInizialize(id,newHeight){
		var obj = document.getElementById(id);
		var width = parseInt(obj.offsetWidth);
		var height = obj.style.height;
		if (height.length == 0)
			height = parseInt(newHeight);
		else
			height = parseInt(height);
		
		var max   = obj.scrollHeight;
		if (max%2 == 1) //If odd, I'll change it to even
			max--;
		
		mimeObjsOpens[id]['status'] 		= 0;
		mimeObjsOpens[id]['base_measure'] 	= height;
		mimeObjsOpens[id]['max_measure'] 	= max;
		mimeObjsOpens[id]['verse'] 			= 1;
		//mimeObjsOpens[id] = new Array (0,height,max);	
	}
	
	//Inizializzazione di base per l'apertura Orizzontale
	function mimeOpenWidthInizialize(id,newWidth){
		var obj = document.getElementById(id);
		obj.firstChild.style.whiteSpace = "nowrap";
		var height = parseInt(obj.offsetHeight);
		var width = obj.style.width;
		if (width.length == 0)
			width = parseInt(newWidth);
		else
			width = parseInt(width);
		
		var max   = obj.scrollWidth;
		if (max%2 == 1) //If odd, I'll change it to even
			max--;
		
		mimeObjsOpens[id]['status'] = 0;
		mimeObjsOpens[id]['base_measure'] = width;
		mimeObjsOpens[id]['max_measure'] = max;		
	}
	
	//Metodo pubblico di richiamo per l'apertura Self Verticale
	function mimeSelfOpenHeight(id,speed,newHeight){
		var obj = document.getElementById(id);
		obj.style.cursor = "pointer";
		obj.setAttribute ('onClick',"mimeMakeOpens('"+id+"')");		
	}
	
	//metodo di apertura altezza non self
	function mimeOpenHeight(id,speed,newHeight){
		mimeOpenCommonInitialize(id);
		var obj = document.getElementById(id);		
				
		obj.firstChild.style.width = parseInt(obj.offsetWidth)+"px";				
		mimeOpenHeightInizialize (id,newHeight);
				
		var meatime = 6000 - (speed * 1000);
		var clock = Math.round(meatime / (mimeObjsOpens[id]['max_measure'] - mimeObjsOpens[id]['base_measure']));
		var realClock = 30 / clock;
		var step = Math.ceil(Math.min(10, Math.max(1,realClock)));
		clock = clock * step;
		
		mimeObjsOpens[id]['speed'] 			= clock;
		mimeObjsOpens[id]['current_measure']= mimeObjsOpens[id]['base_measure'];
		mimeObjsOpens[id]['verse'] 			= 1;
		mimeObjsOpens[id]['step'] 			= step;
	}
			
	//Metodo pubblico di richiamo per l'apertura Self Orizzontale
	function mimeSelfOpenWidth(id,speed,newWidth){		
		mimeOpenWidth(id,speed,newWidth);		
		var obj = document.getElementById(id);
		obj.style.cursor = "pointer";
		obj.setAttribute ('onClick',"mimeMakeOpens('"+id+"')");
	}
	
	function mimeOpenWidth(id,speed,newWidth){
		mimeOpenCommonInitialize(id);
		var obj = document.getElementById(id);				
				
		obj.firstChild.style.height = parseInt(obj.offsetHeight)+"px";		
		mimeOpenWidthInizialize (id,newWidth);
		
		var diff = Math.ceil(mimeObjsOpens[id]['max_measure'] - mimeObjsOpens[id]['base_measure']);
		var step = Math.floor ((diff / speed)/10) * 2;
		var meatime = 6000 - (speed * 1000);
		var clock = Math.round(meatime / (mimeObjsOpens[id]['max_measure'] - mimeObjsOpens[id]['base_measure']));
		
		mimeObjsOpens[id]['speed']			= clock;
		mimeObjsOpens[id]['current_measure']= mimeObjsOpens[id]['base_measure'];
		mimeObjsOpens[id]['verse']			= 0;
		mimeObjsOpens[id]['step'] 			= step;
	}
		
	function mimeClose(id){
		var obj = document.getElementById(id);
		if (mimeObjsOpens[id]['status'] == 0) return;
		
		//Qui vado se ho premuto per chiudere ma non ho ancora iniziato a chiudere
		//setto lo stato a 2 ovvero "sto chiudendo"
		if (mimeObjsOpens[id]['current_measure'] >= mimeObjsOpens[id]['max_measure'] && mimeObjsOpens[id]['status'] == 1) {
			mimeObjsOpens[id]['status'] = 2;
			mimeObjsOpens[id]['current_measure'] = mimeObjsOpens[id]['max_measure'];
			hideLinks(id);
		}
		
		//Caso in cui ho rimpicciolito fino a dove dovevo
		//setto lo stato a 0 ovvero "Ho concluso la chiusura";
		if (mimeObjsOpens[id]['current_measure'] <= mimeObjsOpens[id]['base_measure'] && mimeObjsOpens[id]['status'] == 2) {
			mimeObjsOpens[id]['status'] = 0;			
			return;	
		}		
		
		var value = (mimeObjsOpens[id]['status'] == 2) ? mimeObjsOpens[id]['current_measure'] - mimeObjsOpens[id]['step'] : mimeObjsOpens[id]['current_measure'] + mimeObjsOpens[id]['step'];
		if (value < mimeObjsOpens[id]['base_measure'])
			value = mimeObjsOpens[id]['base_measure'];
		mimeObjsOpens[id]['current_measure'] = value;
		if (mimeObjsOpens[id]['verse'])
			obj.style.height 	= value+"px";
		else
			obj.style.width 	= value+"px";
		
		//Se value è minore di current, allora sto stringendo
		//altrimenti sto ingrandendo
		setTimeout("mimeClose('"+id+"')",mimeObjsOpens[id]['speed']);			
		
	}
	
	function mimeOpen(id){
		var obj = document.getElementById(id);
		if (mimeObjsOpens[id]['status'] == 1) return;
		//Caso in cui ho ingrandito fino a dove dovevo
		//setto lo stato a 1 ovvero "Ho concluso l'apertura";
		if (mimeObjsOpens[id]['current_measure'] >= mimeObjsOpens[id]['max_measure'] && mimeObjsOpens[id]['status'] == 0){
			mimeObjsOpens[id]['status'] = 1;
			showLinks(id);
			return;
		}
		
		var value = (mimeObjsOpens[id]['status'] == 2) ? mimeObjsOpens[id]['current_measure'] - mimeObjsOpens[id]['step'] : mimeObjsOpens[id]['current_measure'] + mimeObjsOpens[id]['step'];
		if (value > mimeObjsOpens[id]['max_measure'])
			value = mimeObjsOpens[id]['max_measure'];
		
		mimeObjsOpens[id]['current_measure'] = value;
		if (mimeObjsOpens[id]['verse'])
			obj.style.height 	= value+"px";
		else
			obj.style.width 	= value+"px";
		
		//Se value è minore di current, allora sto stringendo
		//altrimenti sto ingrandendo
		setTimeout("mimeOpen('"+id+"')",mimeObjsOpens[id]['speed']);
		
	}
		
	function mimeMakeOpens(id){
		var obj = document.getElementById(id);
						
		//Caso in cui ho ingrandito fino a dove dovevo
		//setto lo stato a 1 ovvero "Ho concluso l'apertura";
		if (mimeObjsOpens[id]['current_measure'] >= mimeObjsOpens[id]['max_measure'] && mimeObjsOpens[id]['status'] == 0){
			mimeObjsOpens[id]['status'] = 1;
			mimeObjsOpens[id]['current_measure'] = mimeObjsOpens[id]['max_measure'];
			showLinks(id);
			return;
		}
		
		//Qui vado se ho premuto per chiudere ma non ho ancora iniziato a chiudere
		//setto lo stato a 2 ovvero "sto chiudendo"
		if (mimeObjsOpens[id]['current_measure'] == mimeObjsOpens[id]['max_measure'] && mimeObjsOpens[id]['status'] == 1) {
			mimeObjsOpens[id]['status'] = 2;
			mimeObjsOpens[id]['current_measure'] = mimeObjsOpens[id]['max_measure'];
			hideLinks(id);
		}
		
		//Caso in cui ho rimpicciolito fino a dove dovevo
		//setto lo stato a 0 ovvero "Ho concluso la chiusura";
		if (mimeObjsOpens[id]['current_measure'] <= mimeObjsOpens[id]['base_measure'] && mimeObjsOpens[id]['status'] == 2) {
			mimeObjsOpens[id]['status'] = 0;					
			return;	
		}		
		
		var value = (mimeObjsOpens[id]['status'] == 2) ? mimeObjsOpens[id]['current_measure'] - mimeObjsOpens[id]['step'] : mimeObjsOpens[id]['current_measure'] + mimeObjsOpens[id]['step'];
		
		if (value > mimeObjsOpens[id]['current_measure'] && value > mimeObjsOpens[id]['max_measure']){
			value = mimeObjsOpens[id]['max_measure'];		
		}
		
		if (value < mimeObjsOpens[id]['current_measure'] && value < mimeObjsOpens[id]['base_measure']){
				value = mimeObjsOpens[id]['base_measure'];				
		}		
		
		mimeObjsOpens[id]['current_measure'] = value;
		
		if (mimeObjsOpens[id]['verse'])
			obj.style.height 	= value+"px";
		else
			obj.style.width 	= value+"px";
		
		
		//Se value è minore di current, allora sto stringendo
		//altrimenti sto ingrandendo
		if (value < mimeObjsOpens[id]['current_measure']){
			if (value > mimeObjsOpens[id]['base_measure'])
				setTimeout("mimeMakeOpens('"+id+"')",mimeObjsOpens[id]['speed']);	
		}
		else 
			if (mimeObjsOpens[id]['current_measure'] <= mimeObjsOpens[id]['max_measure'])
				setTimeout("mimeMakeOpens('"+id+"')",mimeObjsOpens[id]['speed']);
	}
	
	
