
var fGo=true;(function($){$.fn.jGrow=function(options){var opts=$.extend({},3,options);return this.each(function(){$(this).css({overflow:'hidden'}).bind('keyup',function(){$this=$(this);var o=$.meta?$.extend({},opts,$this.data()):opts;if(o.rows==0&&(this.scrollHeight>this.clientHeight))this.rows+=1;else if((this.rows<=o.rows)&&(this.scrollHeight>this.clientHeight))this.rows+=1;else if(o.rows!=0&&this.rows>o.rows)$this.css({overflow:'auto'});$this.html();});});};})(jQuery);var VCF='';$(function(){if($('.css7').length)$('.css7').watermark();img=new Image();img.src='/tpl/img/loadings.gif';if($('#fv9').length)$('#fv9 *').click(function(){if(fGo)window.location=$('#f02').attr('href');});if($('#fo2').length){$('#fo2 textarea').keydown(function(evt){evt=evt||window.event;var key=evt.keyCode||evt.which;if(evt.ctrlKey){if(key==10||key==13){FotCm();}}}).val('').jGrow({rows:15});VCF=$('#fo2').html();}});var SendD=false;function rtFoto(id,x){if(SendD)return;SendD=true;$('#f0'+x).prepend('<img src="/tpl/img/loadings.gif" style="float:right;margin-top:4px"/>');$.get('/photo/ajax.php?frot='+id+'&g='+x+'&r='+Math.random(),function(data){if(data=='false')return;$('#f00').attr('src','/db/f_fot/'+data);$('#f0'+x+' img').remove();SendD=false;});}
function edFotoCl(){$('#fv22').hide();$('#fv5,#fv14').show();$('#f00').css('cursor','pointer');fGo=true;}
function edFoto(){fGo=false;$('#f00').css('cursor','default');$('#fv5,#fv14').hide();if($('#fTx').length){var tx=$('#fTx').html();$('#fv23 textarea').val(tx.replace(/<br>/gi,'\n'));}
$('#fv23 textarea').keydown(function(evt){evt=evt||window.event;var key=evt.keyCode||evt.which;if(evt.ctrlKey){if(key==10||key==13){$('#fv22 .btn1').click();}}});$('#fv22').show();}
function svFoto(id){if(SendD)return;SendD=true;if(!$('#fTx').length)$('#fv5 .fv6').prepend('<div id="fTx"></div>');$('#fTx').html('<img src="/tpl/img/loadings.gif"/>');edFotoCl();$.post('/photo/ajax.php?fsvc='+id+'&r='+Math.random(),{cmt:$('#fv23 textarea').val()},function(data){if(data=='false')return;if(data=='')$('#fTx').remove();else $('#fTx').html(data.replace(/\n/gi,'<br>'));SendD=false;});}
function FotoAp(id){$('#fe10').show();$('#fd'+id+' div').prepend('<img src="/tpl/img/loadings.gif"/>');$.get('/photo/ajax.php?albf='+id+'&r='+Math.random(),function(data){$('#fe10').hide();$('#fd'+id+' div img').remove();if(data=='false')return;$('#fe9').attr('src','/db/f_alb/'+data);});}
function FotoDl(id,x){showDialog('<div style="padding:20px;text-align:center">'+lc1+'</div>','<input type="button" value="'+lc2+'" class="btn1"/> <input type="button" value="'+lc3+'" class="btn2"/>');$('#dlgB .btn1').click(function(){$('#dlgT div').html('<img src="/tpl/img/loadings.gif"/>');$('#dlgB .btn1').remove();$.get('/photo/ajax.php?delf='+id+'&r='+Math.random(),function(data){if(typeof(x)=='undefined'){hideDialog();if(data=='false')return;$('#fd'+data).remove();}else{if(window.location=='http://'+document.domain+$('#f02').attr('href'))window.location='/album'+x;else window.location=$('#f02').attr('href');}});});$('#dlgB .btn2').click(hideDialog);}
function fotoUoF(id,a){$('#fv2 img').show();$.get('/photo/ajax.php?cUoF='+id+'&act='+a+'&r='+Math.random(),function(data){if(data=='false')return;$('#fv2').remove();});}
function ShowUR(id){c=$('#ftA'+id).attr('coords').split(',');$('<div id="siR'+id+'" style="border:1px solid #abc;width:'+(c[2]-c[0])+'px;height:'+(c[3]-c[1])+'px;position:absolute;left:'+($('#f00').offset().left+Number(c[0]))+'px;top:'+($('#f00').offset().top+Number(c[1]))+'px'+'"><div style="border:2px solid #f6f6f6;height:'+(c[3]-c[1]-4)+'px"><div style="border:1px solid #abc;height:'+(c[3]-c[1]-6)+'px"></div></div></div>').appendTo('body');}
function HideUR(id){$('#siR'+id).remove();}
function ShowUI(id){c=$('#ftA'+id).attr('coords').split(',');$('<div id="siU'+id+'" style="border:1px solid #abc;color:#369;padding:2px 4px;white-space:nowrap;background:#fff;position:absolute;left:'+($('#f00').offset().left+Number(c[0]))+'px;top:'+($('#f00').offset().top+Number(c[3]))+'px'+'">'+$('#ftU'+id).text()+'</div>').appendTo('body');}
function HideUI(id){$('#siU'+id).remove();}
function FtRv(id,r){$.get('/photo/ajax.php?frt='+id+'&v='+r+'&r='+Math.random(),function(data){$('.fsr').attr('onmouseover','');$('.fsr li').html('&nbsp;');if(data!='false'){$('.fcrf').css('width',data+'px');$('#f01').text(Number($('#f01').text())+1);}});}
function FtDof(id){$('#ftD'+id).replaceWith('<img src="/tpl/img/loadings.gif" id="ftD'+id+'"/>');$.get('/photo/ajax.php?donf='+id+'&r='+Math.random(),function(data){if(data=='false')return;$('#ftD'+data+', #ftU'+data+', '+'#z'+data+', #ftA'+data).remove();if(!$('#fv10 a,#fv10 span').length)$('#fv10').hide();else{x=$('#fv10').children(':first');if($(x).attr('id').substr(0,1)=='z')$(x).remove();}});}
function FotoDh(id){showDialog('<div style="padding:20px;text-align:center">'+ln1+'</div>','<input type="button" value="'+ln2+'" class="btn1"/> <input type="button" value="'+ln3+'" class="btn2"/>');$('#dlgB .btn1').click(function(){$.get('/photo/ajax.php?donf='+id+'&r='+Math.random(),function(data){hideDialog();if(data=='false')return;$('#fh'+data).remove();});});$('#dlgB .btn2').click(hideDialog);}
function FotLP(p,id){$.get('/photo/ajax.php?pgl='+p+'&id='+id+'&r='+Math.random(),function(data){if(data!='false')$('#fo4').html(data);});$('#fo3').html('<img src="/tpl/img/loadings.gif">');}
function FotCm(){if($('#fo2 textarea').val()!=''){id=$('#fo02').val();if($('#fo01').length)pg=$('#fo01').text();else pg=1;$.post('/photo/ajax.php?ncmt='+id+'&r='+Math.random(),{cmt:$('#fo2 textarea').val(),pg:pg},function(data){if(data!='false')$('#fo4').html(data);;$('#fo2').html(VCF);$('#fo2 textarea').keydown(function(evt){evt=evt||window.event;var key=evt.keyCode||evt.which;if(evt.ctrlKey){if(key==10||key==13){FotCm();}}}).jGrow({rows:15});});$('#fo2').html('<div style="text-align:center"><img src="/tpl/img/loadings.gif"></div>');}}
function FotDc(n,id){$('#FCm'+n+' .fo10 *').hide();$('#FCm'+n+' .fo10').append('<img src="/tpl/img/loadings.gif"/>');$.get('/photo/ajax.php?dcmt='+n+'&id='+id+'&r='+Math.random(),function(data){if(data!='false'){$('#FCm'+n+' .fo10 img').remove();b=$('#FCm'+n).parent();$(b).find('*').hide();$(b).append('<div class="fo11">'+ln3+'. <a href="javascript:FotRc('+n+','+id+')">'+ln4+'</a>.</div>');}});}
function FotRc(n,id){b=$('#FCm'+n).parent();$(b).find('.fo11').html('<img src="/tpl/img/loadings.gif"/>');$.get('/photo/ajax.php?rcmt='+n+'&id='+id+'&r='+Math.random(),function(data){if(data!='false'){$(b).find('.fo11').remove();$(b).find('*').show();}});}
function FotEc(c){var tx=$('#FCm'+c+' .fo9').html();$('#FCm'+c+' .fo10').hide();$('#FCm'+c+' .fo9').html('<textarea rows=3></textarea><div style="padding:2px 1px 0 0;text-align:right"><input type="button" value="'+ln2+'" class="btn2" onclick="FotSc('+c+')"></div>');$('#FCm'+c+' textarea').jGrow({rows:15}).val(tx.replace(/<br>/gi,'\n')).keydown(function(evt){evt=evt||window.event;var key=evt.keyCode||evt.which;if(evt.ctrlKey){if(key==10||key==13){FotSc(c);}}});}
function FotSc(c){var tx=$('#FCm'+c+' textarea').val();$('#FCm'+c+' .fo9').html('<div style="text-align:center;padding:20px"><img src="/tpl/img/loadings.gif"></div>');$.post('/photo/ajax.php?scmt='+c+'&r='+Math.random(),{cmt:tx},function(data){if(data!='false'){$('#FCm'+c+' .fo9').html(tx.replace(/\n/gi,'<br>'));$('#FCm'+c+' .fo10').show();}});}
