$('head').append( '<link rel="stylesheet" type="text/css" href="css/screen_catalogs.css" media="screen" />' );
$('head').append( '<link rel="stylesheet" type="text/css" href="css/print_catalogs.css" media="print" />' );

var popFrame, frameHeight, frameWidth, borders;
var thumbLoad = false;

function save_inquiry ( inventoryNumber ) {
	$( "span#" + inventoryNumber ).html ( "Item <b>Added</b> to Inquiry List" );
	show_button ();
	xajax_addToInquiry ( inventoryNumber );
}

// Pop-up picture

$( document ).ready ( function () {
	$( ".pop" ).click ( function () {
		if ( popFrame ) pop_hide( popFrame );
		popFrame = $( this ).next( 'div' );
 		borders = parseInt ( popFrame.children ( "img" ).css( 'borderTopWidth' )) * 2;
		frameWidth = parseInt ( popFrame.children ( "img" ).css ( "width" )) + borders;
		frameHeight = parseInt ( popFrame.children ( "img" ).css ( "height" )) + 54;
		pop_show ();
		return false;
	});
	$( window ).resize ( pop_position ).scroll ( pop_position );
});

function pop_show () {
	$( popFrame ).click ( function ()
		{
			pop_hide ( popFrame );
		}
	);
	thumbLoad = true;
	pop_position ();
}

function pop_hide ( frameName ) {
	$( frameName ).slideUp ( "medium" );
	thumbLoad = false;
	return false;
}

function pop_position () {
	if ( thumbLoad ) {
		$( popFrame ).css (
			{
				width: frameWidth,
				left: (( $( window ).width() - frameWidth ) / 2 ) + "px",
				top: ((( $( window ).height() - frameHeight ) / 2 ) + $( window ).scrollTop() ) + "px",
				display: "none",
				opacity: 1
			}
		).slideDown ( "medium" );
	}
 }

