// JavaScript Document
function close_popup()
{
	popupbox = document.getElementById("popup");
	popupbox.style.display='none';
}

var num = 0;
function appear_box() {
	num = 0;
	popupbox = document.getElementById("popup");
	popupbox.style.display = 'block';
	
	//for centering popup in screen
	//get center point
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	var my_x=((myWidth/2)-378);
	getPageScroll();
	var my_y=arrayPageScroll[1]+20;
	popupbox.style.left = my_x+'px';
	popupbox.style.top = my_y+'px';
}

//function to change enlarge pic while thumb is clicked
function change_pic(img_path) {
		my_image = new Image();
		my_image.src  = img_path;
		if (document.images)
		{
			document.images['enlarge-pic'].src = my_image.src;
		}
}

function getPageScroll(){

	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}
