var bar_width=0; 					// resizable bar starting width
var speed=50;						// transformation speed ( lower is more speed)
var div_name = "moove_bar";			// div that become a resizable bar
var float_position = "right";		// position of the bar
var new_windows = "";				// position of the bar
var new_color = "";					// position of the bar


function initMooveKmzero(windows_name) {
	//COLORI DEGLI SFONDI DEI VARI SITI
	switch(windows_name){
		case "'http://www.egonmagazine.com":
			color="#eee";
			break;
			
		case "http://lab.studiokmzero.com":
		case "http://www.kmzerolab.com":
			color="#393939";
			break;
			
		case "http://www.zerofonts.com":
		case "http://www.zetafonts.com":
			color="#fff";
			break;
			
		case "http://www.studiokmzero.com":
		case "http://www2.studiokmzero.com":
		case "http://studio.studiokmzero.com":
			color="#f5f5f5";
			break;

		default:
			color="#fff";
			break;
		}
	initMoove(windows_name,color);
	}

//-----------------------------------------------------------//

var i=0;
var foo = null; 
var h = null;
var w = null;
var endx= null;
var val = null;

function doMoove() {
	
	i++;
	if(i<speed){
		if(window.innerWidth) w=window.innerWidth;
		else w=document.body.clientWidth;
		val= (Math.sin((i/speed)*Math.PI-Math.PI/2)+1)/2*(w-bar_width*2);
		foo.style.width = parseInt(val)+ bar_width + 'px';
		foo.style.background = new_color;
		setTimeout(doMoove,10); // call doMoove in 20msec
		//foo.innerHTML = w + " x:" + val;
		}
	else {
		//alert(new_windows + " - " + new_color);
		window.open(new_windows,"_parent");
		}
	}
 

function initMoove(windows_name,color) {
	//alert(windows_name);
	new_windows=windows_name;
	new_color=color;
	
	doMoove(); // start animating
	}

//-----------------------------------------------------------//

function doHeight() {
	if(window.innerHeight) h=window.innerHeight;
	else h=document.body.clientHeight;
	foo.style.height = parseInt(h)+'px';
	setTimeout(doHeight,5); // call doHeight 
	}

function init() {
	foo = document.getElementById(div_name); // get the "foo" object
	foo.style.width= bar_width + 'px'; 
	foo.style.float= float_position; 
	doHeight();
	}

window.onload = init;


