var cal_scroll=0;
var all_blog_photo = 6;
var firsttimes=true;

function showMap(street,tel)
{
    if(window.firsttimes)
    {
        window.firsttimes=false;
        $('.mapslide').slideDown(200,function(){
             //nachalo
            var map = new YMaps.Map(YMaps.jQuery("#YMapsID-394")[0]);
        
        map.addControl(new YMaps.Zoom());
        map.addControl(new YMaps.ToolBar());
        YMaps.MapType.PMAP.getName = function () { return "Народная"; };
        map.addControl(new YMaps.TypeControl([
            YMaps.MapType.MAP,
            YMaps.MapType.SATELLITE,
            YMaps.MapType.HYBRID,
            YMaps.MapType.PMAP
        ], [0, 1, 2, 3]));

        YMaps.Styles.add("constructor#pmlbmPlacemark", {
            iconStyle : {
                href : "http://api-maps.yandex.ru/i/0.3/placemarks/pmlbm.png",
                size : new YMaps.Point(28,29),
                offset: new YMaps.Point(-8,-27)
            }
        }); 			
		var geocoder = new YMaps.Geocoder("Тюмень, "+street, {results: 1, boundedBy: map.getBounds()});
		YMaps.Events.observe(geocoder, geocoder.Events.Load, function () {					
				geoResult = this.get(0);
				geoResult.text="<h4>"+street+"</h4><br/> Телефон:"+tel;
				map.addOverlay(geoResult);
				map.setBounds(geoResult.getBounds());	                    
				geoResult.openBalloon();  
			
		});
        //konec
        });
    }
    else
    {
         $('.mapslide').slideUp(200,function(){
            window.firsttimes=true;
         });
    }  
}
function priority()
{
  //  alert('');
  $('.place_i.pay').wrapAll('<div class="place_pay"></div>');
$('.place_pay').append('<a href="#" class="show_place">скрыть</a>');
   $('a.show_place').toggle(function()
    {
        $(this).parent('div').children('div').hide('900');
        $(this).text('показать');
    },
    function()
    {
        $(this).parent('div').children('div').show('900');
         $(this).text('скрыть');
    });
}
$(document).ready(function(){
    
    $('.looking_more_places a').toggle(function(){
        $(this).html('Свернуть');
        $('.more6').stop(true,true).slideDown(1000);
    },function(){
        $(this).html('Посмотреть всё');
        $('.more6').stop(true,true).slideUp(1000);
    });
    
    $('.new_film').click(function(){
       var id =  $('.afishas').attr('rel');
       id++;
       var content = $('#Articles_id_afisha_1').clone();
       $(content).attr('id','Articles_id_afisha_'+id);
       $(content).attr('name','Articles[id_afisha]['+id+']');
        $('.afishas').append(content);
        
        
        $('.afishas').attr('rel',id);
    });
    
    $('a.copi_shab').click(function(){
        
        $(this).parent('td').find('input:first-child').val($('#shab_s').val()).next().val($('#shab_f').val());
        return false;
    });





$('.filters').append('<a href="#" class="show">скрыть</a>');
priority();

     $('a.show').toggle(function()
    {
        $(this).parent('div').children('div').hide('900');
        $(this).text('показать');
    },
    function()
    {
        $(this).parent('div').children('div').show('900');
         $(this).text('скрыть');
    });
   
    
    $('.firstcom').mousemove(function(e){
        $('.tooltip').stop(true,true).show(500);
    $('.tooltip').animate({left:e.pageX+10},1);
     $('.tooltip').animate({top:e.pageY},1);
     
   });
    
        $('.firstcom').mouseout(function(){
        $('.tooltip').stop(true,true).fadeOut(300);
  
   });
    
    $('.firstcom').click(function(){
        
        if($('#Comment_verifyCode').is('input'))
        {
            window.location = "http://otdih72.ru/index.php?r=user/login"
        }
        else
        {
            var nickname = $(this).parent().find('.first a').text();
            var id = $(this).parent().find('.first').attr('rel');
            $('.answer_for').html('Ответ для пользователя '+nickname+' [<a style="color:#f00;" class="cancel_vk" href="javascript:void(0);">X</a>]');
            $('.answer_for').slideDown(300);
            
            $('#Comment_pid').val(id);
            
            $('.cancel_vk').click(function(){
                 $('#Comment_pid').val(0);
                $('.answer_for').slideUp(300);
            });
        } 
        
    });
    
    

    $('.mapslide').hide();
    
 var input_count =2;
    $('#add_image').click(function(){
        
        
        $('div.images').append('<input type="file" id="Place_images_'+input_count+'" name="Place[images]['+input_count+']">');   
        
        input_count++;
        return false; 
    });
    
     $('#add_image_events').click(function(){
        
        
        $('div.images').append('<input type="file" id="Events_images_'+input_count+'" name="Events[images]['+input_count+']">');   
        
        input_count++;
        return false; 
    });

    
    
    $('.premier').toggle(function(){
        
            $(this).text('Развернуть премьеры');
       
        $('.slider_movie').stop(true,true).animate({opacity:0},700,function(){
            $(this).slideUp(400);
            
        })
    },function(){
        
            $(this).text('Свернуть премьеры');
       
        $('.slider_movie').stop(true,true).slideDown(400,function(){
            $(this).animate({opacity:1},700);
            
        })
    })
    
    
    
    
fix_flash();
$('.com').click(function(){
    var top = $('.caption_vk').offset().top;
    $("html:not(:animated)"+( ! $.browser.opera ? ",body:not(:animated)" : "")).animate({scrollTop: top-45},300);
});


$('.caption_vk .right').click(function(){
      var top = $('.send_vk').offset().top;
        var monik = $(window).height();
 
    $("html:not(:animated)"+( ! $.browser.opera ? ",body:not(:animated)" : "")).animate({scrollTop: top-monik+36},300);
});

    
$('.portlet-decoration').toggle(function(){
    $(this).next().stop(true,true).hide(400,function(){
        $('.portlet').animate({opacity:0.2},400);
    });
    $(this).css('background-position','bottom right');
},function(){
    $('.portlet').animate({opacity:1},400,function(){
         $('.portlet-decoration').next().stop(true,true).show(400);
    });
   
    $(this).css('background-position','top right');
});
   
    
    /*Фильтры скрытие неосновных*/
$('h5.nomain').next('ul').hide(); 

    $('h5.more_parent').toggle(function()
    {
        $('h5.nomain').show('900').next('ul').show('500');
        $(this).text('Скрыть неосновные');
    },
    function()
    {
        $('h5.nomain').hide('900').next('ul').hide('500');
         $(this).text('Показать все');
    }
); 
    
      $('li.more').toggle(function()
    {
        $(this).parent('ul').children('li').children('a.nomain').show('900');
        $(this).text('скрыть');
    },
    function()
    {
        $(this).parent('ul').children('li').children('a.nomain').hide('900');
         $(this).text('...');
    }
);     
    
    
var positionY;
var date_calendar = [];
var count_cal = 0;









$('.prev_week').click(function(){
   $('.absol_calendarka').animate({left:'+=156'},300); 
});
$('.next_week').click(function(){
   $('.absol_calendarka').animate({left:'-=156'},300); 
});

$('.absol_calendarka').css('left','-13811px');

if(!$.browser.msie && $.browser.version<=7)
{

    $('.new').hover(function(){
    $(this).stop(true,true).animate({opacity:1},500);
},function(){
      $(this).stop(true,true).animate({opacity:0.3},500);
});
}

$('.top_places table tr:last-child').css('border-bottom','none');
$('.blog_gallery:last-child').css('border-bottom','none');



// СЛАЙДЕР НАЧАЛО
function getscroll(param,count_begin,step)
{
    var obje = $(param);
    var cnt_movie = $(obje).children().size();
    var size = $(obje).children().width();
    size+=parseInt($(obje).children().css('margin-right'));
    size+=parseInt($(obje).children().css('margin-left'));
    size+=parseInt($(obje).children().css('padding-right'));
    size+=parseInt($(obje).children().css('padding-left'));
    $(obje).wrapInner('<div class="movie_content"></div>');
    $('.movie_content').css('position','absolute');
    cnt_movie *= size;
    var mainel = size*count_begin;
    $(obje).css('overflow','hidden');
    $(obje).css('width',mainel);
    
    obje = $('.movie_content');
    $(obje).css('width',cnt_movie);
    $(obje).css('left','0');


size*=step;

$('.right_scroll').click(function(){

if ($(obje).is(':animated')==false){
   
   
   
   
   if(-parseInt($(obje).css('left'))<cnt_movie-585)
   {
    $(obje).animate({left:'-='+size},500);
   }
}
    
}); 

$('.left_scroll').click(function(){
    
 
if ($(obje).is(':animated')==false){
    
    $(obje).stop(false,true);
    
           if(parseInt($(obje).css('left'))<0)
   {
    $(obje).animate({left:'+='+size},500);
   }
    
}

    
}); 

}

getscroll('.over_slider',3,1);

// СЛАЙДЕР КОНЕЦ




//$('.galka').css('left',$('ul#navigation li.current').width()/2+5);


if($.browser.msie && $.browser.version==6)
{
    $(window).scroll(function(){
   $('#top_bar').animate({top:document.documentElement.scrollTop},0);
});
}

      



$('#login a.left').toggle(function(){
    
    $('*').stop(true,true);
        var is_chrome = false, chrome_version = false;
    if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
        $(window).scrollTop(0);

    }

  
     if(250<=(document.documentElement.scrollTop-13))
     {
        
        //alert('y');
        $("html:not(:animated)"+( ! $.browser.opera ? ",body:not(:animated)" : "")).animate({scrollTop: $(this).position().top-15},500,function()
{
    $('#login a.left').fadeOut(300,function(){
          $('#login a.left').text('Поиск');
      });
    $('#search').fadeOut(300);
    $('#header .banner').fadeOut(300,function(){
         $('#login a.left').fadeIn(400);
          $('#login_form').fadeIn(400);
    });   
});

     }
     else
     {  $('#login a.left').fadeOut(300,function(){
          $('#login a.left').text('Поиск');
      });
           $('#search').fadeOut(300);
    $('#header .banner').fadeOut(300,function(){
        $('#login a.left').fadeIn(400);
          $('#login_form').fadeIn(400);
    });  
     }



   
},function(){
  
 $('*').stop(true,true);
         

        
        
         if(250<=(document.documentElement.scrollTop-13))
     {
        //alert('y');
        $("html:not(:animated)"+( ! $.browser.opera ? ",body:not(:animated)" : "")).animate({scrollTop: $(this).position().top-15},500,function()
{
    
    $('#login a.left').fadeOut(300,function(){
                $('#login a.left').text('Вход');
         });
    
    
   $('#login_form').fadeOut(300,function(){
    $('#login a.left').fadeIn(400);
    $('#search').fadeIn(400);
    $('#header .banner').fadeIn(400);
         $('#login_form').fadeOut(300);
   });
   
});

     }
     else
     {
        $('#login a.left').fadeOut(300,function(){
                $('#login a.left').text('Вход');
         });
       $('#login_form').fadeOut(300,function(){
        $('#login a.left').fadeIn(400);
    $('#search').fadeIn(400);
    $('#header .banner').fadeIn(400);
    
   });
     }
  

    
    
});



loadTabler();




if($.browser.msie && $.browser.version<6)
{
  //  alert('f');
    $('body').css('text-align','center');
}
    
    var cnt_news=0;
    $('.news_place_add').click(function(){
        cnt_news++;
        var id_place = $('#place_id').val();
        var place_value =  $('#id_place').val();
        
        if(place_value!='')
        {
            $('.ajax .placelist').append("<p><input name='news_place["+cnt_news+"][id]' type='hidden' value='"+id_place+"'><input type='text' readonly='readonly' value='"+place_value+"'><a class='delete_row' href='javascript:void(0);'><img src='images/icons/delete.png'></a></p>");
            $('#id_place option:first-child').attr('selected',true);
            $('#id_place').next().val($('#id_place option:first-child').text());
            loadDeleterow2();
        }        
    });
    
$('a.up').click(function ()
{
       var obj =$(this).parent('div').find("span.like");
       var obj_hide =$(this).parent('div').find("a.down");
       $(this).hide(300);
       obj_hide.hide(300);
       var rate = parseInt(obj.text()); 
       if(isNaN(rate)) {rate = 0;}
       rate++;
       obj.html(rate);
    
});  
$('a.down').click(function ()
{
       var obj =$(this).parent('div').find("span.like");
       var obj_hide =$(this).parent('div').find("a.up");
       $(this).hide(300);
       obj_hide.hide(300);
       var rate = parseInt(obj.text()); 
       if(isNaN(rate)) {rate = 0;}
       rate--;
       obj.html(rate);
    
});  
    
$('a.likeButton').click(function ()
{
    if($(this).attr('class')=='likeButton heart')
    {
        if($(this).attr('rel')!='voted')
        {
        $(this).next().animate({opacity:0},300,function(){
                 var val = $(this).text();
        val = val.slice(1,-1);        
        val = parseInt(val);
        
        val =val+1;
        
        $(this).html('('+val+')');
        $(this).prev().attr('rel','voted');
        $(this).animate({opacity:1},300);
        
        });
    }
    }
    if($(this).attr('class')=='likeButton')
    {
      
        $(this).hide(300);
       var obj =$(this).parent('.likeX');
       var spanval = $(obj).find('span.like').fadeOut(300,function(){
        
         var rate = parseInt(spanval.text()); 
       
       if(isNaN(rate)) {rate = 0;}
       rate++;
       $(obj).find('span.like').html(rate);
       $(obj).find('span.like').fadeIn(300);
        
       });
      
    }
    
});
    
    function loadDeleterow(){
          $('.delete_row').click(function(){
       $(this).parents('tr').fadeOut(300,function(){
        $(this).parents('tr').remove();
       });       
    });
    };
      function loadDeleterow2(){
          $('.delete_row').click(function(){
       $(this).parents('p').fadeOut(300,function(){
        $(this).parents('p').remove();
       });       
    });
    };
    
    var cnt = 0;
    $('#add_cinema').click(function(){
        
        var input1='', input2='', input3='', input4='', input5='', input6='', input7='';
        cnt++;
        
        if($('#pn').attr('checked'))
        {
           input1 = '<input type="hidden" value="Monday" name="add_schedule['+cnt+'][days][1]">';
        }
         if($('#vt').attr('checked'))
        {
           input2 = '<input type="hidden" value="Tuesday" name="add_schedule['+cnt+'][days][2]">';
        }
         if($('#sr').attr('checked'))
        {
           input3 = '<input type="hidden" value="sreda" name="add_schedule['+cnt+'][days][3]">';
        }
         if($('#ch').attr('checked'))
        {
           input4 = '<input type="hidden" value="chetverg" name="add_schedule['+cnt+'][days][4]">';
        }
         if($('#pt').attr('checked'))
        {
           input5 = '<input type="hidden" value="pyat" name="add_schedule['+cnt+'][days][5]">';
        }
         if($('#sy').attr('checked'))
        {
           input6 = '<input type="hidden" value="syb" name="add_schedule['+cnt+'][days][6]">';
        }
         if($('#vs').attr('checked'))
        {
           input7 = '<input type="hidden" value="vosk" name="add_schedule['+cnt+'][days][7]">';
        }
        
        
        
      var cinema = $('#place_name');
      var datestart = $('#datestart');
       var times = $('#times_seans');
       var datestop = $('#datestop');
       var price = $('#price');
       var errors = false;
       
      $(times).prev().css('color','#000');
                $(datestart).prev().css('color','#000');
            $(datestop).prev().css('color','#000');
            $(price).prev().css('color','#000');
            
           
            if ($('#anons:checked').val() === undefined) 
            {
            
        if($(times).val().length<5)
        {
            $(times).prev().css('color','#f00');
            errors=true;
        }
        
       //  if($(price).val().length<2)
//        {
//            $(price).prev().css('color','#f00');
//            errors=true;
//        }
        
        }
        
       
        if($(datestart).val().length<=8)
       {
            $(datestart).prev().css('color','#f00');
            errors=true;
       }
       if($(datestop).val().length<=8)
       {
            $(datestop).prev().css('color','#f00');
            errors=true;
       }
       
       if(errors==false)
       {
        
            $('table.list_afisha tbody').append("<tr><td>"+input1+input2+input3+input4+input5+input6+input7+"<input readonly='readonly' name='add_schedule["+cnt+"][id]' type='hidden' value='"+$(cinema).val()+"'>"+$('#place_name option:selected').text()+"</td><td><input name='add_schedule["+cnt+"][datestop]' readonly='readonly' type='hidden' value='"+$(datestop).val()+"'><input name='add_schedule["+cnt+"][datestart]' readonly='readonly' type='text' value='"+$(datestart).val()+"'></td><td><textarea name='add_schedule["+cnt+"][time]' readonly='readonly' cols='30' rows='6'>"+$(times).val()+"</textarea></td><td><input name='add_schedule["+cnt+"][price]' readonly='readonly' type='text' value='"+$(price).val()+"'></td><td><a class='delete_row' href='javascript:void(0);'><img src='images/icons/delete.png'></a></td></tr>");
          // $('table.list_afisha tbody').append();
            loadDeleterow();
       }
       
       return false; 
    });
    
      
   
  $('div.slide').toggle(function(){
	
		$(this).toggleClass('active');
		$(this).next().show(200);
	
  },function(){
		$(this).toggleClass('active');
		$(this).next().hide(200);
  });
   $('#PlaceFilter_pid').change(function(){

	if($(this).val()==0)   $('#PlaceFilter_placecat_id').parents('.row').fadeIn(200);
	else   
    {
          $('#PlaceFilter_placecat_id').parents('.row').fadeOut(200).val('0');
            $('#PlaceFilter_placecat_id').val('0');
          
    }
  
	
  })
   
   if($('#date_new_1').is('input'))
   {
     $('#date_new_1').datepicker({firstDay: 1});
       }
   
  
   
 
   function loadChecker()
 {
     $('input[id^=date_new_]').click(function(){
              window.checker = $(this).attr('id').substring(9); 
      

    });
 }
    
     if($('.date_change').is('input'))
  {$('.date_change').datepicker();}

    var cnt_add_place = 0;
    $('#eventAddPlace').click(function(){
cnt_add_place++;
       var obj = $(this).parent('.row').prev(); 
      var id = $(obj).find('#place_id').val();
            var date = $(obj).find('#date_place').val();
                  var time = $(obj).find('#time_place').val();
      var place_name = $('#place_name').val();
           
       //    alert(date);
            if(date!="")
      {       
        if(id==''){ id='0';place_name='Без указания места';}
       
       if(id!=''){
        
      $('.ajax_place_event table tbody').append('<tr><td>'+id+'</td><td>'+place_name+'</td><td><input readonly="readonly" type="text" value="'+date+'" name="add_place['+cnt_add_place+']['+id+'][date]"></td><td><input readonly="readonly" type="text" value="'+time+'" name="add_place['+cnt_add_place+']['+id+'][time]"></td><td><a class="delete_row" href="javascript:void(0);"><img src="images/icons/delete.png"></a></td></tr>');
    
      loadDeleterow();
    }
   
      }
     
                          return false;
    });
    
    
   $('#eventAddDate').click(eb);
   
   
   
   
   


 function eb(){
    var obj = $('#eventAddDate').parent('.row').prev().find('.dateleft').find('input:last-child');    

    var id = obj.attr('id').substring(9);  

    id = parseInt(id);
    
        id = id+1;
     
        $('#eventAddDate').parent('.row').prev().find('.dateleft').append('<input id="date_new_'+id+'" type="text" name="date_new['+id+']" value="">');
        loadChecker();
        $( '#date_new_'+id ).datepicker({firstDay: 1,onSelect: function(){eb();} });
        return false;
    
}   




//$('.calendar_blog[rel="2011-08-22"]').addClass('cur_date');


   
});

  
   
     //  function like_f(respond, obj)
