$.dpText = {
		TEXT_PREV_YEAR		:	'Предыдущий год',
		TEXT_PREV_MONTH		:	'Предыдущий месяц',
		TEXT_NEXT_YEAR		:	'Следующий год',
		TEXT_NEXT_MONTH		:	'Следующий месяц',
		TEXT_CLOSE			:	'Закрыть',
		TEXT_CHOOSE_DATE	:	'Выбрать',
		BUTTON				:	'/view/images/cal.gif'
	};   

$.sifr({ path: '/view/swf/' , font: 'font', color: 'a71c21', save: true });

function bindForm()
{
	$('.date-pick').datePicker();
	if ($.browser.msie)
	{
		$('img[@src$=.png], .f').ifixpng(); 	
	} 
	
    $('.cancel').click(function(){$(document).trigger('close.facebox')});
    $('#facebox form').ajaxForm({target:'#facebox .content', beforeSubmit: function() { $(".ldr").html("<img src='/view/images/loading.gif'/>"); }, success: function() { bindForm(); }  });
 	$('#facebox').css('left', $(window).width() / 2 - ($('#facebox').width() / 2));
 	$('#facebox h1').sifr(); 	
}
 	

$().ready(function(){

	var preload = [ new Image(), new Image() ]
	preload[0].src="/view/images/t70.png";
	preload[1].src="/view/images/t90.png";

	$('.full').css('height',$().height()-$("#head_img").height()-60-($.browser.msie?5:0));
	$('h1').sifr();
    jQuery('a[rel*=popup]').facebox();
    $(document).bind('reveal.facebox', function(){ bindForm()} );
   
	
	/* ie hover fix */		
	if ($.browser.msie)
	{			
		$('#menu li,#menu a').hover(
			function(){ $(this).addClass('hover'); },
			function(){ $(this).removeClass('hover'); }
		)
		$('img[@src$=.png], .f').ifixpng(); 		
	}	
});	

$(window).resize(function(){
	$('.full').css('height',$().height()-$("#head_img").height()-60-($.browser.msie?5:0));
	$('#facebox').css({left: $(window).width() / 2 - ($('#facebox table').width() / 2)});
});			

/* gallery showing */
function show(url,title,n,cnt)
{
	if ($("#gallery_show .pv img").attr('src')!=url && !$("#gallery_show .pager #p"+n).hasClass('active') )
	{
		$('#gallery_show .title').html('<img src="/view/images/loading2.gif" />');	
   	 	var img=new Image();  		
  		img.onload=function (){  		   		
  			$("#gallery_show .pv img").fadeOut('fast',function()
   	 		{	   	 		
   	 			$('#gallery_show .title').html(title);   	 			
   	 			$("#gallery_show .pv img").attr('src',img.src).css('cursor','default');
   	 			$("#gallery_show .pv img").unbind('click').fadeIn('fast',function(){   	 				
	   	 			if (n<cnt-1) $("#gallery_show .pv img").bind("click", function(e){	   	 				
						$("#gallery_show #p"+(n+1)).click();						
					}).css('cursor','pointer');
   	 			});   	 
   	 			$("#gallery_show .pager a").removeClass('active');
   	 			$("#gallery_show .pager #p"+n).addClass('active');
   	 		});  		
  		};
  		img.src=url;
	}

}