state=0;x1=0;y1=0;x2=0;y2=0;mouse_x=0;mouse_y=0;function mouseMove(e){if(!e)e=window.event;if(e.pageX||e.pageY){mouse_x=e.pageX;mouse_y=e.pageY;}
else if(e.clientX||e.clientY){mouse_x=e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)-document.documentElement.clientLeft;mouse_y=e.clientY+(document.documentElement.scrollTop||document.body.scrollTop)-document.documentElement.clientTop;}
return true}
function bigHide(e,text){if(state==1){if(!((mouse_x>x1)&&(mouse_x<x2)&&(mouse_y>y1)&&(mouse_y<y2))){jQuery('#iframe').css({display:"none"});jQuery('#normalsize').stop().remove();$jsbanner.find('div.img_area').stop();state=0;return true;}}
return false;}
function preload_by_num(num){if(img[3*num]==null){img[3*num]=new Image();jQuery(img[3*num]).load(function(){jQuery(this).hide();}).attr('src',list[num].small);}
if(img[3*num+1]==null){img[3*num+1]=new Image();jQuery(img[3*num+1]).load(function(){jQuery(this).hide();}).attr('src',list[num].rfl);}
if(img[3*num+2]==null){img[3*num+2]=new Image();jQuery(img[3*num+2]).load(function(){jQuery(this).hide();}).attr('src',list[num].big);}}
function init2(step,curr,speed,i){var num=curr+i;num=num<0?list.length-1+num%list.length:(num>=list.length?num%(list.length):num);var obj=coord[i];var $tpl=$jsbanner.find('#tpl_'+i+' > div');$tpl.css({left:eval($bLeft+obj.l)+"px",top:eval($bTop+obj.t+deltaT)+"px",height:eval(obj.h+deltaH)+"px",width:obj.w+"px"});preload_by_num(num);$tpl.find('.smallpreview').attr({src:list[num].small,title:list[num].href}).css({height:list[num].sy+"px"});$tpl.find('.rfl').attr({src:list[num].rfl});$tpl.find('.bigpreview').attr('src',list[num].big);$tpl.find('.type_info').html(list[num].type);$tpl.find('.prices').html('<b>'+list[num].ch+list[num].price+'</b>');$tpl.find('.downloads').html('Downloads: <b>'+list[num].downloads+'</b>');}
function init(curr,step,speed,count){if(step<0){$el=$jsbanner.find('#tpl_0').remove();for(i=1;i<=count;i++){$jsbanner.find('#tpl_'+i).attr('id','tpl_'+(i-1));}
$jsbanner.find('#tpl_'+eval(count-1)).after($el).next().attr('id','tpl_'+count);init2(step,curr,speed,count);}else{$el=$jsbanner.find('#tpl_'+count).remove();for(i=count;i>=0;i--){$jsbanner.find('#tpl_'+i).attr('id','tpl_'+(i+1));}
$jsbanner.find('#tpl_1').before($el).prev().attr('id','tpl_0');init2(step,curr,speed,0);}
$jsbanner.find('#tpl_0').css('display','none');$jsbanner.find('#tpl_'+count).css('display','none');moving=0;}
function jsbanner(banner_id,list,coord,link,curr_type,skin,prefix,speed,step,orientation,show_price,show_downloads,count){$jsbanner=jQuery('#'+banner_id);$jsbanner.disableTextSelect();if(orientation=='horizontal')
$jsbanner.append('<div id="left_div"></div>');if(orientation=='horizontal'){$jsbanner.css({width:eval(240+(count-2)*156)+'px',height:'258px',background:''});$jsbanner.find('#left_div').css({'z-index':1,float:'left',width:"176px",height:'258px'});}else{$jsbanner.css({height:eval(160*count-25)+'px',width:'197px'});}
$jsbanner.append('<div class="progressBar"></div>');var progress=jQuery('.progressBar');progress.css({position:'relative',marginLeft:$jsbanner.width()/2-61,top:$jsbanner.height()/2});progress.progressBar(0,{boxImage:prefix+'/codes/jsbanner/images/progressbar.gif',barImage:prefix+'/codes/jsbanner/04/skins/'+skin+'/progressbg.gif',showText:false});j=0;img=new Array();list_length=list.length;var preload=list_length<20?list_length:20;for(i=0;i<preload;i++){img[3*i]=new Image();jQuery(img[3*i]).load(function(){jQuery(this).hide();j++;progress.progressBar(100*j/(2*preload),{boxImage:prefix+'/codes/jsbanner/images/progressbar.gif',barImage:prefix+'/codes/jsbanner/04/skins/'+skin+'/progressbg.gif',showText:false});if(j==2*preload){jsbanner_body(list,coord,link,curr_type,skin,prefix,speed,step,orientation,show_price,show_downloads,count);}}).attr('src',list[i].small);img[3*i+1]=new Image();jQuery(img[3*i+1]).load(function(){jQuery(this).hide();j++;progress.progressBar(100*j/(2*preload),{boxImage:prefix+'/codes/jsbanner/images/progressbar.gif',barImage:prefix+'/codes/jsbanner/04/skins/'+skin+'/progressbg.gif',showText:false});if(j==2*preload){jsbanner_body(list,coord,link,curr_type,skin,prefix,speed,step,orientation,show_price,show_downloads,count);}}).attr('src',list[i].rfl);}}
function jsbanner_body(list,coord,link,curr_type,skin,prefix,speed,step,orientation,show_price,show_downloads,count){jQuery('.progressBar').remove();if(orientation=='horizontal')
$jsbanner.find('#left_div').append('<div id="prev"></div>');else{$jsbanner.append('<div id="prev"></div>');}
$bTop=$jsbanner.offset().top;$bLeft=$jsbanner.offset().left;deltaT=(orientation=='horizontal')?15:0;deltaH=(orientation=='horizontal')?40:0;$bHeight=$jsbanner.height();$bWidth=$jsbanner.width();for(i=0;i<=count;i++){var $small='<div style="border:1px solid #ccc; left:0px;width:140px;height:151px;overflow:hidden;"><img title="'+list[i].href+'" class="smallpreview" src="'+list[i].small+'"/></div>';img[3*i+2]=new Image();jQuery(img[3*i+2]).load(function(){jQuery(this).hide();}).attr('src',list[i].big);var $area='<div class="img_area"></div>';var $t_info=(show_price+show_downloads!=0)?'':'';var $type_info=curr_type.cnt>1?'<div class="type_info">'+list[i].type+'</div>':'';var $big='<img class="bigpreview" src="'+list[i].big+'"/>';if((jQuery.browser.msie&&jQuery.browser.version.substr(0,1)<7)||(orientation!='horizontal')){var $rfl='';}else
var $rfl='';if(orientation=='horizontal'){$jsbanner.append('<div class="tpl" id="tpl_'+i+'"><div style="left:'+eval($bLeft+coord[i].l)+'px;top:'+eval($bTop+15+coord[i].t)+'px;width:'+coord[i].w+'px;height:'+eval(coord[i].h+40)+'px;z-index:'+coord[i].z+';">'+$type_info+$t_info+$small+$area+$big+$rfl+'</div></div>');}else{$jsbanner.append('<div class="tpl" id="tpl_'+i+'"><div style="left:'+eval($bLeft+coord[i].l)+'px;top:'+eval($bTop+coord[i].t)+'px;width:'+coord[i].w+'px;height:'+eval(coord[i].h)+'px;z-index:'+coord[i].z+';">'+$type_info+$t_info+$small+$area+$big+'</div></div>');}}
if(show_price==0)$jsbanner.find('.prices').hide();if(show_downloads==0)$jsbanner.find('.downloads').hide();$jsbanner.find('#tpl_0').hide();$jsbanner.find('#tpl_'+count).hide();$jsbanner.append('<div id="next"></div>');var view_full=(orientation=='horizontal'?(jQuery.browser.msie?'view_full_ie.gif':'view_full.gif'):'view_full_vert.gif');$jsbanner.append('<div id="text2"><a href="'+curr_type.href+'" target=""><img src="http://easystorehosting.com/esh/gallary1/button.gif" style="border:0px;"></a></div>');$jsbanner.find('#prev, #next').hover(function(){jQuery(this).css('opacity','0.75');},function(){jQuery(this).css('opacity','1');});$jsbanner.find('.t_info').css({background:'transparent url('+prefix+'/codes/jsbanner/04/skins/'+skin+'/t_info.gif) repeat-x scroll left top',opacity:0.85});$jsbanner.find('.type_info').css({background:'transparent url('+prefix+'/codes/jsbanner/04/skins/'+skin+'/t_info.gif) repeat-x scroll left top',opacity:0.85});if(orientation=='horizontal'){$jsbanner.find('#prev').css({background:'transparent url('+prefix+'/codes/jsbanner/04/skins/'+skin+'/arrow-left.gif) no-repeat scroll center center'});$jsbanner.find('#next').css({background:'transparent url('+prefix+'/codes/jsbanner/04/skins/'+skin+'/arrow-right.gif) no-repeat scroll center center'});$jsbanner.find('#prev,#next').css({width:'13px',height:'32px'});$jsbanner.find('#up_text').css({width:eval($bWidth-4)+'px',top:eval($bTop+10)+"px",left:eval($bLeft)+"px"});$jsbanner.find('#text2').css({width:eval($bWidth-4)+'px',left:eval($bLeft)+"px",top:eval($bTop+$bHeight-53)+"px"});}else{$jsbanner.find('#prev').css({float:'none',margin:"0px",paddingTop:"77px",width:'197px',background:'transparent url('+prefix+'/codes/jsbanner/04/skins/'+skin+'/arrow-up.gif) no-repeat scroll center center'});$jsbanner.find('#next').css({margin:'0px',position:'absolute',float:'none',width:'197px',left:eval($bLeft)+"px",top:eval($bTop+$bHeight-60)+"px",background:'transparent url('+prefix+'/codes/jsbanner/04/skins/'+skin+'/arrow-down.gif) no-repeat scroll center center'});$jsbanner.find('#up_text').css({top:eval($bTop+10)+"px",width:'195px'});$jsbanner.find('#up_text a').css({color:'#fff'});$jsbanner.find('#text2').css({width:'195px',left:eval($bLeft-1)+"px",top:eval($bTop+$bHeight-35)+"px"});}
jQuery('body').append('<div id="preview"></div>');curr=0;moving=0;document.onmousemove=mouseMove;$jsbanner.find('.img_area').live('click',function(e){window.open(jQuery(this).prev().find('.smallpreview').attr('title'));state=0;moving=0;});$jsbanner.find('.img_area').live('mouseover',function(e){$area=jQuery(this);if(state==0){state=1;$area.oneTime(600,"img_area",function(){var $smallprev=$area.prev().find('.smallpreview');var href=$smallprev.attr('title');var smallheight=$smallprev.height();var smallwidth=$smallprev.width();var left=$smallprev.offset().left;var top=$smallprev.offset().top;var $bigprev=$area.next();var truewidth=$bigprev.width();var trueheight=$bigprev.height();if(!(($bigprev.height()<=1)||($bigprev.width()<=1))){x1=left;y1=top;x2=x1+smallwidth;y2=y1+smallheight;bigHide(e,'time2');if(state!=1)return false;jQuery('#normalsize').remove();jQuery('#preview').append('<img id="normalsize" alt="" />');var $realbig=jQuery('#normalsize');$realbig.attr('src',$bigprev.attr('src'));scrollTop=jQuery(window).scrollTop();scrollLeft=jQuery(window).scrollLeft();left1=left-((truewidth-smallwidth)/2);screen_width=jQuery(window).width()+scrollLeft;screen_height=jQuery(window).height()+scrollTop;if(left1<scrollLeft)left1=scrollLeft;else if(left1+truewidth>screen_width)left1=screen_width-truewidth-8;top1=top-((trueheight-smallheight)/2);if(top1<scrollTop)top1=scrollTop;else if(top1+trueheight>screen_height)top1=screen_height-trueheight-8;$realbig.css({'opacity':'0.3','width':smallwidth,'height':smallheight,'left':left,'top':top,'z-index':50}).stop().animate({width:truewidth,height:trueheight,opacity:1,left:left1,top:top1},280,function(){x1=left1;y1=top1;x2=x1+truewidth;y2=y1+trueheight;jQuery('#iframe').css({left:left1,top:top1,width:truewidth+8,height:trueheight+8,display:"block"});bigHide(e,'before state2');if(state==1)
state=2;});$realbig.hover(function(e){},function(e){jQuery('#iframe').css({display:"none"});$realbig.stop().animate({width:smallwidth,height:smallheight,opacity:'0.3',left:left,top:top},200,function(){$realbig.remove();moving=0;state=0;});});$realbig.click(function(){window.open(href);state=3;moving=0;});}else{state=0;}});}}).live('mouseout',function(e){moving=0;});$jsbanner.find('#prev').click(function(){if(orientation=='horizontal'){var step=1;var num=curr-1;}else{var step=-1;var num=curr+count+1;}
num=num<0?list_length-1+num%list_length:(num>=list_length?num%(list_length):num);preload_by_num(num);if(!moving)
move(step,speed,coord,list,count,orientation);});$jsbanner.find('#next').click(function(){if(orientation=='horizontal'){var step=-1;var num=curr+count+1;}else{var step=1;var num=curr-1;}
num=num<0?list_length-1+num%list_length:(num>=list_length?num%(list_length):num);preload_by_num(num);if(!moving)
move(step,speed,coord,list,count,orientation);});}
function move(step,speed,coord,list,count,orientation){var num;x1=eval($bLeft+coord[2].l);y1=eval($bTop+coord[2].t);x2=eval(x1+coord[2].w);y2=eval(y1+coord[2].h);if((mouse_x>x1&&mouse_x<x2&&mouse_y>y1&&mouse_y<y2)||(state==2)){return false;}
moving=1;$tpl=new Array();$t_info=new Array();$type_info=new Array();$img=new Array();$img_div=new Array();$rfl=new Array();if(step>0)
$jsbanner.find('#tpl_0').show();else
$jsbanner.find('#tpl_'+count).show();for(i=0;i<=count;i++){num=curr+i;num=num<0?list.length-1+num%list.length:(num>=list.length?num%(list.length):num);if(i+step<0)obj=coord[0];else if(i+step>count)obj=coord[count];else obj=coord[i+step];$tpl[i]=jQuery('#tpl_'+i+' > div');if(orientation=='horizontal'){}
$tpl[i].animate({left:eval($bLeft+obj.l)+"px",top:eval($bTop+obj.t+deltaT)+"px",height:eval(obj.h+deltaH)+"px",width:eval(obj.w)+"px"},speed);$tpl[i].css('z-index',obj.z);$tpl[i].attr('src',obj.href);$img[i]=$tpl[i].find('.smallpreview');$img_div[i]=$img[i].parent();$img_div[i].animate({height:obj.h+"px",width:obj.w+"px"},speed);if(i==count){var sy=obj.h?list[num].sy:0;$img[i].animate({width:obj.w+"px",height:sy+"px"},speed,function(){curr-=step;num=curr+2;num=num<0?list.length-1+num%list.length:(num>=list.length?num%(list.length):num);init(curr,step,speed,count);});}else{var sy=obj.h?list[num].sy:0;$img[i].animate({width:obj.w+"px",height:sy+"px"},speed);}}}
