var default_top = "-185px";
var open_top = "0px";
var scroll_speed = 1;
var scroll_step = 15;

var openclose_status = false;

function openclose(){
	if(!openclose_status){
		show_slidemenu();
		openclose_status = true;
	} else {
		hide_slidemenu();
		openclose_status = false;
	}
}

function show_slidemenu(){
	opentop();//document.getElementById('externalSite').style.top = open_top;
}

function hide_slidemenu(){
	closetop();//document.getElementById('externalSite').style.top = default_top;
}

window.onload = init;
var obj_topmenu;
function init(){
	obj_topmenu = document.getElementById('externalSite');
	obj_topmenu.style.top = default_top;
}

var myINT;
function opentop(){
	temp = parseInt(obj_topmenu.style.top);
	myINT = setInterval('scrollit_down()',scroll_speed);
}

function closetop(){
	if(navigator.userAgent.indexOf('compatible; MSIE') != -1 && navigator.platform == 'Win32' && navigator.appName == 'Microsoft Internet Explorer') {
		temp = parseInt(obj_topmenu.style.top);
		myINT = setInterval('scrollit_up()',scroll_speed);
	} else {
		obj_topmenu.style.top = "-138pt";
	}
}

var temp;
var step = scroll_step;
function scrollit_down(what){
	temp += step;
	if(temp <= parseInt(open_top)){
//		document.forms[0].t.value = temp //document.getElementById('externalSite').style.top; // debug statement
		if(-temp <= scroll_step){
			step = 1;
		} else if(-temp <= scroll_step*2){
			step = parseInt(step/2);
		}
		obj_topmenu.style.top = temp;
	} else {
		step = scroll_step;
		clearInterval(myINT);
	}
}

function scrollit_up(what){
	temp -= step;
	if(temp >= parseInt(default_top)){
//		document.forms[0].t.value = temp + ", " + scroll_step+", calc:" + (-parseInt(default_top) - scroll_step);
// 		debugstatement
		if(-temp >= (-parseInt(default_top) - scroll_step)){
			step = 1;
		} else if(-temp >= (-parseInt(default_top) - (scroll_step*2))){
			step = parseInt(step/2);
		}
		obj_topmenu.style.top = temp;
	} else {
		step = scroll_step;
		clearInterval(myINT);
	}
}