/*
 * yui-ext
 * Copyright(c) 2006, Jack Slocum.
 */

var chooser, btn;
YAHOO.ext.EventManager.onDocumentReady(function(){
    
    var insertImage = function(data){
    	YAHOO.ext.DomHelper.append('images', {
    		tag: 'img', src: data.url, style:'margin:10px;visibility:hidden;'
    	}, true).show(true);
    	btn.getEl().focus();
    };
    
    var choose = function(){
    	if(!chooser){
    		chooser = new ImageChooser({
    			url:'/bbk_custom/get_product_swatches.php?id=' + swatchProductId,
    			width:700, 
    			height:600
    		});
    	}
    	chooser.show(document.getElementById("product_thumbnail"), insertImage);
    };
    
    
    btn = new YAHOO.ext.Button('swatch_button', {
	    text: "Preview",
		handler: choose
	});

    function choose2(){
    	if(!chooser){
    		chooser = new ImageChooser({
    			url:'/bbk_custom/get_product_swatches.php?id=' + swatchProductId,
    			width:700, 
    			height:600
    		});
    	}
    	chooser.show(document.getElementById("product_thumbnail"), insertImage);
    };
});


    function choose2(){
            if(!chooser){
	                    chooser = new ImageChooser({
			                            url:'/bbk_custom/get_product_swatches.php?id=' + swatchProductId,
						                            width:700,
									                            height:600
												                    });
														            }
															            chooser.show(document.getElementById("product_thumbnail"), insertImage);
																        };

