  $(function() {
    $f('a.flowplayer',{src: "/js/player/flowplayer.commercial-3.2.7.swf", wmode:"transparent"},{
	// commercial version requires product key
        key: '$57b2f2c970bdbaa96c0',
        logo: {
		url: '/images/flowplayer/logoWhite_110x49.png',
		top: 20,
                left: 20,
                opacity: 0.4,
        	width: '100px',
                height: '49px',
                fullscreenOnly: false,
        	displayTime: 0
	},
        play: {
             replayLabel: 'Посмотреть еще раз'
        },
        canvas: {
		background: 'url(/images/flowplayer/playerBg.jpg) repeat-x'
	},
	plugins: {
            controls: {
                    url: '/js/player/flowplayer.controls-3.2.5.swf',
                    height: '36px',
                    backgroundColor: 'transparent',
    		    backgroundGradient: 'none',
                    buttonColor: '#ffffff',
                    bufferColor: '#fea100',
		    sliderColor: '#f5f2ba',
                    sliderBorder: '1px solid rgba(255,241,244,0.7)',
		    volumeSliderColor: '#abece6',
                    volumeColor: '#00a2f9',
		    volumeBorder: '1px solid rgba(255,241,244,0.7)',
		    durationColor: '#535353',
  		    tooltipColor: 'rgba(255, 255, 255, 0.7)',
		    tooltipTextColor: '#000000',
                    time: false,
                    progressColor: '#e03c00',
                    scrubberHeightRatio: '0.6',
                    scrubberSliderHeightRatio: '0.7',
                    scrubberBarHeightRatio: '0.6',
                    volumeHeightRatio: '0.6',
                    volumeSliderHeightRatio: '0.6',
                    volumeBarHeightRatio: '0.6'
            }
        }
    });
  });

  $(document).ready(function () {

    //Преобразование ссылок в галерею
    $('a.lightbox').lightBox();

//увеличение плеера на всю ширину страницы
    $('.playerWrapTriger').toggle(function (){
            $(this).text('Обычный размер');
            $(this).next().removeClass('bigPlayer');
            $(this).next().addClass('hugePlayer');

        }, function(){
            $(this).text('Большой размер');
            $(this).next().removeClass('hugePlayer');
            $(this).next().addClass('bigPlayer');
       });

   /*$('.sortingVideo A').click(function(){
    $("#playListContainer").html('<img src="/images/ajax-loader.gif" class="playlistAjaxLoader">');
    $.getJSON($(this).attr('href')+"?jsoncallback=?",
    //$("#playListContainer").load($(this).attr('href')+"?jsoncallback=?",
    {
        params: {
            sort: {'columnSort':$(this).attr('name')},
            rubrics: {},
            range: {}
        }
    },
    function(json) {
      $("#playListContainer").html(json.videocontent);
      $('.sortingVideo A').removeAttr('class');
      $('.sortingVideo A[name="'+json.sort.columnSort+'"]').addClass('sortActive '+' '+json.sort.typeSort);
  });
    return false;
   });*/
$('#playListContainer A').live('click',function(){
    $('#clipInfoWrap').load($('#clipBasePath').val(), {clip:$(this).attr('name')});
});
$("#clipFullPath").live('focus',function (){$(this).select();});



var anc = window.location.hash.replace("#","");
if((window.location.href.indexOf('receiver')>0)||(anc == "addform"))
{
    var form = $('.uresponseForm');
    form.css('display','block').parent('Li').addClass('openedListPlateItme');

    $('html, body').animate({scrollTop:(form.offset().top-250)}, 500);
}

if(anc =='semeinie' || anc =='duhovno_prosvetitelskie' || anc =='detskie' || anc =='obrazovatelnie'){
    $('A[name="'+anc+'"]').next().css('color','#fd6416').next().addClass('prjListSelected');
}

$('.addAnswerLink').click(function(){
       $(this).after($("#uresponseAnswerFormBlock"));
       $("#uresponseAnswerFormBlock").show();
       $("#uresponse_uresponse_id").val($(this).attr('name'));
        return false;
      });



$('#uresponseAnswerFormBlock .cancelUresponseLink').click(function(){
    $("#uresponseAnswerFormBlock").hide();
    $("#uresponse_uresponse_id").removeAttr('value');
    //$('#uresponseAnswerFormBlock').insertAfter($('h1'));
    return false;
});
$('.uresponseForm .cancelUresponseLink').click(function(){
    $(this).closest('.contentPlate').slideUp('fast', function(){
        $(this).closest('.openedListPlateItme').removeClass('openedListPlateItme');
    });
    return false;
});

$('.cancelFormLink').click(function(){
    $(this).closest('.contentPlate').hide();
    return false;
});



//planet
$('.cloudLinks').mouseover(function(){
    $(this).children('SPAN:first-child').fadeIn('fast');
});
$('.cloudLinks').mouseleave(function(){
    $(this).children('SPAN:first-child').fadeOut('fast');
});


$('.mainMenu Li').mouseenter(function(){
	if($.browser.msie){
		$(this).children('.innerMenu').show();
	}
	else{
		$(this).children('.innerMenu').fadeIn('fast');
	}
});
$('.mainMenu Li').mouseleave(function(){
	if($.browser.msie){
		$(this).children('.innerMenu').hide();
	}
	else{
		$(this).children('.innerMenu').fadeOut('fast');
	}
});

$.fn.setICJSsize = function(){
    var offset = $(this).offset();
    var dif = $(window).width()-Math.floor(offset.left);
    $(this).width(dif<'400'?dif:400);
}

$('.ICJS').mouseover(function(){
    if($.browser.msie) $(this).children().show().setICJSsize();
    else $(this).children().fadeIn('fast').setICJSsize();
    return false;
});
$('.ICJS').mouseleave(function(){
    if($.browser.msie) $(this).children().hide();
    else $(this).children().fadeOut('fast');
    return false;
});
$('.heroName').click(function(){
    if($.browser.msie) $(this).closest("TABLE").find('.ICJS:first').children().show();
    else $(this).closest("TABLE").find('.ICJS:first').children().fadeIn('fast');
    return false;
});

$('.uresponseSingleLink').mouseenter(function() {
    $(this).prev().show();
});
$('.uresponseSingleLinkFull').mouseleave(function() {
    $(this).hide();
});

$('.staticListPlate .blueHeader').click(function(){
	if($(this).next().css('display')!='block'){
		$('.staticListPlate .contentPlate:visible').slideUp('fast').parent().removeClass('openedListPlateItme');
		$(this).next().slideDown('fast');
		$(this).parent().addClass('openedListPlateItme');
	}
        else{
            $(this).next().slideUp('fast',function(){
                $(this).parent().removeClass('openedListPlateItme');
            });
        }
        return false;
});

$('.anonsButton').click(function(){
    return false;
});

  $("form").submit(function(){
        if ($(this).find("#uresponse_body:first").val() == "") {
            alert('Нельзя отправлять пустое сообщение!');
            return false;
        }
   });

/*   var transPlayer = '<object width="400" height="353"><param name="movie" value="http://video.rutube.ru/online/2801255.flv" /><param name="wmode" value="transparent" /><param value="true" name="allowFullScreen" /><embed src="http://video.rutube.ru/online/2801255.flv" type="application/x-shockwave-flash" wmode="transparent" allowFullScreen="true" width="400" height="353" /></object>'; */

 var transPlayer = '<iframe width="400" height="353" src="http://cdn.livestream.com/embed/radostmoya?layout=4&color=0xe7e7e7&autoPlay=true&mute=false&iconColorOver=0x888888&iconColor=0x777777&allowchat=true&height=385&width=640" style="border:0;outline:0" frameborder="0" scrolling="no"></iframe>';
/* var transPlayer = '<object id="c40128" name="c40128" height="353" width="400" type="application/x-shockwave-flash" data="http://yatv.ru/files/swf/container.swf?layout=1full&apps=translations&cid=40128&autoplay=1"><param name="allowScriptAccess" value="always"></param><param name="allowFullScreen" value="true"></param><param name="movie" value="http://yatv.ru/files/swf/container.swf?layout=1full&apps=translations&cid=40128&autoplay=1"></param></object>'; */

/*	var transPlayer = '<img src="/uploads/images/no-online.gif">'; */

   $('.translationButton').click(function(){
        var winSize = getPageSize();
        $('#translationPlayer').html(transPlayer);
        $('#translationLayer').css('width',winSize[0]+'px').css('height',winSize[1]+'px').show('fast');
        return false;
   });
   $('#transClose').click(function(){
       $('#translationPlayer').html('');
       $('#translationLayer').fadeOut('fast');
       return false;
   });

   if($('#splahImage').css('display')=='block'){
       $('#splahImage').delay(4000).slideUp();
   }

   var rightMinus = $('#infoMessage').css('right');
   $('#infoMessage').mouseenter(function(){
       if(!$(this).is(':animated')) $(this).animate({right: 0},'fast');
   }).mouseleave(function(){
       if(!$(this).is(':animated')) $(this).animate({right: rightMinus},'fast');
   });



    function getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
    var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
    windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
    if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
    if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
    arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;}



});


