﻿// JScript File

var popup=window.createPopup();
var anim=window.createPopup();
var x=0;
var y=0;

if (document.layers) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=mtrack;


function mtrack(e) {
   if (document.layers) {x=e.pageX; y=e.pageY;}
   else {x=event.x; y=event.y;}
}

function closepopup() {popup.hide(); if (anim.isOpen) anim.hide();}

function openFinish(URL,xSize,ySize,xPos,yPos) {
	if (isNaN(xSize)) {xSize=380; ySize=320;}
		
	if (isNaN(xPos)) {xPos = x;	yPos = y;}
	else{
		if (xPos<0)	xPos = x;
		if (yPos<0) yPos = y;
	}

	popup.document.body.innerHTML=document.getElementById("popupFinish").innerHTML;
			
	var obj=popup.document.getElementById("popupFinishImage");
	obj.src='/Gallery/finish-images/' + URL;
	obj.width=xSize;
	obj.height=ySize;
			
	var i=URL.indexOf('/');
	if (i >= 0) URL=URL.substring(i+1);//Remove path
	URL=URL.substring(0, URL.length-4);// Remove extension
	if (URL.charAt(URL.length-1)=='u') URL=URL.substring(0, URL.length-1);

	obj=popup.document.getElementById("popupFinishDesc");
	obj.innerHTML=URL;
	i = URL.length*12;
	if (i<50) i=50;
	obj.style.width= i;
	obj.style.left=xSize-i+3;

	popup.show(xPos, yPos, xSize+6, ySize+6, document.body);
}

function popupImage(URL,xSize,ySize) {
	popup.document.body.innerHTML=document.getElementById("popupFinish").innerHTML;
			
	var obj=popup.document.getElementById("popupFinishImage");
	obj.src=URL;
	obj.width=xSize;
	obj.height=ySize;
			
	obj=popup.document.getElementById("popupFinishDesc");
	obj.style.display="none";

	popup.show(x, y, xSize+6, ySize+6, document.body);
}

function openEMail(url,Name) {
   winStats='toolbar=no,location=no,directories=no,menubar=no,scrollbars=no';

   xSize=380;
   ySize=328;
   winStats+=',width=' + xSize + ',height=' + ySize;

   xPos = (screen.width - xSize) / 2;
   yPos = (screen.height - ySize) / 2;

   if (navigator.appName.indexOf("Microsoft") >= 0) {
      winStats+=',left=' + xPos + ',top=' + yPos;
   }else{
      winStats+=',screenX=' + xPos + ',screenY=' + yPos;
   }
   floater=window.open('/Utilities/EmailPage.aspx?URL='+escape(url)+'&Name='+Name,'EmailPage',winStats);
}