function show_hide_text(divObj,text) {
    var div = divObj.parentNode.getElementsByTagName('div')[1];
    if (div.style.display == 'none') {
        div.style.display = 'block';
        divObj.innerHTML = '<p class="zagolovok">Скрыть <strong class="стиль1"><-</strong></p>';
    } else {
        div.style.display = 'none';
        divObj.innerHTML = '<p class="zagolovok">Показать <strong class="стиль1">-></strong></p>';
    }
}
$(document).ready(function(){
   /* Этот код будет выполнен при загрузке страницы */
   /* Заменяет все параграфы */
   $('.main p').replaceWith(function(){
      /*
      	Атрибуты style, class и title тега p
      	Копируются в раскрывающийся блок:
      */
      return '\
         <div style="'+$(this).attr('style')+'">\
         \
         <div>\
         <div><div></div></div>\
         <p>'+$(this).attr('title')+'</p>\
         </div>\
         \
         <div>\
         <p>'+$(this).html()+'</p>\
         </div>\
         </div>';
   });
   $('.slideOutTip').each(function(){
      /*
      	Задаем ширину для ярлыка блока, взяв за основу ширину заголовка.
      	Это необходимо потому что IE не может корректно определить ширину сам.
      */
      $(this).width(40+$(this).find('.tipTitle').width());
   });
   /* Обработчик события click: */
   $('.tipVisible').bind('click',function(){
      var tip = $(this).parent();
      /* Если проигрывается анимация открытия/показа блока,то функция не выполняется */
      if(tip.is(':animated'))
         return false;
      if(tip.find('.slideOutContent').css('display') == 'none'){
         tip.trigger('slideOut');
      }else tip.trigger('slideIn');
   });
$('.slideOutTip').bind('slideOut',function(){
   var tip = $(this);
   var slideOut = tip.find('.slideOutContent');
   /* Закрываем все блоки что сейчас открыты: */
   $('.slideOutTip.isOpened').trigger('slideIn');
   /* Выполняется только при первом клике по блоку: */
   if(!tip.data('dataIsSet')){
      tip.data('origWidth',tip.width())
         .data('origHeight',tip.height())
         .data('dataIsSet',true);
      if(tip.hasClass('openTop')){
         /*
            If this slideout opens to the top, instead of the bottom,
            calculate the distance to the bottom and fix the slideout to it.
         */
         tip.css({
            bottom : tip.parent().height()-(tip.position().top+tip.outerHeight()),
            top	: 'auto'
         });
         /*
            Fixing the title to the bottom of the slideout,
            so it is not slid to the top on open:
         */
         tip.find('.tipVisible').css({position:'absolute',bottom:3});
         /*
            Moving the content above the title, so it can
            slide-open to the top:
         */
         tip.find('.slideOutContent').remove().prependTo(tip);
      }
      if(tip.hasClass('openLeft')){
         /*
            If this slideout opens to the left, fix it to the right so
            the left edge can expand without moving the entire div:
         */
         tip.css({
            right : Math.abs(tip.parent().outerWidth()-(tip.position().left+tip.outerWidth())),
            left : '0'
         });
         tip.find('.tipVisible').css({position:'absolute',right:3});
      }
   }
   /* Resize the slideout to fit the content, which is then faded into view: */
   tip.addClass('isOpened').animate({
      width : Math.max(slideOut.outerWidth(),tip.data('origWidth')),
      height : slideOut.outerHeight()+tip.data('origHeight')
      },function(){
         slideOut.fadeIn();
      });
    }).bind('slideIn',function(){ // Binding the slideIn event to .slideOutTip
      var tip = $(this);
      /* Hide the content and restore the original size of the slideout: */
      tip.find('.slideOutContent').fadeOut('fast',function(){
         tip.animate({
            width : tip.data('origWidth'),
            height : tip.data('origHeight')
         },function(){
            tip.removeClass('isOpened');
         });
      });
   });
});

