/*
Thumbnail image viewer- 
© Dynamic Drive (www.dynamicdrive.com)
For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/


function enlarge(which,e){
//Render image code for IE 4+
if (document.all){
	if (imgLyr.style.visibility=="hidden"){
		imgLyr.style.left=document.body.scrollLeft+event.clientX
		imgLyr.style.top=document.body.scrollTop+event.clientY
		imgLyr.innerHTML='<img src="'+which+'" border=3>'+'<FORM><center><INPUT TYPE="button" VALUE="Close"'+'onClick="imgHide()"></center></FORM>'
		imgLyr.style.visibility="visible"
	}
	else
		imgLyr.style.visibility="hidden"
		return false
	}
//Render image code for NS 4
else if (document.layers){
	if (document.imgLyr.visibility=="hide"){
document.imgLyr.document.write('<a href="#"onMouseover="drag_dropns(imgLyr)"><img src="'+which+'" border=3></a>')
		document.imgLyr.document.close()
		document.imgLyr.left=10	//e.x
		document.imgLyr.top=10	//e.y
		document.imgLyr.visibility="show"
	}
	else
		document.imgLyr.visibility="hide"
		return false
	}
//if NOT IE 4+ or NS 4, simply display image in full browser window
else
	return true
}

function imgHide() {					// ADY
	if (document.all)
		imgLyr.style.visibility="hidden";
	else if (document.layers)
		document.imgLyr.visibility="hide"; 
	return false;
}


//By Dynamicdrive.com
//drag drop function for NS 4////
/////////////////////////////////

var nsx
var nsy
var nstemp

function drag_dropns(name){
	temp=eval(name)
	temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
	temp.onmousedown=gons
	temp.onmousemove=dragns
	temp.onmouseup=stopns
}

function gons(e){
	temp.captureEvents(Event.MOUSEMOVE)
	nsx=e.x
	nsy=e.y
}

function dragns(e){
	temp.moveBy(e.x-nsx,e.y-nsy)
	return false
}

function stopns(){
	temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for IE 4+////
/////////////////////////////////
var dragapproved=false

function drag_dropie(){
	if (dragapproved==true){
	document.all.imgLyr.style.pixelLeft=tempx+event.clientX-iex
	document.all.imgLyr.style.pixelTop=tempy+event.clientY-iey
	return false
	}
}

function initializedragie(){
	if (event.srcElement.parentElement.id=="imgLyr"){
		iex=event.clientX
		iey=event.clientY
		tempx=imgLyr.style.pixelLeft
		tempy=imgLyr.style.pixelTop
		dragapproved=true
		document.onmousemove=drag_dropie
	}
}

if (document.all){
	document.onmousedown=initializedragie
	document.onmouseup=new Function("dragapproved=false")
}


function imgOn(imgName) {
	//document[imgName].style.borderWidth="medium"
	 if (document.all) 
	 	document[imgName].style.borderColor="yellow"
}
function imgOff(imgName) {
	//document[imgName].style.borderWidth="thin"
	if (document.all) 
		document[imgName].style.borderColor="teal"
}

//////////////////////////////////////////////////////////////////////
//
function display_image(url) {
	PreView = window.open("","Preview","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=500,height=500");
	PreView.document.open();
	PreView.document.write("<HTML><HEAD>");
	PreView.document.write("<TITLE>Preview</TITLE>");
	PreView.document.write("</HEAD><BODY BGCOLOR='#00000000' BACKGROUND='img/sky.jpg' TEXT='#FFFFFFFF'>");
// onBlur='this.focus()'
	PreView.document.write("<FORM><CENTER><B><FONT SIZE=+1>" + url + "</FONT></B><HR>");
	PreView.document.write("<IMG HSPACE=0 VSPACE=0 " + "SRC='" + url + "'>");
	PreView.document.write("<HR><FORM><INPUT TYPE='button' VALUE='Close' " + "onClick='window.close()'></FORM>");
	PreView.document.write("</CENTER>");
	PreView.document.write("</BODY></HTML>");
	PreView.focus();
	PreView.document.close();
}

function setMsg(msg) {
	window.status = msg
	return true
}
