// JavaScript Document
$(document).ready(function(){
	var newwin = 0;
	
    $(".product_main_container", document.body).each(function () {
		$(this).find('a.quote').click(function() {
			var pObj = $(this).parent().parent();

			if($(this).parent().parent().get(0).className == 'product_main_container'){	
				$.cookie('quote_img',null);
				$.cookie('quote_code',null);
				$.cookie('quote_title',null);
				
				$.cookie('quote_title',pObj.find('.quote_title').text());
				$.cookie('quote_code',pObj.find('.quote_code').text());
				$.cookie('quote_img',pObj.find('img.quote_img').attr('src'));
			}
			if(newwin){if(!newwin.closed) newwin.close();}			
			newwin = window.open( $(this).attr('href'),'quotation','width=394px,height=750px');return false;
			
			
		});
    });
	$(".product_mid", document.body).each(function () {
		$(this).find('a.quote').click(function() {
			var pObj = $(this).parent().parent();

			if($(this).parent().parent().get(0).className == 'product_mid'){	
				$.cookie('quote_img',null);
				$.cookie('quote_code',null);
				$.cookie('quote_title',null);
				
				$.cookie('quote_title',pObj.find('.quote_title').text());
				$.cookie('quote_code',pObj.find('.quote_code').text());
				$.cookie('quote_img',pObj.find('img.quote_img').attr('src'));
			}
			if(newwin){if(!newwin.closed) newwin.close();}
			newwin = window.open( $(this).attr('href'),'quotation','width=394px,height=750px');return false;
//			newwin.focus();
		});
    });
});

// -->

