function preloadImages() {
	  var d=document; if(d.images){ if(!d.p) d.p=new Array();
	    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
	}


$(function() {
	
	$("select[name=categoryfilter]").change(function(event){
		var url=$("base").attr("href")+"admin/product/?categoryfilter=" +$("#categoryfilter option:selected").val();                    
		window.location = url;
		return false;
	});
	
	
	
	
    $('a[href^="#zoom-"]').click(function(event){
        var Id = this.href.split('#zoom-')[1];
        var noZoom = $(this).hasClass('noZoom');
        $("#dialog-modal-"+ Id).load('products/photozoom/?pictureId=' + Id,function(){
        	
                $("#dialog-modal-"+ Id).dialog({
                width:668,
                height:530,
                modal: true,
                resizable:false
            });            
            if (!noZoom){               
                $(".pictureToZoom").jqzoom();
                $("#dialog-modal-"+Id+" #zoomImageTitle").show();
            } else {                
                $("#dialog-modal-"+Id+" #zoomImageTitle").hide();
            } 
            $('a.close').click(function(event){
               event.preventDefault();
               $("#dialog-modal-"+ Id).dialog("close");
               $("#dialog-modal-"+ Id).dialog("destroy");
               return false;
           });
        });
        return false;
    });
    
    $('a[href^="#gallery-"]').click(function(event){
        var Id = this.href.split('#gallery-')[1];
        var noZoom = $(this).hasClass('noZoom');
        $("#dialog-modal-"+ Id).load('gallery/photozoom/?pictureId=' + Id,function(){
        	
        	$("#dialog-modal-"+ Id).dialog({
                width: 700,
                height: 530,
                modal: true,
                resizable:true
            });            
            if (!noZoom){               
                $(".pictureToZoom").jqzoom();
                $("#dialog-modal-"+Id+" #zoomImageTitle").show();
            } else {                
                $("#dialog-modal-"+Id+" #zoomImageTitle").hide();
            } 
            $('a.close').click(function(event){
               event.preventDefault();
               $("#dialog-modal-"+ Id).dialog("close");
               $("#dialog-modal-"+ Id).dialog("destroy");
               return false;
           });
        });
        return false;
    });
    
    
   

});

