var timer, timer2;

function checkBrowserName(name){  
	var agent = navigator.userAgent.toLowerCase();  
	if (agent.indexOf(name.toLowerCase())>-1) {  
		return true;  
	}  
		return false;  
}  


function slide(id) {
	if (id < 8) {
		if(checkBrowserName('MSIE')){  
			var width1 = 150;
			var height1 = 29;
			var width2 = 187; 
			document.getElementById('slideVer').style.width = 900 + "px";
		} else {
			var width1 = document.getElementById('one').offsetTop;
			var height1 = document.getElementById('one').offsetHeight;
			var width2 = document.getElementById('two').offsetTop;
			document.getElementById('slideVer').style.width = 900 + "px";
		}
		document.getElementById('slideVer').style.left = 400 + "px";
		document.getElementById('contentWrapper').style.display = "none";
		document.getElementById('contentWrapper').innerHTML = content[id];
		if(id < 4) {
			var top = width1 + Math.ceil(height1/2) + (id * (width2 - width1)) -1;
		} else {
			var top = width1 + Math.floor(height1/2) + (id * (width2 - width1)) -2 + 70;
		}
		var left = 262;
		slide1(top, left);
	} else {
		document.getElementById('contentWrapper').innerHTML = content[id];
	}
}

function slide1(top, left) {
	var div = document.getElementById('slideHor');
	div.style.display = "block";
	div.style.top = top + "px";
	div.style.left = left + "px";
	div.style.height = 2 + "px";
	div.style.width = 1 + "px";
	width1();
}

function width1() {
	var div = document.getElementById('slideHor');
	var width = div.style.width.split("px");
	div.style.width = width[0] - (-1) + "px";
	if(width[0] < 137) {
		timer = setTimeout("width1()", 1);
	} else {
		width2();
	}
}

function width2() {
	var div = document.getElementById('contentWrapper');
	document.getElementById('slideVer').style.width = 900 + "px";
	document.getElementById('slideVer').style.left = 400 + "px";
	div.style.display = "block";
	slide2();
}

function slide2() {
	var div = document.getElementById('slideVer');
	var width = div.offsetWidth;
	var left = div.style.left.split("px");
	div.style.width = (width - 1) + "px";
	div.style.left = left[0] - (-1) + "px";
	if(width > 0) {
		timer2 = setTimeout("slide2()", 1);
	}
}
