/*
* REQUERE FILE CURSOR POSITIONS.js
*/

/**
* This file is used for zoom photo in a layer
*
*
*/
if(typeof dmTxtClose=='undefined')
	var dmTxtClose = 'close';

if(typeof dmImgMove=='undefined')
	var dmImgMove = 'move.gif';

var dmImgPath = 'js/drag_move/';

/**
* Move
*
*/
var dragapproved=false;
var z,x,y;
function move(e)
{
	if (!e) var e = window.event;	
	var evBut = e.button; //e.which	
	if ((evBut==1 || evBut===0)&&dragapproved)
	{		
		z.style.left=(temp1+e.clientX-x)+'px';
		z.style.top=(temp2+e.clientY-y)+'px';		
		window.status = z.style.left + ' x ' + z.style.top;
		return false;
	}	
}

/**
* Drag
*
*/
function drags(e)
{
	if (!document.all)
		;//return;			
	if (!e) 
		var e = window.event;	
	if (e)
	{				
		var srcEl = e.srcElement ? e.srcElement : e.target;		
		if (srcEl.className=="dragMove")
		{
			dragapproved=true;			
			z=srcEl.offsetParent ? srcEl.offsetParent:srcEl;			
			temp1=findPosX(z);
			temp2=findPosY(z);
			x=e.clientX;
			y=e.clientY;
			document.onmousemove=move;			
		}
	}
}

document.onmousedown=drags;
document.onmouseup=new Function("dragapproved=false");

function destroyObjDrag(objSpan)
{	
	var elem = document.getElementById(objSpan);
	elem.innerHTML='';
	elem.style.visibility='hidden';
}

function buildObjDrag(objPreviewName, imgSrc)
{	
	var elemPreview = findDOM(objPreviewName,0);	
	elemPreview.innerHTML=''+
		'<table border=0 cellspacing=0 cellpadding=0 style="border:1px solid #000000">'+
			'<tr>'+
				'<td colspan=2 class=dragMoveBd style=\'background-repeat:no-repeat; background-image:url(images/site/dragmovtitle.gif); background-position:center;\'>'+
					'<table width=100% border=0 cellspacing=0 cellpadding=0>'+
						'<tr height=20 style=\'border:1px;\'>'+
							'<td align=left background='+dmImgPath+dmImgMove+' style=\'background-repeat:no-repeat\'><img class=dragMove src='+dmImgPath+'spacer.gif width=100% height=21 border=0 align=absmiddle></td>'+
							'<td width=50 align=right class=dragMoveBg><a href=javascript:destroyObjDrag(\''+objPreviewName+'\') class=dragMoveLink>'+dmTxtClose+'</a>&nbsp;&nbsp;</td>'+
						'</tr>'+
					'</table>'+
				'</td>'+
			'</tr>'+
			'<tr style="background-color:#FFFFFF;" align=center>'+
				'<td colspan=2><img class=dragMove src='+imgSrc+' border=0></td>'+
			'</tr>'+
			'<tr style="background-color:#FFFFFF;">'+
				'<td><img class=dragMove src="images/site/print.gif"></td>'+
				'<td align=right onClick=printContent(\''+imgSrc+'\');><img class=dragMove src="images/site/print_ico.gif" border=0></td>'+
			'</tr>'+
		'</table>';
	elemPreview.style.visibility='visible';
}

//##########################################################################//

function CheckIsIE() 
{ 
    if  (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER')  { return true;} 
    else { return false; } 
} 

function printContent(imgSrc)
{ 	
	var _ifr_printimg = findDOM('ifr_printimg',0);
	
	var _imgprint = findFrameDOM('imgprint', 0, 'ifr_printimg', 1)	
	_imgprint.src=imgSrc;
	
	 if (CheckIsIE() == true) 
	{ 
		document.ifr_printimg.focus(); 
		document.ifr_printimg. print(); 
	}      
	else 
	{ 
		window.frames['ifr_printimg'].focus(); 
		window.frames['ifr_printimg'].print(); 
	} 
}