//move layers
var homedir = 0;

function moveit(cmd){
	var bot = document.getElementById("bottom");
	if(parseInt(bot.style.top) <= 184){
		homedir = 2;
	}
	if(parseInt(bot.style.top) >= 504){
		homedir = 1;
	}
	time1 = setInterval("startmove('"+cmd+"')",15);
}

function startmove(cmd){
	var b = document.getElementById("bottom");
	var n = document.getElementById("nav");
	var c = document.getElementById("top");
	switch(cmd){
		case "homedown":
				if(parseInt(b.style.top) > 504){
					clearInterval(time1)
				}else{
					if(parseInt(b.style.top) < 490){
						b.style.top = parseInt(b.style.top) + 6;
						n.style.top = parseInt(n.style.top) + 6;
						c.style.top = parseInt(c.style.top) + 6;
					}else{
						b.style.top = parseInt(b.style.top) + 1;
						n.style.top = parseInt(n.style.top) + 1;
						c.style.top = parseInt(c.style.top) + 1;
					}
				}
				
			break;
		case "homeup":
				if(parseInt(b.style.top) < 184){
					clearInterval(time1)
				}else{
					if(parseInt(b.style.top) > 200){
						b.style.top = parseInt(b.style.top) - 6;
						n.style.top = parseInt(n.style.top) - 6;
						c.style.top = parseInt(c.style.top) - 6;
					}else{
						b.style.top = parseInt(b.style.top) - 1;
						n.style.top = parseInt(n.style.top) - 1;
						c.style.top = parseInt(c.style.top) - 1;
					}
				}
				
			break;
		case "homereg":
			if(homedir == 1){
				if(parseInt(b.style.top) < 364){
					clearInterval(time1)
				}else{
					if(parseInt(b.style.top) > 370){
						b.style.top = parseInt(b.style.top) - 6;
						n.style.top = parseInt(n.style.top) - 6;
						c.style.top = parseInt(c.style.top) - 6;
					}else{
						b.style.top = parseInt(b.style.top) - 1;
						n.style.top = parseInt(n.style.top) - 1;
						c.style.top = parseInt(c.style.top) - 1;
					}
				}	
			}
			if(homedir == 2){
				if(parseInt(b.style.top) > 364){
					clearInterval(time1)
				}else{
					if(parseInt(b.style.top) < 350){
						b.style.top = parseInt(b.style.top) + 6;
						n.style.top = parseInt(n.style.top) + 6;
						c.style.top = parseInt(c.style.top) + 6;
					}else{
						b.style.top = parseInt(b.style.top) + 1;
						n.style.top = parseInt(n.style.top) + 1;
						c.style.top = parseInt(c.style.top) + 1;
					}
				}
			
			}	
			break;
	}
}

function openpdf(filename){
		var T=(screen.height - 600) / 2;
		var L=(screen.width - 800) / 2;
		var gWin = window.open(filename,"", "height=600,width=800,top=" + T + ",left=" + L + ",location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no");
}
