var dotall =   "";	//// Variable for cross browser coding IE4.
var dotstyle = "";	//// Variable for cross browser coding .
var able = "y"		//// Variable indicating whether the window is able to show the button.
var RightCoOrd = 40;	////50 Controls how far the button is in from the r/h side of the screen.
var TopCoOrd = 200;	////200 Controls how far the button is down from the top of the screen.

function initial() {
	if (navigator.appVersion.charAt(0) >= "4") {
   		if (navigator.appVersion.indexOf("MSIE") != -1) {
			dotall = ".all";
			dotstyle = ".style";
			document.all.Layer1.style.posTop = 500;
    		}
		else{		
			document.Layer1.top = 500;
		}
tester();
}
}

	//// Function tests for window space availablility and shows / hides the button accordingly
	//// Function will also stop all sliding if the window does not have the space

function tester() {

if(able=="y"){
	if(navigator.appVersion.indexOf("MSIE") != -1){
		if(document.body.clientWidth>=500){
			showLayer('Layer1');

		MoveDest('Layer1');
		}
		else{
			hideLayer('Layer1');
			able=="n";
			document.all.Layer1.style.posLeft=1;
		}
	}
	else{
		if(window.innerWidth>=500){
			showLayer('Layer1');

		MoveDest('Layer1');
		}
		else{
			hideLayer('Layer1');
			able=="n";
			document.Layer1.posLeft=1;
		}
	}
}
}

	//// Function controls the sliding of the button
	//// It will continue sliding only while the window has the needed space


function MoveDest(layerName) {
	
	if (navigator.appVersion.indexOf("MSIE") != -1) {
		var x = document.body.clientWidth-RightCoOrd;
		var diff = (document.body.scrollTop+TopCoOrd - document.all.Layer1.style.posTop)*.90;
		var y = document.body.scrollTop+TopCoOrd-diff;

		eval("document.all." + layerName + ".style.posTop =  y");
		eval("document.all." + layerName + ".style.posLeft = x");
	}
	else {
		var x = window.innerWidth-RightCoOrd;
		var diff = ((self.pageYOffset+TopCoOrd) - document.Layer1.top)*.95;
		var y = self.pageYOffset+TopCoOrd-diff;

		eval("document." + layerName + ".moveTo (x, y)");
    	}
	if(able=="y"){	
		setTimeout("tester();", 5);
	}
}



function hideLayer(layerName){
	eval("document" + dotall  + "." + layerName + dotstyle + ".visibility = 'hidden'");
}


function showLayer(layerName){
	eval("document" + dotall  + "." + layerName + dotstyle + ".visibility = 'visible'");
}

