!function($){$.fn.extend({doubleviewer:function(options){var defaults={font_family:"Geneva, Arial, Helvetica, sans-serif",text_size:22,bg_color_info:"#000",bg_info_opacity:.75,color_info:"#fff",spacing:5,lineColor:"#F60",lineWidth:2,width:600,height:400,startPosition:.5,cursorProperty:"move",cursorVisible:!0,noClick:!1,stopClick:!1,cursor:{color:"#f80",size:10,gap:6,lineColor:"#fff",lineH:40,lineW:4},auto_size:!1,slide_navi:{active_color:"#f00",deactive_color:"#000",bg_color:"#fff",border:!0,bg_visible:!0,size:8,margin:4,rounded_corners:10,bg_rounded_corners:0}};options=$.extend(defaults,options);var rand=Math.round(999999*Math.random());return this.each(function(){function change_img(w){block=!1,o.cursorVisible&&$("#cur"+rand).stop().animate({left:w-o.cursor.size+"px"},200),$("#line"+rand).stop().animate({left:w-o.lineWidth+"px"},200),$("#after"+rand).stop().animate({width:w+"px"},200,function(){block=!0})}function info_win(num){return num=o.slide_mode[num].text?1:0}function dv_rezize(){o.width=$(wrap_obj).parent().width(),o.height=o.width/ratio,$(wrap_obj).width(o.width).height(o.height),$(obj).width(o.width).height(o.height),$("#after"+rand).css({height:o.height,width:o.width*o.startPosition}),$("#before"+rand).css({height:o.height,width:o.width}),$(".dv_compl_"+rand+" img").css({height:o.height,width:o.width}),$("div#before"+rand+" img").css({"max-height":o.height,"max-width":o.width}),$("div#after"+rand+" img").css({"max-height":o.height,"max-width":o.width}),$("#cur"+rand).css({left:o.width*o.startPosition-o.cursor.size+"px",top:o.height/2-o.cursor.size}),$("#line"+rand).css({left:o.width*o.startPosition-o.lineWidth+"px"}).height(o.height),$("#loading"+rand).css({height:o.height,width:o.width}),$(".win_info_bg"+rand).css({padding:o.spacing+$(".win_t"+rand).height()/2+"px 0 "+(o.spacing+$(".win_t"+rand).height()/2)+"px 0"})}function newPos(pX,pY,dur){if(block){dur=void 0==dur?0:dur;var scrollTop=document.documentElement.scrollTop||document.body&&document.body.scrollTop||0,scrollLeft=document.documentElement.scrollLeft||document.body&&document.body.scrollLeft||0;scrollTop-=document.documentElement.clientTop,scrollLeft-=document.documentElement.clientLeft,(mcl||noClick)&&(o.startPosition=pX/o.width,edge?(o.cursorVisible&&$("#cur"+rand).stop().animate({top:pY-o.cursor.size-o_top+scrollTop+"px",left:pX-o.cursor.size+"px"},{queue:!1,duration:dur}),$("#line"+rand).stop().animate({left:pX-o.lineWidth+"px"},{queue:!1,duration:dur}),$("#after"+rand).stop().animate({width:pX+"px"},{queue:!1,duration:dur})):(o.cursorVisible&&$("#cur"+rand).stop().css({top:pY-o.cursor.size-o_top+scrollTop+"px",left:pX-o.cursor.size+scrollLeft+"px"}),$("#line"+rand).stop().css({left:pX-o.lineWidth+scrollLeft+"px"}),$("#after"+rand).stop().css({width:pX+scrollLeft+"px"}))),m_out&&o.cursorVisible&&($("#cur"+rand).stop().animate({top:pY-o.cursor.size-o_top+"px"},{queue:!1,duration:dur}),m_out=!1)}}var o=options,i=0,wrap_obj=$(this),ratio=1,block=!0;$(wrap_obj).prepend('
');var obj=$("#child"+rand);ratio=o.width/o.height,o.lineWidth=o.lineWidth/2,$(wrap_obj).prepend('').bind("selectstart",function(){return!1}).css({"user-select":"none","-o-user-select":"none","-moz-user-select":"none","-khtml-user-select":"none","-webkit-user-select":"none"}),$(obj).prepend(''),$("#win_info"+rand).css({position:"relative","z-index":999}),$(".win_info_bg"+rand).css({"z-index":999}),$(".win_t"+rand).css({position:"absolute","z-index":999,width:"100%",top:0,right:0,left:0,padding:o.spacing+"px 0 "+o.spacing+"px 0",margin:0,"text-align":"center","line-height":o.text_size+"px","font-family":o.font_family,"font-size":o.text_size,color:o.color_info}),$(wrap_obj).width(o.width).height(o.height).css({overflow:"hidden",position:"relative",padding:0,height:o.height}),$(obj).width(o.width).height(o.height).css({overflow:"hidden",position:"absolute",padding:0,height:o.height}),$(obj).prepend(''),$(obj).prepend('');var sel=0,sel_n=0;if(i=0,o.slide_mode){for(var stat in o.slide_mode)$("#control"+rand).prepend('').css("border-radius",o.slide_navi.bg_rounded_corners),$("#after"+rand).prepend('
'),$("#before"+rand).prepend('
'),$("#nav_cont_"+rand+stat).bind("mouseup touchend",function(){if(sel!=$(this).attr("id")){$("#win_info"+rand).stop().animate({"margin-top":-$(".win_info_bg"+rand).outerHeight()}),change_img(o.width),window.setTimeout(function(){change_img(0)},200),window.setTimeout(function(){$(".win_t"+rand).html(decodeURIComponent(o.slide_mode[sel_n].text)),$(".win_info_bg"+rand).css({padding:o.spacing+$(".win_t"+rand).height()/2+"px 0 "+(o.spacing+$(".win_t"+rand).height()/2)+"px 0"}),$("#win_info"+rand).css({opacity:info_win(sel_n),"margin-top":-$(".win_info_bg"+rand).outerHeight()}),$("#win_info"+rand).stop().animate({"margin-top":0}),change_img(o.width/2)},400);for(var stat in o.slide_mode)$("#nav_cont_"+rand+stat).attr("id")==$(this).attr("id")?(sel=$("#nav_cont_"+rand+stat).attr("id"),sel_n=stat,$("#aft_"+rand+stat).delay(400).animate({opacity:1},0),$("#bef_"+rand+stat).delay(200).animate({opacity:1},0),$("#nav_cont_"+rand+stat).css({"background-color":o.slide_navi.active_color,cursor:"default"})):($("#aft_"+rand+stat).delay(400).animate({opacity:0},0),$("#bef_"+rand+stat).delay(200).animate({opacity:0},0),$("#nav_cont_"+rand+stat).css({"background-color":o.slide_navi.deactive_color,cursor:"pointer"}))}}),0==i?(sel=$("#nav_cont_"+rand+stat).attr("id"),$("#nav_cont_"+rand+stat).css({"background-color":o.slide_navi.active_color,cursor:"default"}),$(".win_t"+rand).html(decodeURIComponent(o.slide_mode[stat].text)),$(".win_info_bg"+rand).css({position:"absolute",width:"100%",top:0,right:0,left:0,padding:o.spacing+$(".win_t"+rand).height()/2+"px 0 "+(o.spacing+$(".win_t"+rand).height()/2)+"px 0",margin:0,background:o.bg_color_info,opacity:o.bg_info_opacity}),$("#win_info"+rand).css({opacity:info_win(stat)})):($("#aft_"+rand+stat).css("opacity",0),$("#nav_cont_"+rand+stat).css({"background-color":o.slide_navi.deactive_color,cursor:"pointer"})),i++;$(".dv_compl_"+rand).css({position:"absolute"});var bord_h=null;o.slide_navi.border&&(bord_h="1px solid "+o.slide_navi.active_color,o.slide_navi.size-=2),$(".navi").css({width:o.slide_navi.size+"px",height:o.slide_navi.size+"px",border:bord_h,"float":"right",margin:o.slide_navi.margin/2+"px","z-index":10,"border-radius":o.slide_navi.rounded_corners});var nav_bg_vis;nav_bg_vis=1==o.slide_navi.bg_visible?o.slide_navi.bg_color:"none",$("#control"+rand).css({position:"absolute",bottom:0,padding:o.slide_navi.margin/2+"px",left:"50%","background-color":nav_bg_vis,"z-index":9}),$("#control"+rand).css("margin-left",-$("#control"+rand).outerWidth()/2+"px")}else $("#after"+rand).prepend('
'),$("#before"+rand).prepend('
');$("img.reset").css({margin:0,padding:0,border:0,outline:0,"font-size":"100%",width:o.width+"px","vertical-align":"baseline",background:"transparent"}),2>i&&$("#control"+rand).hide(),$("#after"+rand).css({height:o.height,width:o.width*o.startPosition,position:"absolute",overflow:"hidden",left:0,"z-index":1}),$(obj).prepend(''),o.cursorVisible&&$("#drag"+rand).prepend(''),$("div#after"+rand+" img").css({"max-height":o.height,"max-width":o.width}),$("div#before"+rand+" img").css({"max-height":o.height,"max-width":o.width}),$("#cur_l"+rand).css({position:"absolute",overflow:"hidden",width:0,height:0,"margin-left":-o.cursor.gap/2+"px","border-top":o.cursor.size+"px solid transparent","border-right":o.cursor.size+"px solid "+o.cursor.color,"border-bottom":o.cursor.size+"px solid transparent"}),$("#cur_r"+rand).css({position:"absolute",overflow:"hidden",width:0,height:0,"margin-left":o.cursor.gap/2+o.cursor.size+"px","border-top":o.cursor.size+"px solid transparent","border-left":o.cursor.size+"px solid "+o.cursor.color,"border-bottom":o.cursor.size+"px solid transparent"}),$("#rect"+rand).css({position:"absolute",overflow:"hidden",width:o.cursor.lineW+"px",height:o.cursor.lineH+"px","margin-left":-o.cursor.lineW/2+o.cursor.size+"px","margin-top":-o.cursor.lineH/2+o.cursor.size+"px",background:o.cursor.lineColor}),$("#region"+rand).css({position:"absolute",overflow:"hidden",width:2*o.cursor.size+o.cursor.gap+"px",height:o.cursor.lineH+"px","margin-left":-o.cursor.gap/2+"px","margin-top":-o.cursor.lineH/2+o.cursor.size+"px"}),$(wrap_obj).prepend('
'),$("#loading_"+rand).css({position:"absolute",overflow:"hidden",top:"50%",left:"50%","margin-left":"-8px","margin-top":"-5px"}),$("#loading"+rand).css({opacity:.95});var o_left=$(obj).offset().left,o_top=$(obj).offset().top;$("#cur"+rand).css({opacity:1,position:"absolute",padding:"0",left:o.width*o.startPosition-o.cursor.size+"px",top:o.height/2-o.cursor.size,"z-index":3}),$("#line"+rand).css({border:+o.lineWidth+"px solid "+o.lineColor,position:"absolute",padding:"0","vertical-align":"middle",left:o.width*o.startPosition-o.lineWidth+"px","z-index":2}).height(o.height),$("#drag"+rand).css("cursor",o.cursorProperty);var numImgs=$(obj).find("img").length,i=0;$(obj).find("img").bind("load",function(){i++,i==numImgs&&$("#loading"+rand).delay(200).animate({opacity:0},500,function(){$("#loading"+rand).remove()})}),o.auto_size&&($("#win_info"+rand).css({bottom:"100%"}),dv_rezize(),$(window).resize(function(){dv_rezize()}));var timer,eClientX,eClientY,cur_p,mcl=!1,noClick=!0,leave=!1,posXY=0,edge=!1,m_out=!1;$(document).bind("mouseup touchend",function(e){eClientX="touchend"==e.type?event.changedTouches[0].clientX||event.touches[0].clientX:e.clientX,eClientY="touchend"==e.type?event.changedTouches[0].clientY||event.touches[0].clientY:e.clientY,!o.stopClick&&!leave&&Math.abs(posXY-(eClientX-o_left))<1&&(edge=!0,cur_p?newPos(0,eClientY,200):newPos(o.width,eClientY,200)),edge=!1,mcl=!1,noClick=mcl,timer=setTimeout(function(){m_out=!0,"touchend"==e.type&&(cur_p?newPos(0,o.height/2+o_top,1e3):newPos(o.width,o.height/2+o_top,1e3))},1e3)}),$(obj).bind("mouseleave",function(e){eClientX="touchend"==e.type?event.changedTouches[0].clientX||event.touches[0].clientX:e.clientX,eClientY="touchend"==e.type?event.changedTouches[0].clientY||event.touches[0].clientY:e.clientY,o_left>eClientX?newPos(0,eClientY):eClientX>o.width+o_left&&newPos(o.width,eClientY),timer=setTimeout(function(){m_out=!0,newPos(eClientX-o_left,o.height/2+o_top,1e3)},100),mcl=!1,noClick=mcl,leave=!0}).bind("mousemove touchmove",function(e){var evt=e||event;evt.preventDefault?evt.preventDefault():evt.returnValue=!1,noClick=o.noClick,eClientX="mousemove"==e.type?e.clientX:event.changedTouches[0].clientX||event.touches[0].clientX,eClientY="mousemove"==e.type?e.clientY:event.changedTouches[0].clientY||event.touches[0].clientY,timer&&(m_out=!1,window.clearTimeout(timer),timer=0);var scrollTop=document.documentElement.scrollTop||document.body&&document.body.scrollTop||0,scrollLeft=document.documentElement.scrollLeft||document.body&&document.body.scrollLeft||0;scrollTop-=document.documentElement.clientTop,scrollLeft-=document.documentElement.scrollLeft,eClientX-o_left+scrollLeft>0&&eClientX-o_left+scrollLeft0&&eClientY-o_top+scrollTop