var dom = (document.getElementById)? true:false;
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;

function actionVPN(){
	if (ie4) {
		if(VPNcontainer.style.display!="none") hideVPN();
		else showVPN();
	}else if (dom) { 
		if(document.getElementById("VPNcontainer").style.display!="none") hideVPN();
		else showVPN();
	}
}
function showVPN(){
	if (ie4) { VPNcontainer.style.display = "inline"; }else if (dom) { document.getElementById("VPNcontainer").style.display = "inline"; }
	//startVPNdrag();
}
function hideVPN(){
	if (ie4) { VPNcontainer.style.display = "none"; }else if (dom) { document.getElementById("VPNcontainer").style.display = "none"; }
}

function VPNstart() {
	var h=0;
 	if (ie4) {
		//var w=document.body.clientWidth-200;
		var w = 0;
		VPNcontainer.style.left=w;
		VPNcontainer.style.top=h;
		VPNcontainer.onmousedown=VPNBeginDrag;
	}else if (dom) {
		//var w=window.outerWidth-200;
		var w = 0;
		document.getElementById('VPNcontainer').style.left=w;
		document.getElementById('VPNcontainer').style.top=h;
		document.getElementById("VPNcontainer").addEventListener("mousedown",VPNBeginDrag, false);
	}
}

function VPNDrag(e) {
	if (ie4) {
		var difX=event.clientX-window.lastX;
	   var difY=event.clientY-window.lastY;
		var newX1 = parseInt(VPNcontainer.style.left)+difX;
	   var newY1 = parseInt(VPNcontainer.style.top)+difY;
	   VPNcontainer.style.left=newX1+"px";
	   VPNcontainer.style.top=newY1+"px";
	   window.lastX=event.clientX;
	   window.lastY=event.clientY;
	}else if (dom) {
		var difX=e.clientX-window.lastX;
	   var difY=e.clientY-window.lastY;
		var newX1 = parseInt(document.getElementById("VPNcontainer").style.left)+difX;
	   var newY1 = parseInt(document.getElementById("VPNcontainer").style.top)+difY;
	   document.getElementById("VPNcontainer").style.left=newX1+"px";
	   document.getElementById("VPNcontainer").style.top=newY1+"px";
	   window.lastX=e.clientX;
	   window.lastY=e.clientY;
	}
}

function VPNBeginDrag(e) {
	if (ie4) {
		window.lastX=event.clientX;
	   window.lastY=event.clientY;
	   document.onmousemove=VPNDrag;
	   document.onmouseup=VPNEndDrag;
	}else if (dom) {
		window.lastX=e.clientX;
	   window.lastY=e.clientY;
	   window.onmousemove=VPNDrag;
	   window.onmouseup=VPNEndDrag;
		myattr=e.target.getAttribute("ID");
	}
}

function VPNEndDrag(e) {
	 if (ie4 || ns4) {
	 	document.onmousemove=null;
	 }else if (dom) {
		window.onmousemove=null;
	}
}