lastDiv = null;
function divClick(theDiv,LayOutId,ModuleId) {
	if (lastDiv) {
		lastDiv.style.borderColor = "#4872AD";
		lastDiv.style.borderStyle = "dotted";
	    lastDiv.style.borderTopWidth = 0
	    lastDiv.style.borderBottomWidth = 1
	    lastDiv.style.borderLeftWidth = 1
	    lastDiv.style.borderRightWidth = 1
	    lastDiv.style.borderTopStyle = "solid";
	}
	
	lastDiv = theDiv;
	
	theDiv.style.borderColor = "#4872AD";
	theDiv.style.borderStyle = "solid";
	theDiv.style.borderTopWidth = 0
	theDiv.style.borderBottomWidth = 1
	theDiv.style.borderLeftWidth = 1
	theDiv.style.borderRightWidth = 1

	document.Data.LayOutId.value = LayOutId;
	document.Data.ItemId.value = ModuleId;
	
	//alert(LayOutId)
	document.getElementById("ModuleUp").href = "Admin/ModuleUp.aspx?ModuleId=" + ModuleId; 
}

function IgnoreEvents(e)
{
  return false
}
 
function ShowWindow(strurl)
{
  if (window.showModalDialog)
  {
    window.showModalDialog(strurl,null,
    "dialogWidth=310px;dialogHeight=300px")
  }
  else
  {
    window.top.captureEvents (Event.CLICK|Event.FOCUS)
    window.top.onclick=IgnoreEvents
    window.top.onfocus=HandleFocus 
    winModalWindow = 
    window.open (strurl,"ModalChild",
       "dependent=yes,width=310,height=300")
    winModalWindow.focus()
  }
}

 
function HandleFocus()
{
  if (winModalWindow)
  {
    if (!winModalWindow.closed)
    {
      winModalWindow.focus()
    }
    else
    {
      window.top.releaseEvents (Event.CLICK|Event.FOCUS)
      window.top.onclick = ""
    }
  }
  return false
}



var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function enlarge(which, e, position, imgwidth, imgheight){

if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (position=="center"){
pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
horzpos=ns6? pageXOffset+window.innerWidth/2-imgwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2
vertpos=ns6? pgyoffset+window.innerHeight/2-imgheight/2 : pgyoffset+ietruebody().clientHeight/2-imgheight/2
if (window.opera && window.innerHeight) //compensate for Opera toolbar
vertpos=pgyoffset+window.innerHeight/2-imgheight/2
vertpos=Math.max(pgyoffset, vertpos)
}
else{
//var horzpos=ns6? pageXOffset+e.clientX : ietruebody().scrollLeft+event.clientX
//var vertpos=ns6? pageYOffset+e.clientY : ietruebody().scrollTop+event.clientY

var horzpos=ns6? pageXOffset+20 : ietruebody().scrollLeft+20
var vertpos=ns6? pageYOffset+20 : ietruebody().scrollTop+20

}
crossobj.style.left=  horzpos+"px"
crossobj.style.top= vertpos+"px"

crossobj.innerHTML='<div align="right" id="dragbar"><span id="closetext" onClick="closepreview()">Close</span> </div><img src="'+which+'">'
crossobj.style.visibility="visible"
return false
}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
return true
}

function closepreview(){
crossobj.style.visibility="hidden"
}

function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx+"px"
crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")

