// JavaScript Document


//--------------------popup script----------
var ie=document.all
var ns6=document.getElementById&&!document.all



function showimage(image,imgwidth,leftpos,toppos){
		dragobj=document.getElementById("dragbar")  //it is important to define the dragbar width to fix bags in mozilla and ie-mac
		dragobj.style.width= imgwidth-2+"px"        //-2 for the added pixles of the border
		dragobj.innerHTML='<img src="i/close.gif" onClick="closepop()">'
		popdiv=document.getElementById("imgpop")
		popdiv.style.marginLeft="0px"
		popdiv.style.marginTop="0px"
		popdiv.style.left=leftpos+"px"
		popdiv.style.top=toppos+"px"
		MM_swapImage('changingimage','',image,1)
		popdiv.style.visibility="visible"
		printobj=document.getElementById("printpop")
		printobj.innerHTML='<a href="#" onclick="printpop(\''+image+'\')"><img src="i/print.gif" border="0" id="printgif"></a>'
	}
function printpop(image)	{
	popWin=window.open('print-picture.htm?pic='+image)
		if(window.focus) {
			popWin.focus();
		}
	}

function showimage_center(image,imgwidth,imgheight){
	dragobj=document.getElementById("dragbar")  //it is important to define the dragbar width to fix bags in mozilla and ie-mac
	dragobj.style.width= imgwidth-2+"px"        //-2 for the added pixles of the border
	dragobj.innerHTML='<img src="i/close.gif" onClick="closepop()">'
	popdiv=document.getElementById("imgpop")
		
	//centering the layer- top position  with style.top 50% & style.marginTop -height/2
	//centering the layer- left position with style.left 50% & style.marginLeft -width/2
	popdiv.style.left="50%"
	popdiv.style.marginLeft=-imgwidth/2+"px"
	if ((is_ie5up) && (is_mac)){ //fix for ie-mac does not accept popdiv.style.top="50%"
		popdiv.style.top="0px"
		popdiv.style.marginTop="0px"
	}else{
		popdiv.style.top="50%"
		popdiv.style.marginTop=-imgheight/2+"px"
	}
	MM_swapImage('changingimage','',image,1)
	popdiv.style.visibility="visible"
	
	//*----very important to keep the following lines in correct order-----*//
	leftpos=popdiv.offsetLeft
	toppos=popdiv.offsetTop
	popdiv.style.marginTop="0px"
	popdiv.style.marginLeft="0px"
	popdiv.style.left=leftpos+"px"
	popdiv.style.top=toppos+"px"
		
}

function closepop(){
popdiv.style.visibility="hidden"
MM_swapImage('changingimage','','i/imgpop.gif',1) //we change the image again so the last image & properties will not stay in memory
}

function drag_drop(e){
	if (ie&&dragapproved){
		popdiv.style.left=tempx+event.clientX-offsetx+"px"
		popdiv.style.top=tempy+event.clientY-offsety+"px"
	}
	else if (ns6&&dragapproved){
		popdiv.style.left=tempx+e.clientX-offsetx+"px"
		popdiv.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(popdiv.style.left)
		tempy=parseInt(popdiv.style.top)/**/
		dragapproved=true
		document.onmousemove=drag_drop
	}
}

function printimage(){
	dragobj=document.getElementById("imgpop");
	//dragobj.print();
	}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")

/*-------------------print style switcher--------------------*/
/*var printSwitcher = new bodySwitcher('print-switcher', 'Print styles');
printSwitcher.defineClass(
  'default','Default'
);
printSwitcher.defineClass(
  'popup-print','popup Ptint'
);*/
