function LightBoxAdasoft(options) { if (window.jQuery) { var jq = window.jQuery; var def_options = { id: 'DOM_ID', bordercolor: 'BORDER_COLOR'}; options = jq.extend(def_options, options); if (jq.fn.lightBox) { var list = jq('a[rel="' + options.id + '"]').find('img'); var parent = jq('#' + options.id).parent(); var tempDiv = jq(document.createElement('div')); tempDiv.css('display', 'none'); jq(parent).append(tempDiv); if (list.length > 0) { jq.each(list, function (i, v) { var ii = i > 10 ? (i > 20 ? (i > 30 ? 100 : 200) : 250) : 500; var img = jq(''); var bimage = jq(v).parent().attr('href'); jq(v).css({ opacity: 0.22 }).data('bload', false); img.load(function () { var relay = (Math.random() * ii)+999; jq(v).animate({ opacity: .95 }, relay, function () { jq(v).data('bload', true); }); }); img.attr('src', bimage); tempDiv.append(img); }); //each jq('a[rel="' + options.id + '"]').css({ border: 'none' }).attr('unselectable', 'on'); jq('a[rel="' + options.id + '"]').find('img').attr('unselectable', 'on'); var over_fnc = function () { var node = this; if (jq(node).data('bload') != true) return false; jq(node).stop(true); jq(node).animate({ opacity: 1 }, 1000).css({ borderColor: options.bordercolor }); }; //end-over var out_fnc = function () { var node = this; if (jq(node).data('bload') != true) return false; jq(this).animate({ opacity: 0.4 }, 1000).css({borderColor:'#FFFFFF'}); }; //end-out jq('a[rel="' + options.id + '"]').find('img').css({ opacity: 0.4, border: '2px solid #FFFFFF' }); jq('a[rel="' + options.id + '"]').find('img').hover(over_fnc, out_fnc); jq('a[rel="' + options.id + '"]').lightBox(); } } } } //End-LightBoxAdasoft