/*
 * L'Box v0.0.14
 * OmegaScorp.net/lbox/
 * Using lpng and lhash
 */
(function($){$.lbox_donner="";$.lbox_associations={};$.lbox_options=[];$.fn.lbox=function(_1,_2){if($(this).attr("lbox")!=undefined){return $(this).lbox_api(_1,_2);}else{return $(this).lbox_init(_1);}};$.fn.lbox_init=function(_3){var _4=$.lbox_options.length;$.lbox_options[_4]=$.extend({"loader":"loader.png","zindex":990,"play":false,"timeout":5000,"resize":function(){},"opened":false,"working":false,"template":"<div class=\"lbox_window\"><div class=\"lbox_content\"></div><div class=\"lbox_title\"></div></div><div class=\"lbox_play\"><a href=\"#play\"></a></div><div class=\"lbox_close\"><a href=\"#close\"></a></div><div class=\"lbox_prev\"><a href=\"#prev\"></a></div><div class=\"lbox_next\"><a href=\"#next\"></a></div>","hash":false,"speed":1000,"prefix":"lbox"},_3);$.lbox_options[_4].ajax=$.extend({"width":"0","height":"0","data":"","dataType":"html","success":function(r){_24(r);}},_3.ajax);$.lbox_options[_4].video=$.extend({"player":"uppod.swf","flashvars":"st=video18-1138.txt&file=","width":"500","height":"375"},_3.video);$.lbox_options[_4]["elements"]=[];$(this).attr("lbox",_4);var _5=$.lbox_options[_4];var _6=$(this);if($(".lbox_window").length==0){$("body").append("<div class=\"lbox\"></div><div id=\"lbox_loader\"></div>"+_5.template);$(".lbox_content").html("<div class=\"image\"><img src=\"\" /></div>"+"<div class=\"video\"><object width=\""+_5.video.width+"\" height=\""+_5.video.height+"\"><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"movie\" value=\""+_5.video.player+"\" /><param name=\"flashvars\" value=\""+_5.video.flashvars+"\" /><embed src=\""+_5.video.player+"\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" wmode=\"transparent\" flashvars=\""+_5.video.flashvars+"\" width=\""+_5.video.width+"\" height=\""+_5.video.height+"\"></embed></object></div>"+"<div class=\"ajax\"></div>");$(".lbox_window, .lbox_title, .lbox_content .image, .lbox_content .video, .lbox_content .ajax").hide();$(".lbox_next, .lbox_prev, .lbox_close, .lbox_play").css({"z-index":_5.zindex+1,"display":"none"});if($.fn.lpng!=undefined){$("#lbox_loader").lpng({url:_5.loader,show:false});}$(".lbox").css({"position":"fixed","background":"black","left":"0px","top":"0px","opacity":0.2,"display":"none","z-index":_5.zindex});if($.browser.msie){$(".lbox").css({"position":"absolute","height":$(document).height()+"px"});}_5.resize();}setTimeout(function(){init();},100);init=function(){if($.fn.lpng==undefined||$("#lbox_loader").lpng("ready")){if($.fn.lpng!=undefined){width=$("#lbox_loader").lpng("width");height=$("#lbox_loader").lpng("height");}else{width=0;height=0;}$(".lbox_window").css({"position":"fixed","z-index":_5.zindex+1});$("#lbox_loader").css({"position":"absolute","left":$(window).width()/2-width/2+"px","top":$(window).height()/2-height/2+"px","z-index":_5.zindex+2});if($.fn.lpng!=undefined){$("#lbox_loader").lpng("hide");}if($.browser.msie){$(".lbox_window").css({"position":"absolute"});}_6.each(function(){$(this).attr("lbox_index",_5.elements.length);name=$(this).attr("title");if(!name){name=$(this).text();}name=name.replace(":","");name=name.replace(",","");class_name=_5.prefix+_4+"_"+_5.elements.length;if(name){temp=name;i=1;while($.lbox_associations[temp]!=undefined){temp=name+i;i++;}name=temp;}else{name=class_name;}$.lbox_associations[name]=class_name;$(this).attr("lbox_name",name);$(this).addClass(class_name);_5.elements.push($(this));$(this).click(function(){$.lbox_open();$(".lbox").show();if($(this).find("img").length){var _7=$(this).find("img").outerWidth();var _8=$(this).find("img").outerHeight();var _9=$(this).find("img").offset();}else{var _7=$(this).outerWidth();var _8=$(this).outerHeight();var _9=$(this).offset();}var _a=$(window).scrollTop();var _b=$(window).scrollLeft();var _c=$(this).attr("href");if($.fn.lpng!=undefined){$("#lbox_loader").css({"left":(_9.left+_7/2-$("#lbox_loader").lpng("width")/2)+"px","top":(_9.top+_8/2-$("#lbox_loader").lpng("height")/2)+"px"}).lpng("show");}if($.browser.msie){$(".lbox_window").css({"left":(_9.left)+"px","top":(_9.top)+"px"});}else{$(".lbox_window").css({"left":(_9.left-_b-$.lbox_indent_left())+"px","top":(_9.top-_a-$.lbox_indent_top())+"px"});}$(".lbox_content").css({"width":_7+"px","height":_8+"px"});$(this).lbox_show();$.lbox_options[_4]=_5;return false;});});$(".lbox_close, .lbox").click(function(){$.lbox("close");return false;});$(".lbox_next, .lbox_content .image img").click(function(){$.lbox("next");return false;});$(".lbox_prev").click(function(){$.lbox("prev");return false;});$(".lbox_play").click(function(){$.lbox("change");return false;});if(_5.hash){if($.lhash!=undefined){name=$.lhash.get(_5.hash);}else{name=location.hash;if(name){name=name.substring(1,name.length);}}if(name){$("."+$.lbox_associations[name]).click();}}}else{setTimeout(function(){init();},100);}};};$.lbox_open=function(){if($.browser.msie){$(".lbox").css({"height":$(document).height()+"px"});}old_width=document.width;$("body").css({"height":$(window).height()+"px","overflow":"hidden"});if(!$.browser.msie){$(".lbox").css({"height":$(window).height()+"px"});}new_width=document.width;$("body").css({"margin-right":(parseInt($("body").css("margin-right"))+new_width-old_width)+"px"});$(".lbox").css({"width":$(window).width()+"px"});$(".lbox_next, .lbox_prev, .lbox_close, .lbox_play").show();};$.fn.lbox_show=function(){$.lbox_donner_return();$(".lbox_window").find(".lbox_title").hide();$(".lbox_current").removeClass("lbox_current");$(this).addClass("lbox_current");var _d=$(".lbox_current").attr("lbox");var _e=$.lbox_options[_d];_e.opened=true;var _f=$(this).attr("href");var _10=$(this).attr("title");var _11=$.lbox_indent_horizontal();var _12=$.lbox_indent_vertical();var _13=$(window).width();var _14=$(window).height();if(_e.hash){var _15=$(this).attr("lbox_name");if(_15){if($.lhash!=undefined){$.lhash.set(_e.hash,_15);}else{location.hash=_15;}}}var _16=_f.lastIndexOf(".");var _17=_f.substring(_16+1,_f.length);if(_16==0){_17="text";}_16=_f.lastIndexOf("#");if(_16==0){_17="text";}if($.fn.lpng!=undefined){$("#lbox_loader").css({"left":($(window).scrollLeft()+$(window).width()/2-$("#lbox_loader").lpng("width")/2)+"px","top":($(window).scrollTop()+$(window).height()/2-$("#lbox_loader").lpng("height")/2)+"px"}).lpng("show");}switch(_17){case "jpg":case "jpeg":case "png":case "gif":case "bmp":$(".lbox_content").css("overflow","hidden");var img=new Image();img.onload=function(){if($.fn.lpng!=undefined){$("#lbox_loader").lpng("hide");}$(".lbox_content>div:not(.image)").hide();$(".lbox_content .image").show();if($(".lbox_content").css("width")!="auto"&&$(".lbox_content").css("width")!="0px"){$(".lbox_content .image img").css({"width":$(".lbox_content").width(),"height":$(".lbox_content").height()});$(".lbox_content").css({"width":"auto","height":"auto"});}var _18=img.width;var _19=img.height;var k=_18/_19;var _1a=_18>_13-_11;var _1b=_19>_14-_12;var _1c=0;if(_1a&&_1b){var h=(_18-_13);var v=(_19-_14)*k;_1c=h>v?1:2;}else{if(_1a||_1b){if(_1a){_1c=1;}else{_1c=2;}}}if(_1c==1){_18=_13-_11;_19=_18/k;}else{if(_1c==2){_19=_14-_12;_18=_19*k;}}$(".lbox_content .image img").attr("src",_f).show().queue("fx",[]).animate({"width":_18,"height":_19},_e.speed,function(){if(_10!==""){$(".lbox_window .lbox_title").html(_10).show();}});_21(_18,_19,_e.speed);};img.src=_f;break;case "flv":$(".lbox_content").css("overflow","hidden");if($(".lbox_content .image").css("display")=="block"){$(".lbox_content").css({"width":$(".lbox_content .image img").width(),"height":$(".lbox_content .image img").height()});$(".lbox_content .image").hide();}$(".lbox_content>div").hide();var _1d=_e.video.width;var _1e=_e.video.height;$(".lbox_content").queue("fx",[]).animate({"width":_1d,"height":_1e},_e.speed,function(){if($.fn.lpng!=undefined){$("#lbox_loader").lpng("hide");}$(this).find(".video param[name=flashvars]").attr("value",_e.video.flashvars+_f);$(this).find(".video embed").attr("flashvars",_e.video.flashvars+_f);$(this).find(".video").show();if(_10!==""){$(".lbox_window .lbox_title").html(_10).show();}});_21(_1d,_1e,_e.speed);break;case "text":if($.fn.lpng!=undefined){$("#lbox_loader").lpng("hide");}if($(".lbox_content .image").css("display")=="block"){$(".lbox_content").css({"width":$(".lbox_content .image img").width(),"height":$(".lbox_content .image img").height()});$(".lbox_content .image").hide();}$(".lbox_content>div").hide();var _11=$.lbox_indent_horizontal();var _12=$.lbox_indent_vertical();var _1f=$(_f).width()!=0?$(_f).width():$(window).width()-_11;var _20=$(_f).height()!=0?$(_f).height():$(window).height()-_12;$(".lbox_content").show();$(".lbox_content").queue("fx",[]).animate({"width":_1f,"height":_20},_e.speed,function(){clone=$(_f).clone();$.lbox_donner={"element":$(_f),"clone":clone};$(_f).attr("class","").attr("id","").hide();$(".lbox_content").append(clone);if(_10!==""){$(".lbox_window .lbox_title").html(_10).show();}});_21(_1f,_20,_e.speed);break;default:$(".lbox_content").css("overflow","auto");var _22=_23(_e.ajax);delete _22.width;delete _22.height;vars=_f.split("&");for(key in _22.data){val=_22.data[key];val=val.replace("$0",_f);for(k in vars){val=val.replace("$"+(parseInt(k)+1),vars[k]);}_22.data[key]=val;}$.ajax(_22);}$.lbox_options[_d]=_e;};function _23(o){if(typeof (o)=="object"){var w={};for(k in o){w[k]=_23(o[k]);}return w;}return o;};function _24(r){var _25=$(".lbox_current").attr("lbox");var _26=$.lbox_options[_25];var _27=_26.ajax.width!="0"?_26.ajax.width:$(window).width();var _28=_26.ajax.height!="0"?_26.ajax.height:$(window).height();var _29=$.lbox_indent_horizontal();var _2a=$.lbox_indent_vertical();if($(".lbox_content .image").css("display")=="block"){$(".lbox_content").css({"width":$(".lbox_content .image img").width(),"height":$(".lbox_content .image img").height()});$(".lbox_content .image").hide();}$(".lbox_content>div:not(.ajax)").hide();var _2b=_27-_29;var _2c=_28-_2a;$(".lbox_content").queue("fx",[]).animate({"width":_2b,"height":_2c},_26.speed,function(){if($.fn.lpng!=undefined){$("#lbox_loader").lpng("hide");}$(".lbox_content .ajax").html(r);var _2d=$(".lbox_current").attr("title");if(_2d!==""){$(".lbox_window .lbox_title").html(_2d).show();}$(".lbox_content .ajax").show();});_21(_2b,_2c,_26.speed);};function _21(_2e,_2f,_30){var _31=$.lbox_indent_horizontal();var _32=$.lbox_indent_vertical();$(".lbox_window").show();if($.browser.msie){$(".lbox_window").queue("fx",[]).animate({"left":$(window).scrollLeft()+$(window).width()/2-_2e/2-_31/2+"px","top":$(window).scrollTop()+$(window).height()/2-_2f/2-_32/2+"px"},_30);}else{$(".lbox_window").queue("fx",[]).animate({"left":$(window).width()/2-_2e/2-_31/2+"px","top":$(window).height()/2-_2f/2-_32/2+"px"},_30);}};$.lbox_donner_return=function(){if($.lbox_donner!=""){$.lbox_donner.element.replaceWith($.lbox_donner.clone);}};$.fn.lbox_api=function(opt,_33){};$.lbox=function(opt,_34){var _35=$(".lbox_current").attr("lbox");var _36=$.lbox_options[_35];switch(opt){case "next":var _37=parseInt($(".lbox_current").attr("lbox_index"))+1;var _38=_36.elements[_37];if(_38==undefined){_38=_36.elements[0];}_38.lbox_show();break;case "prev":var _37=parseInt($(".lbox_current").attr("lbox_index"))-1;var _38=_36.elements[_37];if(_38==undefined){_38=_36.elements[_36.elements.length-1];}_38.lbox_show();break;case "close":$.lbox_donner_return();if($.fn.lpng!=undefined){$("#lbox_loader").lpng("hide");}$(".lbox_title").hide();$(".lbox_content").css({"width":"auto","height":"auto"});$(".lbox_content .image, .lbox_content .video, .lbox_content .ajax").hide();_36.opened=false;$(".lbox_next, .lbox_prev, .lbox_close, .lbox_play").hide();$(".lbox").hide();if($.fn.lpng!=undefined){width=$("#lbox_loader").lpng("width");height=$("#lbox_loader").lpng("height");}else{width=0;height=0;}$(".lbox_window").css({"left":$(window).width()/2-width/2+"px","top":$(window).height()/2+-height/2+"px"}).hide();$(".lbox_current").removeClass("lbox_current");old_width=document.width;$("body").css({"height":"auto","overflow":"auto"});new_width=document.width;$("body").css({"margin-right":(parseInt($("body").css("margin-right"))-old_width+new_width)+"px"});if(_36.hash){if($.lhash!=undefined){$.lhash.set(_36.hash,"");}else{location.hash="-";}}break;case "change":if(!_36.play){$(".lbox_play").addClass("pause");_36.play=true;if(!_36.working){_36.working=true;setTimeout(function(){$.lbox_timeout();},_36.timeout);}}else{$(".lbox_play").removeClass("pause");_36.play=false;}break;case "play":if(!_36.play){$(".lbox_play").addClass("pause");_36.play=true;if(!_36.working){_36.working=true;setTimeout(function(){$.lbox_timeout();},_36.timeout);}}break;case "pause":if(_36.play){$(".lbox_play").removeClass("pause");_36.play=false;}break;}$.lbox_options[_35]=_36;};$.lbox_timeout=function(){var _39=$(".lbox_current").attr("lbox");var _3a=$.lbox_options[_39];if(_3a.opened&&_3a.play){$.lbox("next");_3a.working=true;setTimeout(function(){$.lbox_timeout();},_3a.timeout);}else{_3a.working=false;}};$.fn.lbox_indent=function(){return [$(this).lbox_indent_top(),$(this).lbox_indent_right(),$(this).lbox_indent_bottom(),$(this).lbox_indent_left()];};$.fn.lbox_indent_left=function(){return parseInt($(this).css("padding-left"))+parseInt($(this).css("margin-left"));};$.fn.lbox_indent_right=function(){return parseInt($(this).css("padding-right"))+parseInt($(this).css("margin-right"));};$.fn.lbox_indent_top=function(){return parseInt($(this).css("padding-top"))+parseInt($(this).css("margin-top"));};$.fn.lbox_indent_bottom=function(){return parseInt($(this).css("padding-bottom"))+parseInt($(this).css("margin-bottom"));};$.fn.lbox_indent_horizontal=function(){return $(this).lbox_indent_left()+$(this).lbox_indent_right();};$.fn.lbox_indent_vertical=function(){return $(this).lbox_indent_top()+$(this).lbox_indent_bottom();};$.lbox_indent=function(){return $(".lbox_window").lbox_indent();};$.lbox_indent_left=function(){return $(".lbox_window").lbox_indent_left();};$.lbox_indent_right=function(){return $(".lbox_window").lbox_indent_right();};$.lbox_indent_top=function(){return $(".lbox_window").lbox_indent_top();};$.lbox_indent_bottom=function(){return $(".lbox_window").lbox_indent_bottom();};$.lbox_indent_horizontal=function(){return $(".lbox_window").lbox_indent_horizontal();};$.lbox_indent_vertical=function(){return $(".lbox_window").lbox_indent_vertical();};$(window).resize(function(){$.each($.lbox_options,function(){this.resize();});if(!$.browser.msie){$(".lbox").css({"height":$(window).height()+"px","width":$(window).width()+"px"});}if($(".lbox_current").length){$(".lbox_current").lbox_show();}});$(window).scroll(function(){if($.browser.msie){$.each($.lbox_options,function(){this.resize();});$(".lbox_window").css({"left":$(window).scrollLeft()+$(window).width()/2-$(".lbox_window .image img").width()/2+"px","top":$(window).scrollTop()+$(window).height()/2-$(".lbox_window .image img").height()/2+"px"});}});})(jQuery);
