/* originally this was for the menu (accordion features)
   now it is the main javascript for the site
	the other javascript products.js is for specific features
	of the online store (swatch management etc)*/




/* this popup creates a window with the image centered by a table 
    -- in a future revision would be good to do this with a modal lightbox window */
function img_popup(img) {
 var Popup = window.open("", "_blank",  "toolbar=0,resize=1,status=0,menubar=0,scrollbars=1,width=800,height=800");
 Popup.document.open();
 Popup.document.write("<html><head><title>SPI Design</title></head><body>");
 Popup.document.write('<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle" width="800" height="750">');
 Popup.document.write("<img src='" + img + "'>");
 Popup.document.write("</td></td></table>");
 Popup.document.write("</body></html>");
 Popup.document.close();
}



$(document).ready( function() {
									 
									 
		$('#toptxt img').hover( 
									  function(){ $(this).css('opacity',.8); }, 
									  function(){$(this).css('opacity',1)});
		
		
		$("#logo img").hover(
				function() { 
						var source = $(this).attr("src");
						source = source.replace("logo.gif", "logo2.gif");
						$(this).attr("src", source);
						},
				function() {
						 var source = $(this).attr("src");
						source = source.replace("logo2.gif", "logo.gif");
						$(this).attr("src", source);
				});
	
		// different sized popups
		// a lot of these have to be called from products init because content is dynamically loaded
			$('.modalopen').click(function(){ 
					img_popup(this.href);
					return false;
				});
			
	      $('img.largeimageopen').click(function(){ 
					img_popup(  $(this).attr('src').replace('_med','_lge') );
					return false;
				});
			
		$('a.popup').click(function(){ 
					window.open(this.href, 
						'_blank',
						'scrollbars=yes,resizable=yes,width=600,height=400');
					return false;
				});
		$('a.popupSmall').click(function(){ 
					window.open(this.href, 
								'_blank',
								'scrollbars=yes,resizable=yes,width=400,height=280');
					return false;
				});
		$('a.popupVideo').click(function(){ 
					window.open(this.href, 
								'_blank',
								'scrollbars=yes,resizable=yes,width=650,height=500');
					return false;
				});

 
 
	
	})	
		

