/*******************************************************************
*
* File    : SG_geckoBuddy.js
*
* Created : 01/06/2005
*
* Author  : Dan Bodenstein
*
*******************************************************************/




var GB_RefreshTimer, GB_Float_X, GB_Float_Y

function stopServerPull() {
	window.clearInterval(GB_RefreshTimer);
}

function ServerPull() {
	window.clearInterval(GB_RefreshTimer);
	var head = document.getElementsByTagName('head').item(0);
	var scriptTag = document.getElementById('loadScript');
	if (scriptTag) head.removeChild(scriptTag);
	script = document.createElement('script');
	
	script.src = 'web_Root' + 'SG_GBUpdater.asp';
	script.type = 'text/javascript';
	script.id = 'loadScript';

	
	head.appendChild(script);
	GB_RefreshTimer = setInterval(ServerPull, 10000);
}



function showBuddy(){
	
        var el=document.getElementById('popupWin');
		el.style.visibility='visible';
        el.style.display='';
		var sContent = document.getElementById('popupWin_content').innerHTML;
		document.getElementById('popupWin_content').innerHTML = '';
		document.getElementById('popupWin_content').innerHTML = sContent;
		document.getElementById('popupWin_Mascot').innerHTML = '<img src="' + GB_Mascot + '">';
		var ns = (navigator.appName.indexOf("Netscape") != -1);
		var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		GB_Ypos = pY;
		GB_Ypos = GB_Height;
        var gb=document.getElementById('geckoBuddy');
		gb.style.display='';
		gb.style.visibility='visible';
		gb.style.zIndex = '999999';
 		moveup();

	}
function hideBuddy(){

		GB_Ypos = 0;
 		movedown();
}
function geckoBuddy_Close()
{
	el=document.getElementById('popupWin');
	el.style.filter='';
	el.style.display='none';
	GB_RefreshTimer = setInterval(ServerPull, 2800);
}
function moveup(){
var GB_Xpos = document.body.clientWidth + document.body.scrollLeft - (GB_Width + 15);
var ns = (navigator.appName.indexOf("Netscape") != -1);
var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
pY = pY - GB_Height-15;
pY=0;
 GB_Ypos-=5; 

if(document.layers){
	document.popupWin.top=GB_Ypos;
}
if(document.all){
document.all.popupWin.style.top=GB_Ypos;
}
if(!document.all && document.getElementById){
document.getElementById("popupWin").style.top=GB_Ypos+"px";
}
if (GB_Ypos<= pY){
window.clearTimeout(scrollTimerId);scrollTimerId=0;
}else{
scrollTimerId = window.setTimeout("moveup();",15);
}
}


function movedown(){
GB_Ypos+=5; 

if(document.layers){
document.popupWin.top=GB_Ypos;
}
if(document.all){
document.all.popupWin.style.top=GB_Ypos;
}
if(!document.all && document.getElementById){
document.getElementById("popupWin").style.top=GB_Ypos+"px";
}
if (GB_Ypos>= GB_Height){
window.clearTimeout(scrollTimerId);scrollTimerId=0;
geckoBuddy_Close()
}else{
scrollTimerId = window.setTimeout("movedown();",15);
}
}

 function GB_Init() {
	var ns = (navigator.appName.indexOf("Netscape") != -1);
 	var GBX = ns ? pageXOffset + innerWidth - (GB_Width + 15) : document.body.clientWidth + document.body.scrollLeft - (GB_Width + 15);
	var GBY = ns ? pageYOffset + innerHeight - (GB_Height + 15): document.body.scrollTop + document.body.clientHeight - (GB_Height + 15) ;

	CreateStaticFloat("geckoBuddy",GBX,GBY);
 }

var GB_Xpos=0, GB_Ypos=0, scrollTimerId=0;
GB_RefreshTimer = setInterval(ServerPull, 2000);
    

    

