/***********************************************
* Drag and Drop Script: © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var currentZ = 7;
var currentWindow = '';

function activeWindow(phase, obj){
	switch(phase){
		case "start":
			currentWindow = obj;
			currentWindow.className = "menu dragClass";
		break;
		
		case "end":
			currentWindow.className = "menu";
		break;
	}
}


var dragobject={
	z: 0, x: 0, y: 0, offsetx : null, offsety : null, targetobj : null, dragapproved : 0,
	initialize:function(){
	document.onmousedown=this.drag
	document.onmouseup=function(){this.dragapproved=0; activeWindow("end");}
	},
	
drag:function(e){
	var evtobj=window.event? window.event : e
	this.targetobj=window.event? event.srcElement : e.target
	
	if (this.targetobj.className=="menu"){
		
		activeWindow("start", this.targetobj);
		
		currentZ += 1;
		this.targetobj.style.zIndex = currentZ;
		this.dragapproved=1
		
		if (isNaN(parseInt(this.targetobj.style.left))){this.targetobj.style.left=0}
		if (isNaN(parseInt(this.targetobj.style.top))){this.targetobj.style.top=0}
		
		this.offsetx=parseInt(this.targetobj.style.left)
		this.offsety=parseInt(this.targetobj.style.top)
		this.x=evtobj.clientX
		this.y=evtobj.clientY
		
		if (evtobj.preventDefault)
			evtobj.preventDefault()
			document.onmousemove=dragobject.moveit
			}
	},
	
	moveit:function(e){
		var evtobj=window.event? window.event : e
		if (this.dragapproved==1){
			this.targetobj.style.left=this.offsetx+evtobj.clientX-this.x+"px"
			this.targetobj.style.top=this.offsety+evtobj.clientY-this.y+"px"
			return false
			}
		}
	}

dragobject.initialize()


function openWindow(){
	

}

function dockWindow(item){
	if(document.getElementById(item).className=='menu'){
		document.getElementById(item).className = "docked";
	}else{
		document.getElementById(item).className = "menu";			
	}
}

function fullSizeWindow(item){
	var openWindow = document.getElementById(item);
	openWindow.style.left = "0px";
	openWindow.style.top = "45px";
	openWindow.className = "fullWindow";
	
	var winW = 630, winH = 460;

	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  winW = window.innerWidth;
	  winH = window.innerHeight;
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  winW = document.documentElement.clientWidth;
	  winH = document.documentElement.clientHeight;
	  window.alert(winH);
	 }
	}

	window.alert(winH);
	openWindow.style.width = (winW-10)+"px";
	openWindow.style.height = (winH-65)+"px";
}


