var clicktoselectTXT='Hover over a thumbnail to preview larger image.<br/> Click to select it.';(function($){$.fn.radiogallery=function(options){var defaults={'images':'div.attribImg','mode':'text'};var options=$.extend(defaults,options);return this.each(function(){var obj=$(this);obj.attr('selected',false);obj.append('<img style="-ms-interpolation-mode: bicubic" src="" id="'+obj.attr('id')+'-gallery"/>');var container=obj.find('#'+obj.attr('id')+'-gallery');var selected=false;obj.parent().append('<div class="gallery-comment">'+clicktoselectTXT+'</div>');obj.nextAll('br').remove();obj.nextAll(options.images).each(function(){var self=$(this);var radio=$(this).find('input:radio');var img=$(this).find('img');var lbl=$(this).find('label');if(options.mode=='notext')
lbl.text("");lbl.prepend(img);self.css("cursor","pointer");self.children().css("cursor","pointer");if(radio.attr('checked')){selected=self;selected.addClass('radiogallery-selected');var img_url=img.attr('src');if(img.attr('alt')){img_url=img.attr('alt');}
container.attr('src',img_url);}
var onClick=function(){if(selected!=self){radio.attr('checked','checked');radio.trigger('change');self.addClass('radiogallery-selected');if(obj.attr('selected')!=false){selected.removeClass('radiogallery-selected');selected.find(':radio').removeAttr('checked');}
selected=self;var img_url=img.attr('src');if(img.attr('alt')){img_url=img.attr('alt');}
container.attr('src',img_url);container.css("-ms-interpolation-mode","bicubic");}};self.click(onClick);self.hover(function(){var img_url=img.attr('src');if(img.attr('alt')){img_url=img.attr('alt');}
container.attr('src',img_url);container.css("-ms-interpolation-mode","bicubic");},function(){var simg=selected.find('img');var img_url=simg.attr('src');if(simg.attr('alt')){img_url=simg.attr('alt');}
container.attr('src',img_url);container.css("-ms-interpolation-mode","bicubic");})});});}
$.fn.radiosubgallery=function(options){var defaults={'images':'div.attribImg','mode':'text','base':false,'ext':'jpg'};var options=$.extend(defaults,options);return this.each(function(){var obj=$(this);obj.attr('selected',false);obj.append('<img style="-ms-interpolation-mode: bicubic" src="" id="'+obj.attr('id')+'-gallery"/>');var container=obj.find('#'+obj.attr('id')+'-gallery');var selected=false;var target=$(options.base);obj.parent().append('<div class="gallery-comment">'+clicktoselectTXT+'</div>');obj.nextAll('br').remove();obj.nextAll(options.images).each(function(){var self=$(this);var radio=$(this).find(':radio');var lbl=$(this).find('label');if(options.mode=='notext')
lbl.text("");self.css("cursor","pointer");self.children().css("cursor","pointer");var url='/images/nh_boxes/'+target.attr('op_value')+'-'+radio.attr('op_value')+'.'+options.ext;var url_LRG='/images/large/nh_boxes/'+target.attr('op_value')+'-'+radio.attr('op_value')+'_LRG.'+options.ext;var img=$(new Image());lbl.prepend(img);img.load(function(){self.show();}).error(function(){self.hide();});img.attr('src',url);if(radio.attr('checked')){selected=self;selected.addClass('radiogallery-selected');container.attr('src',url_LRG);}
target.change(function(){var url='/images/nh_boxes/'+target.attr('op_value')+'-'+radio.attr('op_value')+'.'+options.ext;var url_LRG='/images/large/nh_boxes/'+target.attr('op_value')+'-'+selected.find(':radio').attr('op_value')+'_LRG.'+options.ext;img.attr('src',url);container.attr('src',url_LRG);})
var onClick=function(){if(selected!=self){radio.attr('checked','checked');radio.trigger('change');self.addClass('radiogallery-selected');var url_LRG='/images/large/nh_boxes/'+target.attr('op_value')+'-'+radio.attr('op_value')+'_LRG.'+options.ext;if(obj.attr('selected')!=false){selected.removeClass('radiogallery-selected');selected.find(':radio').removeAttr('checked');}
selected=self;container.attr('src',url_LRG);container.css("-ms-interpolation-mode","bicubic");}};self.click(onClick);self.hover(function(){var url_LRG='/images/large/nh_boxes/'+target.attr('op_value')+'-'+radio.attr('op_value')+'_LRG.'+options.ext;container.attr('src',url_LRG);container.css("-ms-interpolation-mode","bicubic");},function(){var url_LRG='/images/large/nh_boxes/'+target.attr('op_value')+'-'+selected.find(':radio').attr('op_value')+'_LRG.'+options.ext;container.attr('src',url_LRG);container.css("-ms-interpolation-mode","bicubic");})});});}})(jQuery);