$(document).ready(function(){
   $('#myForm1').ajaxForm(function() { 

     $('input#photopict').val('');
     $('input#photolabel').val('');
     $('input#photodescr').val('');
     $('div#pictures').empty();
     str1 = $('input#userid').val();

     $.get('/albumshow1.php', { 'userid': str1 }, function(data)
     {
        $('div#pictures').append(data);
     }); 
   });

   $('div#postgallery').hide();

   $('div#friends1').hide();
   $('div#album1').hide();
   $('div#messages1').hide();
   $('div#guests1').hide();
   $('p#plannamed1').hide();
   $('p#plannamed2').hide();
   $('p#plannamed3').hide();
   $('table.pubrec').hide();
   $('table.savrec').hide();
   $('p#editcurrecord').hide();
   $('p#editcurrecord2').hide();
   $('p#info1').hide();      
   $('p#info3').hide();   
   $('p#showguest').hide();
   $('p#newplan1').hide();   
   $('p#newplan2').hide();
   $('p#currplanmessage').hide();

   $('#menu>ul').tabs({
	fxFade: true,
	fxSpeed: 'fast'
   });

   $('#menu1>ul').tabs({
	fxFade: true,
	fxSpeed: 'fast'
   });

   $('#menu2>ul').tabs({
	fxFade: true,
	fxSpeed: 'fast'
   });

$('input.addgallery').click(function(){
   postid = $(this).attr('id');
   userid = $('input#curgaluserid').val();

   $('div#postgallery').show('fast');
   $.get('/shownewgallery.php', { 'userid': userid, 'postid':postid }, function(data)
   {
      $('div#postgallery').text('');
      $('div#postgallery').append(data);
   });
});

$('p#mainpage').click(function(){

      $('div#menu1').show('fast');   
      $('div#friends1').hide('fast');
      $('div#album1').hide('fast');
      $('div#messages1').hide('fast');
      $('div#guests1').hide('fast');
});

$('p#album').click(function(){

      $('div#menu1').hide('fast');   
      $('div#friends1').hide('fast');
      $('div#album1').show('fast');
      $('div#messages1').hide('fast');
      $('div#guests1').hide('fast');
});

$('p#messages').click(function(){

      $('div#menu1').hide('fast');   
      $('div#friends1').hide('fast');
      $('div#album1').hide('fast');
      $('div#messages1').show('fast');
      $('div#guests1').hide('fast');
});

$('#poisk').click(function(){

   var str1 = $('select#city2').val();
   var str2 = $('input#fio2').val();
   var str3 = $('select#bday2').val();
   var str4 = $('select#bmonth2').val();
   var str5 = $('select#byear2').val();
   var str6 = $('input#company2').val();
   var str7 = $('select#business2').val();
   var str8 = $('input#userid').val();

   $('p#answer').text('');
   $('p#answer2').text('');
   $('p#answer3').text('');

   $.get('/search.php', { 'city': str1, 'fio': str2, 'bday': str3, 'bmonth': str4, 'byear': str5, 'company': str6, 'business': str7, 'userid': str8 }, function(data)
   {
      $('p#answer').append(data);
   });
});


   $('#myForm').ajaxForm(function() { 

     $('input#photopict').val('');
     $('input#photolabel').val('');
     $('input#photodescr').val('');

     var str1 = $('input#userid').val();

     $('p#photos').text('');

     $.get('/albumshow.php', { 'userid': str1 }, function(data)
     {
        $('p#photos').append(data);
     }); 
   });

   $('#delpic').ajaxForm(function() { 

     jAlert('deleted');

     $('p#photos').text('');

     $.get('/albumshow.php', { 'userid': '1' }, function(data)
     {
        $('p#photos').append(data);
     }); 
   });   


$('input#planadd').click(function(){

         var str1 = $('input#planname').val();

         var sel1 = $('input#part1').val();
         var sel2 = $('input#part2').val();
         var sel3 = $('input#part3').val();

         var bloguserid = $('input#bloguserid').val();

         $('option#sel1').text(sel1);
         $('option#sel2').text(sel2);
         $('option#sel3').text(sel3);

         $('table#plans').hide('fast');    
         $('p#plannamed3').show('fast');
         $('p#planname1').text(str1);

         $.get('/blogaddrubrika.php', { 'userid': bloguserid, 'name':str1, 'part1':sel1, 'part2':sel2, 'part3':sel3 }, function(data)
         {
             $('p#check').append(data);
         });
});

$('input#saveblog1').click(function(){

         var name = $('input#savename').val();
         var mess = $('textarea#savemessage').val();
         var labe = $('input#savelabel').val();
         var user = $('input#saveuserid').val();
         var rubr = $('p#planname1').text();
         var part = $('select#selpart').val();

         $.post('/blogaddmessage.php', { 'name': name, 'mess':mess, 'labe':labe, 'user':user, 'rubr':rubr, 'part':part }, function(data)
         {
             $('p#check').append(data);
             jAlert('Запись успешно сохранена в блог!','Внимание');
             $('input#savename').val('');
             $('textarea#savemessage').val('');
             $('input#savelabel').val('');
         });
});

$('u#pubrec').click(function(){

   $('u#pubrec').css('background-color','yellow');
   $('u#allrec').css('background-color','white');
   $('u#savrec').css('background-color','white');
   $('p#editcurrecord').hide('fast');
   $('p#editcurrecord2').hide('fast');

   str = $('input#uuu').val();

   $('span.pubrec').text('');
   $('table.allrec').text('');

         $.get('/tableallrec.php', { 'userid': str, 'status':1 }, function(data)
         { $('table.allrec').append(data); });

         $.get('/pubrecs.php', { 'userid': str }, function(data)
         { $('span.pubrec').append(data); });
});

$('u#allrec').click(function(){

   $('u#allrec').css('background-color','yellow');
   $('u#pubrec').css('background-color','white');
   $('u#savrec').css('background-color','white');
   $('p#editcurrecord').hide('slow');
   $('p#editcurrecord2').hide('slow');

   var str = $('input#uuu').val();

   $('table.allrec').text('');

         $.get('/tableallrec.php', { 'userid': str, 'status':0 }, function(data)
         {
             $('table.allrec').append(data);
         });
});

$('u#savrec').click(function(){

   $('u#savrec').css('background-color','yellow');
   $('u#allrec').css('background-color','white');
   $('u#pubrec').css('background-color','white');
   $('p#editcurrecord').hide('fast');
   $('p#editcurrecord2').hide('fast');

   var str = $('input#uuu').val();

   $('table.allrec').text('');
   $('span.savrec').text('');

         $.get('/tableallrec.php', { 'userid': str, 'status':2 }, function(data)
         {
             $('table.allrec').append(data);
         });

         $.get('/savrecs.php', { 'userid': str }, function(data)
         {
             $('span.savrec').append(data);
         });
});

$('u#pubrec').click();

$('input#checkall').click(function(){

   var checked_status = this.checked;
   $('input.zapis').each(function()
   {
   this.checked = checked_status;
   });
});

$('tr.allrecs').click(function(){

   $('p#editcurrecord2').hide();

    $('tr.allrecs').each(function(){

       $(this).attr('bgcolor','white');
    });

    var str1 = $(this).attr('id');

    $(this).attr('bgcolor','yellow');
    
         $.get('/editcurrecord.php', { 'id': str1 }, function(data)
         {
            $('p#editcurrecord').text('');
            $('p#editcurrecord').show('slow');   
            $('p#editcurrecord').append(data);
         });

});

$('u#changeinfo').click(function(){

    $('p#info').hide('slow');   
    $('p#info1').show('slow');   

});

$('input#chcancel').click(function(){

    $('p#info1').hide('slow');   
    $('p#info').show('slow');   

});

$('u#changeinfo2').click(function(){

    $('p#info2').hide('slow');   
    $('p#info3').show('slow');   

});

$('input#infcancel').click(function(){

    $('p#info3').hide('slow');   
    $('p#info2').show('slow');   

});

$('input#chsave').click(function(){
    var gorod = $('input#chgorod').val();
    var address = $('input#chaddress').val(); 
    var phone = $('input#chphone').val();
    var email = $('input#chemail').val();
    var icq = $('input#chicq').val();
    var userid = $('input#chuserid').val();

    $.get('/editcontacts.php', { 'userid': userid, 'gorod':gorod, 'address':address, 'phone':phone, 'email':email, 'icq':icq }, function(data)
         {
            $('p#info1').hide('slow');   
            $('p#info').show('slow');   
            $('p#info').text('');
            $('p#info').append(data);
         });
});

$('input#infsave').click(function(){

    var company = $('input#infcompany').val();
    var userid = $('input#infuserid').val();

         $.get('/editinfo.php', { 'userid': userid, 'company':company }, function(data)
         {
            $('p#info3').hide('slow');   
            $('p#info2').show('slow');   
            $('p#info2').text('');
            $('p#info2').append(data);
         });
});

   $('a.showguest').click(function(){
     
     var userid = $(this).attr('id');
     var myid = $(this).attr('myid');
     
     $('p#showguest').text('');

     $.get('/showguest.php', { 'userid': userid, 'myid':myid }, function(data)
     {
        $('p#showguest').show('slow'); 
        $('p#showguest').append(data);
     });
   });

   $('u.showguest2').click(function(){
     
     var userid = $(this).attr('id');
     var myid = $(this).attr('myid');
     
     $('p#showguest2').text('');

     $.get('/showguest2.php', { 'userid': userid, 'myid':myid }, function(data)
     {
        $('p#showguest2').show('slow'); 
        $('p#showguest2').append(data);
     });
});

$('.addvoice').click(function(){

    selectid = $(this).attr('id');
    myid = $('input#myid').val();
    blogid = $('input#blogid').val();

    $.get('/addvoice.php', { 'myid': myid, 'blogid':blogid, 'blognum':selectid }, function(data)
    { 
       jAlert (data,'Внимание');
    });
});

$('.addvoice0').click(function(){

    selectid = $(this).attr('id');

    myid = $('input#myid').val();
    blogid = $('input#blogid').val();

    $.get('/addvoice0.php', { 'myid': myid, 'blogid':blogid, 'blognum':selectid }, function(data)
    { 
       jAlert (data,'Внимание');    
    });
});

$('input.addcomment1').click(function(){
   idi1 = $(this).attr('id');
   myid = $('input#myid').val();
   blogid = $('input#blogid').val();
   $('td.oldcomments').text('');
   $('td.oldcomments').hide('slow');
  
   $('input.blogcomment1').each(function()
   {
      idi2 = $(this).attr('id');
      if (idi1==idi2)
      {
         stroka = $(this).val();
         $(this).val('');
         $.get('/addcomment.php', { 'myid': myid, 'blogid':blogid, 'blognum':idi1, 'comment':stroka, 'idbutton':idi1 }, function(data)
         { 
            $('td.oldcomments').show('slow');
            $('td.oldcomments').append(data);
            $('span.opencomment').each(function()
            {
               sid=$(this).attr('id');
               if (idi1==sid) $(this).toggle();
            });
         });
      }
   });   
});

$('input#newplannameadd').click(function(){

   var planname = $('input#newplanname').val();
   var bloguserid = $('input#bloguserid').val();

   if (!planname) jAalert ('Вы не ввели наименование плана!','Внимание');
   if (planname)
   {
         $.get('/blogaddrubrika1.php', { 'userid': bloguserid, 'name':planname }, function(data)
         {
             $('input#idrubriki').val(data);
             $('span#plannameadded').text('План успешно создан');
             $('p#newplan2').show('slow');
         });
   }
});

$('input#addetapadd').click(function(){

   aname = $('input#addetapname').val();
   auserid = $('input#addetapuserid').val();
   aidrubr = $('input#addetapidrubriki').val();

   $.get('/addetapadd.php', { 'aname': aname, 'auserid':auserid, 'aidrubr':aidrubr }, function(data)
         {
                $('p#currplan4').hide('slow');
                $('u#currplan').click();
         });
});


$('p#madeetaps').hide();
$('p#currplan4').hide();

$('input#newetapnameadd').click(function(){

   var etapname = $('input#newetapname').val();
   var bloguserid = $('input#bloguserid').val();
   var idrubriki = $('input#idrubriki').val();

   if (!etapname) jAalert ('Вы не ввели наименование этапа!','Внимание');
   if (etapname)
   {
         $.get('/blogaddetap1.php', { 'userid': bloguserid, 'name':etapname, 'idrubriki':idrubriki }, function(data)
         {
             $('input#idetapa').val(data);
             $('span#etapnameadded').text('Этап успешно создан');
             $('input#newetapnameadd2').show('slow');
             $('p#madeetaps').show('slow');
             $('p#madeetaps').append('<br><font color=blue>'+etapname+'</font>');
         });
   }
});

$('input#newetapnameadd2').hide();

$('input#newetapnameadd2').click(function(){

   $('input#newetapname').val('');
   $('span#etapnameadded').text('');   
   $('input#newetapnameadd2').hide('slow');
});

   $('p#currplan1').hide();
   $('p#addmessage').hide();

$('input#newsave1').click(function(){

var iduser=$('input#iduserA').val();
var idplan=$('input#idplanA').val();
var idetap=$('input#idetapA').val();
var newheader=$('input#newheader').val();
var newlabels=$('input#newlabels').val();
var newbody=$('textarea#newbody').val();
var newvoice=$('select#newvoice').val();
var newcomment=$('select#newcomment').val();
alert('aaa');
$.post('/addpostsave.php', { 'iduser': iduser, 'idplan':idplan, 'idetap':idetap, 'newheader':newheader, 'newlabels':newlabels, 'newbody':newbody, 'newvoice':newvoice, 'newcomment':newcomment  }, function(data){

   postid = data;
   userid = iduser;
   $('p#addmessage').hide('slow');
   $('#myimageswrite').hide();
   $('#myimageswrite2').hide();
   $('#vivodpictwrite').hide();
   
});
});

$('input#newsavepub').click(function(){

var iduser=$('input#iduserA').val();
var idplan=$('input#idplanA').val();
var idetap=$('input#idetapA').val();
var newheader=$('input#newheader').val();
var newlabels=$('input#newlabels').val();
var newbody=$('textarea#newbody').val();
var newvoice=$('select#newvoice').val();
var newcomment=$('select#newcomment').val();

$.post('/addpostsavepub.php', { 'iduser': iduser, 'idplan':idplan, 'idetap':idetap, 'newheader':newheader, 'newlabels':newlabels, 'newbody':newbody, 'newvoice':newvoice, 'newcomment':newcomment  }, function(data){
   
   postid = data;
   userid = iduser;
   $('p#addmessage').hide('slow');
   $('#myimageswrite').hide();
   $('#myimageswrite2').hide();
   $('#vivodpictwrite').hide();
});
});

$('u.sendmess').click(function(){

   pname = $(this).attr('id');
   pid = $(this).attr('idid');
   $('input#sendmessid1').val(pid);
   $('span#sendmessname').text(pname);
   $('div.sendmess1').show('slow');
});

$('span.wholemess').hide();

$('input.readmess').each(function(){
   readstat = $(this).attr('idid');
   if (readstat==1) $(this).hide();
});

$('span.wholemess').each(function(){
   readstat = $(this).attr('idid');
   if (readstat==1) $(this).show();
});

$('input.readmess').click(function(){

    buttid = $(this).attr('id');
    $(this).hide();
    $('span.wholemess').each(function()
    {
       spanid=$(this).attr('id');
       if (buttid==spanid)
       {
          $(this).show('slow');
          $('span.statmess').each(function()
          {
             stat=$(this).attr('id');
             if (buttid==stat)
             {
                $(this).text('');
                $(this).append('<font color=green>Прочитано</font>');
                $.get('/readmess.php', { 'stat': stat }, function(data){

                });
             }
          });
       }
    });

});

$('input.answmess').click(function(){

   idto = $(this).attr('idto');
   idfrom = $(this).attr('idfrom');
   nameto = $(this).attr('nameto');

   $('span#sendmessname').text(nameto);
   $('input#sendmessid1').val(idto);
   $('input#sendmessid2').val(idfrom);

   $('div.sendmess1').show('slow');
});

$('p.levelcomm').hide();

$('u.levelcomm').click(function(){
   idi = $(this).attr('id');

   $('p.levelcomm').each(function()
   {
      idp = $(this).attr('id');
      if (idi==idp) $(this).show('slow');
   });   
});

$('input.newcomm2').click(function(){

   idi2=$(this).attr('id');
   fromid=$(this).attr('idid');

   $('input.newcomm1').each(function()
   {
      idi1 = $(this).attr('id');
      mess = $(this).val();
      if (idi2==idi1)
      {
         $.get('/addlevelcomm.php', { 'idcomm': idi2, 'mess':mess, 'fromid':fromid }, function(data){
            
         });

         $('p.levelcomm').each(function()
         {
            idp = $(this).attr('id');
            if (idi2==idp)
            {
               $(this).hide('slow');
            }
         }); 
      }
   });   
});

$('input.newcomm2hide').click(function(){
   idi2h = $(this).attr('id');

   $('p.levelcomm').each(function()
   {
      idp = $(this).attr('id');
      if (idi2h==idp)
      {
         $(this).hide('slow');
      }
   });  
});

$('td.faceposts').hide();

$('u.faceposts').click(function(){
   idi=$(this).attr('id');
   $('td.faceposts').each(function()
   {
      idt = $(this).attr('id');
      if (idi==idt)
      {
         $(this).show();
         $('td.blogmessage').each(function()
         {
            idt1 = $(this).attr('id');
            if (idi==idt1)
            {
               $(this).hide();
               $('td.blogphotos').each(function()
               {
                  idt2 = $(this).attr('id');
                  if (idi==idt2) $(this).hide();
               });
               $('td.bloglabel').each(function()
               {
                  idt3 = $(this).attr('id');
                  if (idi==idt3) $(this).hide();
               });
               $('td.facepostssave').each(function()
               {
                  idtd = $(this).attr('id');
                  if (idi==idtd) $(this).hide();
               });
            }
         });
      }
   });
});

$('u.fcansel').click(function(){
   idi=$(this).attr('id');
   $('td.faceposts').each(function()
   {
      idt = $(this).attr('id');
      if (idi==idt)
      {
         $(this).hide();
         $('td.blogmessage').each(function()
         {
            idt1 = $(this).attr('id');
            if (idi==idt1)
            {
               $(this).show();
               $('td.bloglabel').each(function()
               {
                  idt2 = $(this).attr('id');
                  if (idi==idt2) $(this).show();
               });
               $('td.blogphotos').each(function()
               {
                  idt3 = $(this).attr('id');
                  if (idi==idt3) $(this).show();
               });
            }
         });
      }
   });
});

$('td.facepostssave').hide();

$('u.editblogsavemymorda').click(function(){
   idi1 = $(this).attr('id');
   $('input.editbloglabelmymorda').each(function()
   {
      idi2 = $(this).attr('id');
      label1 = $(this).val();
      if (idi1==idi2)
      {
         $('textarea.editblogmessmymorda').each(function()
         {
            idt = $(this).attr('id');
            if (idi1==idt)
            {
               mess1 = $(this).val();                               
               $.post('/editblogsave.php', { 'id': idi1, 'label':label1, 'mess':mess1 }, function(data){

                  $('td.facepostssave').each(function()
                  {
                     idtds = $(this).attr('id');
                     if (idi1==idtds)
                     {
                        $(this).show();
                        $(this).text('');
                        $(this).append(data);
                     }
                  });
                  $('td.faceposts').each(function()
                  {
                     idtd = $(this).attr('id');
                     if (idi1==idtd)
                     {
                        $(this).hide('');
                     }
                  });                  
               });               
            }
         });         
      }
   });   
});

$('u.editblogsavednevnik').click(function(){
   idi1 = $(this).attr('id');
   $('input.editbloglabeldnevnik').each(function()
   {
      idi2 = $(this).attr('id');
      label1 = $(this).val();
      if (idi1==idi2)
      {
         $('textarea.editblogmessdnevnik').each(function()
         {
            idt = $(this).attr('id');
            if (idi1==idt)
            {
               mess1 = $(this).val();
               $.post('/editblogsave.php', { 'id': idi1, 'label':label1, 'mess':mess1 }, function(data){

                  $('td.facepostssave').each(function()
                  {
                     idtds = $(this).attr('id');
                     if (idi1==idtds)
                     {
                        $(this).show();
                        $(this).text('');
                        $(this).append(data);
                     }
                  });
                  $('td.faceposts').each(function()
                  {
                     idtd = $(this).attr('id');
                     if (idi1==idtd)
                     {
                        $(this).hide();
                     }
                  });                  
               });               
            }
         });         
      }
   });   

});


$('span.opencomment').hide();

$('u.opencomment').click(function(){
   aid = $(this).attr('id');
   $('span.opencomment').each(function()
   {
      sid = $(this).attr('id');
      if (aid==sid) $(this).toggle();
   });
});

$('p.part').hide();

$('p.rubrika').click(function(){
   pid1 = $(this).attr('id');
   $('p.part').each(function()
   {
      pid2 = $(this).attr('idid');
      if (pid1==pid2) $(this).slideToggle('fast');
   });
});

$('p.post2').hide();

$('p.rubrika2').click(function(){
   pid1 = $(this).attr('id');
   $('p.part2').each(function()
   {
      pid2 = $(this).attr('idid');
      if (pid1==pid2) $(this).slideToggle('fast');
   });
});

$('p.part2').click(function(){
   pid1 = $(this).attr('id');
   $('p.post2').each(function()
   {
      pid2 = $(this).attr('id');
      if (pid1==pid2) $(this).slideToggle('fast');
   });
});

$('td.oldcomments').hide();

$('u.showcurrcomm').click(function(){
   uid = $(this).attr('id');
   $('td.oldcomments').each(function()
   {
      tdid = $(this).attr('id');
      if (uid==tdid) $(this).slideToggle('slow');
   });
});

$('u#hideallparts').click(function(){ $('p.part').hide('fast'); });

$('u#showallparts').click(function(){ $('p.part').show('fast'); });

$('div#myimages').css('z-index','100');

$('a.myimages').click(function(){

   $('div#myimages').slideToggle('fast');

});

$('#myFormaddimages').ajaxForm(function() { 

   $('input#photopict').val('');
   $('input#photopict2').val('');
   $('input#photopict3').val('');
   var str1 = $('input#userid').val();

   $('#vivodpict').empty();
   $.get('/albumshow2.php', { 'userid': str1 }, function(data)
   {
      $('#vivodpict').append(data);
   }); 
});

$('#myFormaddimagesdnevnik').ajaxForm(function() { 

   $('input#photopictb').val('');
   $('input#photopict2b').val('');
   $('input#photopict3b').val('');
   var str1 = $('input#userid').val();

   $('#vivodpictdnevnik').empty();
   $.get('/albumshow3.php', { 'userid': str1 }, function(data)
   {
      $('#vivodpictdnevnik').append(data);
   }); 
});


$('input.addtotextarea1').click(function(){
   idmain = $('input#idmain').val();
   id1 = $(this).attr('id');
   $('textarea.addtotextarea2').each(function()
   {
      id2=$(this).attr('id');
      if (id1==id2)
      {
         sometext = $(this).text();
         $('textarea.editblogmessmymorda').each(function()
         {
            id3 = $(this).attr('id');
            if (id3==idmain)
            {
               oldtext = $(this).text();
               $(this).text('');
               $(this).text(oldtext+sometext);
            }
         });
      }
   });
   
});

$('.bold').attr('title','Полужирный');
$('.italic').attr('title','Курсив');
$('.strikeThrough').attr('title','Перечеркнутый');
$('.underline').attr('title','Подчеркнутый');
$('.justifyLeft').attr('title','Выровнять по левому краю');
$('.justifyCenter').attr('title','Выровнять по центру');
$('.justifyRight').attr('title','Выровнять по правому краю');
$('.justifyFull').attr('title','Выровнять по ширине');
$('.indent').attr('title','Увеличить отступ');
$('.outdent').attr('title','Уменьшить отступ');
$('.subscript').attr('title','Нижний регистр');
$('.superscript').attr('title','Верхний регистр');
$('.undo').attr('title','Отменить действие');
$('.redo').attr('title','Отменить отмену действия');
$('.insertOrderedList').attr('title','Нумерованный список');
$('.insertUnorderedList').attr('title','Список');
$('.insertHorizontalRule').attr('title','Вставить разделитель ЧИТАТЬ ДАЛЕЕ');
$('.createLink').attr('title','Добавить ссылку');
$('.insertImage').attr('title','Добавить изображение');
$('.increaseFontSize').attr('title','Увеличить размер шрифта');
$('.decreaseFontSize').attr('title','Уменьшить размер шрифта');
$('.html').attr('title','Исходный код');

$('input.temppath').click(function(){

  $(this).each(function(){
     id=$(this).attr('id');  
     $('input#temppath').val(id);        
  });
});

$('.sendvoicetouser').click(function(){
   $(this).each(function(){
     id=$(this).attr('id');  
     idid=$(this).attr('idid');
     $.get('/sendvoicetouser.php', { 'id': id, 'idid':idid }, function(data)
     {
        jAlert(data,'Внимание');
     });
  });
});

$('.sendvoicetouser0').click(function(){
   $(this).each(function(){
     id=$(this).attr('id');  
     idid=$(this).attr('idid');
     $.get('/sendvoicetouser0.php', { 'id': id, 'idid':idid }, function(data)
     {
        jAlert(data,'Внимание');
     });
  });
});


opisanie = $('input#opisanie').val();
if (opisanie) { $('table.opisanie').hide(); } else { $('table.opisanie').show(); }


$('input.deltemppath').click(function(){

     $(this).each(function(){
        id=$(this).attr('id');
        $.get('/deltemppath.php', { 'id': id }, function(data)
        {
           $('p#photos2').text('');
           $('p#photos2').append(data);
        });
     });
});

$('a.namepostmorda').each(function(){
   mainpath = "";
   mainsub = "";
   mainpath = $(this).attr('href');
   mainsub = "post";
   num = mainpath.indexOf(mainsub);
   if (num>0)
   { 
      num=0;
      id = $(this).attr('id');
      mainpath2 = $(this).attr('href');
      $('a#cut').attr('id', function(arr)
      {
         return "cut"+id;
      })
      .each (function(){
         $(this).attr('href',mainpath2);
      });
   }
});

$('img').each(function(){
   path = $(this).attr('src');
   tofind = 'album/';
   num = path.indexOf(tofind);
   if (num>0)
   {
      num=0;
      $(this).attr('class','imgpad');
      $(this).attr('id',path);
      $(this).attr('height',150);
      $(this).attr('style','cursor:pointer');
      $(this).attr('onClick','window.open(\''+path+'\')');
   }
});


$('input#other_region_choose').click(function(){
   region = $('select#other_region').val();
   $('span#for_region').empty();
   $.get('/changeregion2.php', { 'region': region }, function(data){
      $('span#for_region').append(data);
   });   
});


$('span#feedon').click(function(){
   id1=$(this).attr('id1');
   id2=$(this).attr('id2');
   
   $.get('/feedon.php', { 'id1': id1, 'id2':id2 }, function(data)
   {
	jAlert('Вы подписались на ленту активности данного пользователя!','Внимание');		
	});
});

$('span#feedoff').click(function(){
   id1=$(this).attr('id1');
   id2=$(this).attr('id2');
   
   $.get('/feedoff.php', { 'id1': id1, 'id2':id2 }, function(data)
   {
	jAlert('Вы отписались от ленты активности данного пользователя!','Внимание');		
	});
});


});
