$(document).ready(function(){
     
    $("#content img").each(function (i) {
       var img_href = $(this).attr("src");
       
       if($(this).attr("alt")){
         var title = $(this).attr("alt");
       }else{
         var title = '';
       }

       if (img_href.indexOf('content/images/')!=-1 && img_href.indexOf('content/images/small')==-1){
         $(this).wrap('<a href="'+img_href+'" class="fancybox" title="'+title+'" rel="group"></a>');
       }else{
//         $(this).wrap('<div style="height:200px; width:130px; float:left; padding:20px;"><center><b></b><div style="text-align:center;">'+title+'</div></center></div>');
       }
     });
     
     $('#content a[class=fancybox]').fancybox({'titlePosition' : 'inside', 'SpeedIn': 500, 'SpeedOut': 400, 'overlayShow': true, 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'easingIn' : 'easeOutBack', 'easingOut' : 'easeInBack' });// titlePosition:over
 
     $('a[class=new_page]').fancybox({'autoScale' : false, 'type' : 'iframe', 'width':500, 'height':500});
     $('a[class=edit]').fancybox({'autoScale' : false, 'type' : 'iframe', 'width':600,'height':550});
    
   // $(selector).datepicker($.datepicker.regional['fr']);
     
});

function DraugiemSay( title, url, titlePrefix ){
 window.open(
  'http://www.draugiem.lv/say/ext/add.php?title=' + encodeURIComponent( title ) +
  '&link=' + encodeURIComponent( url ) +
  ( titlePrefix ? '&titlePrefix=' + encodeURIComponent( titlePrefix ) : '' ),
  '',
  'location=1,status=1,scrollbars=0,resizable=0,width=530,height=400'
 );
 return false;
}

function sendemail(id, title){
 window.open(
  'sys/sendemail.php?id='+id+'&title='+encodeURIComponent(title),
  '',
  'location=1,status=1,scrollbars=0,resizable=0,width=400,height=300'
 );
 return false;
}

