var photoWin = null;

function viewPhoto( imgSrc, imgTitle ) {

    if( photoWin ) {
        photoWin.close();
    }
	photoWin = window.open( '', 'photoWin', 'width=150,height=150' );

	var htm = '<html>' +
		'<head>' +
		'<title>' + imgTitle + '</title>' +
		'<meta http-equiv="imagetoolbar" content="false" />' +
		'</head>' +
		'<body style="margin: auto; padding: auto; overflow: hidden;" onload="document.getElementById(\'theDiv\').style.visibility=\'visible\';window.resizeTo(document.images[ \'theImage\' ].width+10,document.images[ \'theImage\' ].height+68);">' +
		'<p style="font: 11px Verdana,sans-serif; position: absolute; top: 10px; left: 10px;">Loading...</p>' +
		'<div id="theDiv" style="visibility: hidden; position: absolute; top: 0; left: 0;"><img src="' + imgSrc + '" border="0" id="theImage" alt="' + imgTitle + '" /></div>' +
		'</body>' +
	'</html>';

	photoWin.document.write( htm );
	photoWin.document.close();

}

function viewProdPhoto( imgSrc, imgTitle ) {

	var view = 1;
    if( photoWin ) {
        photoWin.close();
    }
	img = document.images[ 'prodPhoto' ];

	if (!img.extra_data){
		img.extra_data = new function(){};
		img.extra_data.visible = 1;
	}
	if( img.extra_data.visible != 1 ){
		view = 0;
	}

	if( view == 1 ){

	    photoWin = window.open( '', 'photoWin', 'width=150,height=150' );

	    var htm = '<html>' +
	        '<head>' +
	        '<title>' + imgTitle + '</title>' +
	        '<meta http-equiv="imagetoolbar" content="false" />' +
	        '</head>' +
	        '<body style="margin: auto; padding: auto; overflow: hidden;" onload="document.getElementById(\'theDiv\').style.visibility=\'visible\';window.resizeTo(document.images[ \'theImage\' ].width+10,document.images[ \'theImage\' ].height+68);">' +
	        '<p style="font: 11px Verdana,sans-serif; position: absolute; top: 10px; left: 10px;">Loading...</p>' +
	        '<div id="theDiv" style="visibility: hidden; position: absolute; top: 0; left: 0;"><img src="' + imgSrc + '" border="0" id="theImage" alt="' + imgTitle + '" /></div>' +
	        '</body>' +
	    '</html>';

	    photoWin.document.write( htm );
	    photoWin.document.close();
	}
}

function click_to_enlarge_visible() {

	img = document.images[ 'prodPhoto' ];
	if (!img.extra_data){
		img.extra_data = new function(){};
	}
	img.extra_data.visible = 1;

}

function click_to_enlarge_hide() {

	img = document.images[ 'prodPhoto' ];
	if (!img.extra_data){
		img.extra_data = new function(){};
	}
	img.extra_data.visible = 0;

}