//    {
//            alert(respond);
//              alert(obj.attr("class"));
//      
//        
//        
//    }
 var Month_days = [0,31,28,31,30,31,30,31,31,30,31,30,31];
   var WDays = ['Вс','Пн','Вт','Ср','Чт','Пт','Сб']
   var current_date = new Date();
   var current_year = current_date.getFullYear();
   var current_month = current_date.getMonth()+1;
   var current_day = current_date.getDate(); 
   
   
   function GenCal(type)
   {
       var el = $('.scroll_days');

       if (el)
       {
          el2 = (type=='prev') ? PrevWeek() : ((type=='next') ? NextWeek() : CurrentWeek());
         // alert(el2);
          $(el).html(el2);
       }
   }
   
   
function GetNextDay(curr_date, days_increment)
   {
   //alert(current_day);
     var days = Month_days[current_month];
     var d = null;

     if ((curr_date+days_increment)>days)
     {
       current_month++;
       if (current_month>12) { current_month=1; current_year++;};
       curr_date = 0;
     }
  
 
  if ((curr_date+days_increment)<1)
     { 
       current_month--;
       if (current_month<1) {  current_month=12; current_year--;};
    days = Month_days[current_month];
       curr_date = days-days_increment;
    //alert(days);
     }
 window.current_day = curr_date+days_increment;

 
 //alert(curr_date+days_increment);
 
      d = (parseInt(curr_date+days_increment));

     var d1 = new Date(current_year,current_month-1,d);

     if (d.toString().length==1) d ='0'+d.toString();
     
     if ((d1.getDay()==0) | (d1.getDay()==6))
       {                                    

          d ='<div rel="'+current_year+'-'+((current_month.toString().length==1) ? '0'+current_month : current_month)+'-'+d.toString()+'" class="calendar_blog vih"><input type=hidden class=years value='+current_year+'><div class="chislo">'+d.toString()+'</div><div class="today"><p>'+((current_month.toString().length==1) ? '0'+current_month : current_month)+'</p><p>'+WDays[d1.getDay()]+'</p></div><div class="clear"></div></div>';
       } else     
       {
         d ='<div rel="'+current_year+'-'+((current_month.toString().length==1) ? '0'+current_month : current_month)+'-'+d.toString()+'" class="calendar_blog"><input type=hidden class=years value='+current_year+'><div class="chislo">'+d.toString()+'</div><div class="today"><p>'+((current_month.toString().length==1) ? '0'+current_month : current_month)+'</p><p>'+WDays[d1.getDay()]+'</p></div><div class="clear"></div></div>';
       }
     return d;
   }
   
 prev=false;
 next=true;

 function PrevWeek()
 {
  var content='';
  window.prew = true;
  if(window.next == true)
  {
   window.next = false;
   for (i=0;i<12;i++)
   { 
    GetNextDay(current_day,-1);
   }
  }
  for (i=0;i<13;i++)
  {
   content='<a href=#>'+GetNextDay(current_day,-1)+'</a>'+content;
  } 
  return content;
 }

 function NextWeek()
 {
  window.next = true;
  if(window.prew == true)
  {
   window.prew = false;
   for (i=0;i<12;i++)
   { 
    GetNextDay(current_day,+1);
   }
  }
  content='';
  for (i=0;i<13;i++)
  { 
   content+='<a href=#>'+GetNextDay(current_day,+1)+'</a>';
  }
 
  return content;
 }

   function CurrentWeek()
   { 
  
  var content='';
  
  content+='<a href=#>'+GetNextDay(current_day,0)+'</a>';
  for (i=0;i<12;i++)
  { 
   content+='<a href=#>'+GetNextDay(current_day,+1)+'</a>';
  }
  
  return content;
   }
   
           function print_r(arr, level) {
    var print_red_text = "";
    if(!level) level = 0;
    var level_padding = "";
    for(var j=0; j<level+1; j++) level_padding += "    ";
    if(typeof(arr) == 'object') {
        for(var item in arr) {
            var value = arr[item];
            if(typeof(value) == 'object') {
                print_red_text += level_padding + "'" + item + "' :\n";
                print_red_text += print_r(value,level+1);
		} 
            else 
                print_red_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
        }
    } 

    else  print_red_text = "===>"+arr+"<===("+typeof(arr)+")";
    return print_red_text;
}

