<!--

function artworkPop(artworkId, showPrice, ids) {
	if (showPrice == 1) {
		window.open('artwork_popup.php?wid='+artworkId+'&ids='+ids+'&pre=1', '', 'resizable=0,width=400,height=580,scrollbars=0');
	} else {
		window.open('artwork_popup.php?wid='+artworkId+'&ids='+ids, '', 'resizable=0,width=400,height=580,scrollbars=0');
	}
}

if (jQuery.browser.mozilla == true && jQuery.browser.version.substring(0, 5) == "1.8.1" && parseFloat(jQuery.browser.version.substring(6)) < 12) {
	var flashWithOpacity = false;
} else {
	var flashWithOpacity = true;
}

var showingLightbox = 0;

function closeLightbox(doFade){
	showingLightbox = 0;
	$('#jquery-lightbox').remove();
	if (doFade == 1) { 
		$('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); });
	} else {
		$('#jquery-overlay').remove();
	}
	$('select').css({ 'visibility' : 'visible' });
}

function openLightbox(imageFile){
	showingLightbox = 1;
	$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="jquery-lightbox-back"></div><div class="lightbox-container-image-box"><div class="lightbox-container-image"><div class="lightbox-content"></div><div class="lightbox-loading"><a href="#" class="lightbox-loading-link"></a></div></div></div></div>');
	
	var arrPageSizes = ___getPageSize();
	$('#jquery-overlay').css({
			backgroundColor:	"#FFF",
			opacity:			flashWithOpacity == false ? 1 : 1,
			width:				arrPageSizes[0],
			height:				arrPageSizes[1]
		}).fadeIn();
	var arrPageScroll = ___getPageScroll();
	$('#jquery-lightbox').css({
			top:	arrPageScroll[1],
			left:	arrPageScroll[0]
		}).show();
	$('#jquery-overlay, #jquery-lightbox-back').click(function() {
			closeLightbox(1);
			return false;
		});
	
	$('.lightbox-content').hide();
	var imgPreloader = new Image();
	imgPreloader.onload = function() {
		if (showingLightbox == 1) {
			$('.lightbox-content').html('<a href="#" onclick="closeLightbox(1); return false">Return to Details</a><img src="'+imgPreloader.src+'" title="click to close" /><div id="overImg"></div>');
			$('.lightbox-content').show();
			$('.lightbox-loading').hide();
			$('.lightbox-container-image-box').click(function() {
				closeLightbox(1);
				return false;
			});
			
			$('.lightbox-container-image-box').css({ width: imgPreloader.width, height: 552 + 101 }); // imgPreloader.height
			
			imgPreloader.onload=function(){};
		}
	};
	imgPreloader.src = imageFile;
	
	setupWindowResize();
}
	
function setupWindowResize(){
	$(window).resize(function() {
			// Get page sizes
			var arrPageSizes = ___getPageSize();
			// Style overlay and show it
			$('#jquery-overlay').css({
				width:		arrPageSizes[0],
				height:		arrPageSizes[1]
			});
			// Get page scroll
			var arrPageScroll = ___getPageScroll();
			// Calculate top and left offset for the jquery-lightbox div object and show it
			$('#jquery-lightbox').css({
				top:	arrPageScroll[1],
				left:	arrPageScroll[0]
			});
			$('#jquery-blank-anchor').css({
					top: arrPageScroll[1]
				})
		});
	
	var arrPageScroll = ___getPageScroll();
	$('#jquery-blank-anchor').css({
			top: arrPageScroll[1]
		})
}



function pdf(pdffile, title) {
	msg=window.open("","janmurphygallery",",width=670,height=550,left=20,top=20,resizable=yes,menubar=no,location=no,directories=no,status=yes");
	msg.document.write("<html><title>" + title + "</title>");
	msg.document.write("<frameset border=0 rows='100%,*' frameborder='no' marginleft='0' margintop='0' marginright='0' marginbottom='0'>");
	msg.document.write("<frame src='" + pdffile + "' scrolling='auto' frameborder='no' border='0' noresize>");
	msg.document.write("<frame  topmargin='0' marginwidth='0' scrolling='no' marginheight='0' frameborder='no' border='0' noresize>");
	msg.document.write("</frameset><noframes><a href='" + pdffile + "'>Pdf File</noframes></html>");
}

function getObj(objectId)
{
// cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	this.obj = document.getElementById(objectId);
	this.style = document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	this.obj = document.all(objectId);
	this.style = document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	this.obj = document.layers[objectId];
	this.style = document.layers[objectId];
    } else {
	return false;
    }
}

//------------End Floating Objects---------------

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
} // changeObjectVisibility

//-->







/*
 THIRD FUNCTION
 getPageSize() by quirksmode.com
 
 return Array Return an array with page width, height and window width, height
*/
function ___getPageSize() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
};

/*
 THIRD FUNCTION
 getPageSize() by quirksmode.com
 
 return Array Return an array with page width, height and window width, height
*/
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;
};