var dragElem=null;		
var dragging=false;		
var intX;		
var intY;		
function setDrag(evt,elementID){			
	dragElem=getObj(elementID);	
	dragElem.style.visibility = 'visible';		
	intX = 11;			
	intY = 11;		
	 startDrag() ;	
//	dragObj(evt);		
}		
function startDrag() {			
	dragging=true;			
	document.onmousemove=dragObj;			
		
}		
function dragObj(evt) {			
	if (window.event){ evt = window.event; }			
	if (evt ){				
		var x = evt.clientX + intX;				
		var y = evt.clientY  + intY;				
		//alert(x+" "+y)
		shiftTo(dragElem,x,y,1);				
		var pos = "drag coordinates are: " + x + ", " + y + ", " + 1;		
		window.status= pos;					
	} 			
	return false;		
}				
function dropObj() {			
	dragging=false;		
	dragElem.style.visibility = 'hidden';			
	document.onmousemove=null;			
	document.onmouseup=null;			
	window.status="";		
}		
/*End Drag and Drop Script*/		
/*Utility functions, place in codelibrary.js for future use.*/		
/*Getting the width of an object*/		
function getWidth(obj){			
	var theObj = getObj(obj);			
	if (theObj.clientWidth){				
		return parseInt(theObj.clientWidth);			
	}			
	if (theObj.offsetWidth){				
		return parseInt(theObj.offsetWidth);			
	}		
}		/*Getting the Height of an object*/		
function getHeight(obj){			
	var theObj = getObj(obj);			
	if (theObj.clientHeight){				
		return parseInt(theObj.clientHeight);			
	}			

	if (theObj.offsetHeight){				
		return parseInt(theObj.offsetHeight);			
	}		
}				
/* Convert object name string or object reference		into a valid object reference */		
function getObj(elementID){			
	if (typeof elementID == "string"){				
		return document.getElementById(elementID);			
	}
	else{			
		return elementID;			
	}		
}		
/* Object Motion and Position Scripts */		
/*This function places a positionable object (obj) in		three dimensions (x,y, and z).*/		
function shiftTo(obj,x,y,z){			
	
	var newObj = getObj(obj);			
		newObj.style.left = x + "px";			
		newObj.style.top = y + "px";			
		newObj.style.zIndex = z;		
	
}		