function fix_flash() {
    // loop through every embed tag on the site
    var embeds = document.getElementsByTagName('embed');
    for (i = 0; i < embeds.length; i++) {
        embed = embeds[i];
        var new_embed;
        // everything but Firefox & Konqueror
        if (embed.outerHTML) {
            var html = embed.outerHTML;
            // replace an existing wmode parameter
            if (html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i))
                new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i, "wmode='transparent'");
            // add a new wmode parameter
            else
                new_embed = html.replace(/<embed\s/i, "<embed wmode='transparent' ");
            // replace the old embed object with the fixed version
            embed.insertAdjacentHTML('beforeBegin', new_embed);
            embed.parentNode.removeChild(embed);
        } else {
            // cloneNode is buggy in some versions of Safari & Opera, but works fine in FF
            new_embed = embed.cloneNode(true);
            if (!new_embed.getAttribute('wmode') || new_embed.getAttribute('wmode').toLowerCase() == 'window')
                new_embed.setAttribute('wmode', 'transparent');
            embed.parentNode.replaceChild(new_embed, embed);
        }
    }
    // loop through every object tag on the site
    var objects = document.getElementsByTagName('object');
    for (i = 0; i < objects.length; i++) {
        object = objects[i];
        var new_object;
        // object is an IE specific tag so we can use outerHTML here
        if (object.outerHTML) {
            var html = object.outerHTML;
            // replace an existing wmode parameter
            if (html.match(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")[a-zA-Z]+('|")\s*\/?\>/i))
                new_object = html.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i, "<param name='wmode' value='transparent' />");
            // add a new wmode parameter
            else
                new_object = html.replace(/<\/object\>/i, "<param name='wmode' value='transparent' />\n</object>");
            // loop through each of the param tags
            var children = object.childNodes;
            for (j = 0; j < children.length; j++) {
                try {
                    if (children[j] != null) {
                        var theName = children[j].getAttribute('name');
                        if (theName != null && theName.match(/flashvars/i)) {
                            new_object = new_object.replace(/<param\s+name\s*=\s*('|")flashvars('|")\s+value\s*=\s*('|")[^'"]*('|")\s*\/?\>/i, "<param name='flashvars' value='" + children[j].getAttribute('value') + "' />");
                        }
                    }
                }
                catch (err) {
                }
            }
            // replace the old embed object with the fixed versiony
            object.insertAdjacentHTML('beforeBegin', new_object);
            object.parentNode.removeChild(object);
        }
    }
}

function loadTabler()
{
    $('.tabs a').click(function(){
   if($(this).parent().is('.current')) 
   {
    
   }
   else
   {
       var tab = $(this).parent().attr('rel');
       $(this).parent().addClass('current');
       $(this).removeClass('nocurrent');
       
       if(tab=='tab1')
       {
        $(this).parent().next().removeClass('current');
        $(this).parent().next().find('a').addClass('nocurrent');
       }
       else
       {
        $(this).parent().prev().removeClass('current');
        $(this).parent().next().find('a').addClass('nocurrent');
       }
        $(this).parents('.blog_right_part').find('.tab1').fadeOut(300,function(){
           $(this).parents('.blog_right_part').find('.tab2').fadeOut(300,function(){
            
           
            
            
            $(this).parents('.blog_right_part').find('.'+tab).fadeIn(300);
           });
        });
        
        
   }
  
});
}
