var loadingImg;
var loadingImgTimer;
var loadingImgIE=0;
var BigImgPosX=0;
var BigImgPosY=0;
var BigImgPosBeforeX;
var BigImgPosBeforeY;
var BigImg1IsMoving;

function SetBigImg(){
	loadingImg=document.getElementById("ImgBigImg1").src;
	if(window.innerWidth==null){
		loadingImgIE=1;
		window.innerWidth=document.documentElement.clientWidth;
		window.innerHeight=document.documentElement.clientHeight;
	}
	MoveBigImg();
}

function CloseBigImg(){
	document.getElementById("BigImg1Close").onclick = function(){
		clearTimeout(loadingImgTimer);
		str='';
		$='document.getElementById';
		str+=$+'("DivBigImg1").style.display="none";';
		str+=$+'("ImgBigImg2").src="\\\""+loadingImg+"\\\"";';
		str+=$+'("ImgBigImg2").style.display="none";';
		str+=$+'("ImgBigImg1").style.display="inline-block";';
		eval(str);
	};
}


function BigImgMousePosition(e){
	if(e==undefined){e = window.event || window.Event;}else{document.captureEvents(Event.MOUSEMOVE);}
	if(e.pageX){
		BigImgPosX = e.pageX;
		BigImgPosY = e.pageY;
	}
	else if(e.clientX){
		BigImgPosX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		BigImgPosY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}
}

function MoveBigImg(){
	document.getElementById("DivBigImgTitleBar1").onmouseup = function(){
		BigImg1IsMoving = false;
	};
	document.getElementById("BigImg1MovingArea").onmouseup = function(){
		BigImg1IsMoving = false;
	};

	document.getElementById("DivBigImgTitleBar1").onmousemove = function(e){
		if(BigImg1IsMoving){
			BigImgMousePosition(e);
			distanceX = BigImgPosBeforeX - BigImgPosX;
			distanceY = BigImgPosBeforeY - BigImgPosY;
			document.getElementById("DivBigImg1").style.left = (parseInt(document.getElementById("DivBigImg1").style.left) - distanceX) + 'px';
			document.getElementById("DivBigImg1").style.top = (parseInt(document.getElementById("DivBigImg1").style.top) - distanceY) +'px';
			BigImgPosBeforeX = BigImgPosX;
			BigImgPosBeforeY = BigImgPosY;

		}
	};
	document.getElementById("BigImg1MovingArea").onmousemove = function(e){
		document.getElementById("DivBigImgTitleBar1").onmousemove();
	};
	
	document.getElementById("DivBigImgTitleBar1").onmouseout = function(e){
		document.getElementById("DivBigImgTitleBar1").onmousemove();
	};
	document.getElementById("BigImg1MovingArea").onmousout = function(e){
		document.getElementById("DivBigImgTitleBar1").onmousemove();
	};
	
	document.getElementById("DivBigImgTitleBar1").onmousedown = function(e){
		BigImg1IsMoving = true;
		BigImgMousePosition(e);
		BigImgPosBeforeX = BigImgPosX;
		BigImgPosBeforeY = BigImgPosY;
	};
	
	document.getElementById("BigImg1MovingArea").onmousedown = function(e){
		BigImg1IsMoving = true;
		BigImgMousePosition(e);
		BigImgPosBeforeX = BigImgPosX;
		BigImgPosBeforeY = BigImgPosY;
	};
	
	document.getElementById("DivBigImgTitleBar1").onmouseover = function(){
		document.getElementById("DivBigImgTitleBar1").style.cursor = "move";
	}
	document.getElementById("BigImg1MovingArea").onmouseover = function(){
		document.getElementById("BigImg1MovingArea").style.cursor = "move";
	}
}

function SwapBigImg(){
	str='';
	$='document.getElementById';
	str+=$+'("ImgBigImg1").style.display="none";';
	str+=$+'("ImgBigImg2").style.display="inline-block";';
	eval(str);
}

