 /*!
 * jQuery JavaScript Library v1.3.1
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 */
$(document).ready(function(){
 
 /*Enlarge ProductImage when Icon.ResizeImg was clicked */
 $(".ResizeImg").click(  function(){ 	
										var object = $(this).parents("table.productImgSection").find(".imageProduct");
										ShowEnlargedProductImage(object, true); });
										
 $(".ShowAddonInfo").click(  function(){ 	
										var object = $(this).parents("table.productImgSection").find(".imageAddOnProduct");
										if(!$(object).parents("table.productImgSection").find("div.zoomdescX").is(":visible"))
										{
										  $("div.zoomdescX:visible").hide("fast");
										  ShowAddonProductInfo(object, true);  
										 }  
										});
										

 $(".Close").click(  function(){ $(this).parents("div.zoomdescX").hide("normal"); });

          
 $("a.jqbookmark").click(function(event){  
         event.preventDefault(); // prevent the anchor tag from sending the user off to the link  
         var url = this.href;  
         var title = this.title;  
         if (window.sidebar) { // Mozilla Firefox Bookmark  
             window.sidebar.addPanel(title, url,"");  
         } else if( window.external ) { // IE Favorite  
             window.external.AddFavorite( url, title);  
         } else  { // for Opera , Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)  
              alert('Unfortunately, this browser does not support the requested action,'  
              + ' please bookmark this page manually. Press CTRL-D to bookmark.');  
         }  
   }); 

         
});

function ShowEnlargedProductImage(object, isCentered)
{
	if(!$(object).parents("table.productImgSection").find("div.zoomdescX").is(":visible"))
	{
	  $("div.zoomdescX:visible").hide("fast");
	  EnlargeProductImage(object, isCentered);  }  

}

function EnlargeProductImage(object, isCentered){
     var position = $(object).position(); 
     var divFullSize = $(object).parents("table.productImgSection").find("div.zoomdescX");
     var imageProductLarge = divFullSize.find(".imageProductFullSize");
       if (isCentered) {
       divFullSize.css("top", position.top -(imageProductLarge.parents("div.zoomdescX").height() - $(object).height())/2);  
	   divFullSize.css("left", position.left -(imageProductLarge.parents("div.zoomdescX").width() - $(object).width())/2);
	   }
	   else
	   {
	   divFullSize.css("top", position.top); 
	   divFullSize.css("left", position.left);
	   }
	   divFullSize.show("fast"); 
  }


function ShowAddonProductInfo(object, isCentered){
     var position = $(object).parents("div.divAddons").position();
     var divFullSize = $(object).parents("table.productImgSection").find("div.zoomdescX");
     var imageProductLarge = divFullSize.find(".imageProductFullSize");
     if (isCentered) {
       divFullSize.css("top", position.top + $(object).parents("div.divAddons").height()*1.2 - divFullSize.height() ) ;  
	   divFullSize.css("left", position.left + ( $(object).parents("div.divAddons").width() - divFullSize.width()) /2);
	 }
	 else
	 {
	   divFullSize.css("top", position.top); 
	   divFullSize.css("left", position.left);
	 }
	 divFullSize.show("fast"); 
  }
