/* 
Script made by Martial Boissonneault © 2002-2003 http://getElementById.com/
This script may be used and changed freely as long as this msg is intact
Visit http://getElementById.com/ for more free scripts and tutorials.
*/
var ie5 = (document.getElementById && document.all);
var ns6 = (!document.all && document.getElementById);
var timerID = null;
var active = 0;

function start(windowName, contentName){
	if(ie5 || ns6){
		dragWind = document.getElementById(windowName);
		dragCont = document.getElementById(contentName);
		y = coordsY-parseInt(dragWind.style.top);
		x = coordsX-parseInt(dragWind.style.left);
		dragWind.style.zIndex = (start.zCount++);
		active=1;
	}
}

start.zCount=0;
function drag(e){
	if(ie5 || ns6){
		coordsY = ns6?e.clientY:event.clientY;
		coordsX = ns6?e.clientX:event.clientX;
		if(active){
			dragWind.style.top = (coordsY-y)+'px';
			dragWind.style.left = (coordsX-x)+'px';
		}
	}
}

function closeWin(){
	if(ie5 || ns6){
		dragWind.style.left= -3000+'px';
	}
}

function maxWin(winMaxWidth, winMaxHeight){
	if(ie5 || ns6){
		dragWind.style.width = winMaxWidth;
		dragWind.style.height = winMaxHeight;
		dragCont.style.width = ns6?winMaxWidth:winMaxWidth-6;
		dragCont.style.height = ns6?winMaxHeight-20:winMaxHeight-24;
	}
}

function minWin(winMinWidth, winMinHeight){
	if(ie5 || ns6){
		dragWind.style.width = winMinWidth;
		dragWind.style.height = winMinHeight;
		dragCont.style.width = ns6?winMinWidth:winMinWidth-6;
		dragCont.style.height = ns6?winMinHeight-20:winMinHeight-24;
	}
}

function openWin(windowName, contentName, topWin, leftWin, winMinWidth, winMinHeight){
	if(ie5 || ns6){
		dragWind = document.getElementById(windowName);
		dragCont = document.getElementById(contentName);
		dragWind.style.visibility = "visible";
		dragWind.style.top = topWin+'px';
		dragWind.style.left = leftWin+'px';
		dragWind.style.width = winMinWidth+'px';
		dragWind.style.height = winMinHeight+'px';
		dragCont.style.top = 20+'px';
		dragCont.style.left = 0+'px';
		dragCont.style.width = ns6?winMinWidth:winMinWidth-6;
		dragCont.style.height = ns6?winMinHeight-20:winMinHeight-24;
		dragWind.style.zIndex = (start.zCount++);
	}
}

function dragInit(){
	if(ie5 || ns6){
		imgs = document.getElementById("container").getElementsByTagName("IMG");
		for(var i=0; i<imgs.length;i++){
			imgs[i].style.cursor = (ie5)?"hand":"pointer";
			imgs[i].ondragstart = new Function("return false");
		}
		openWin('wind','cont',200,300,300,250);
	}
}

document.onmousemove = drag;
document.onmouseup = new Function("active=0");
document.onselectstart = new Function("return false");