// **** addthis
var addthis_share = {templates: {twitter: "{{title}} - {{url}} (via @PrpkInfo)"}}

//Функции ядра
function reloadCaptcha(img_id){
	$("img#"+img_id).attr("src", "/includes/codegen/cms_codegen.php?"+Math.random());
}
function centerLink(href){
	$('div.component').css({opacity:0.4, filter:'alpha(opacity=40)'});
	$.post(href, {'of_ajax': 1}, function(data){
		$('div.component').html(data);
		$('div.component').css({opacity:1.0, filter:'alpha(opacity=100)'});
	});

}

//Согласиться при регистрации
function AuthorizeValidation(regform) {
	if(regform.iagree.checked == true) {regform.validation.disabled = false }
	if(regform.iagree.checked == false) {regform.validation.disabled = true }
}

//Вставка swf в страницу 
//http://code.google.com/p/swfobject/wiki/documentation 
/*
var flashvars = {};
var params = {wmode:"transparent"};
var attributes = {};
swfobject.embedSWF("/templates/prpk/pic/prpk.swf", "header_ad_in", "468", "60", "6.0.0", "expressInstall.swf", flashvars, params, attributes);
*/

// jQuery document.ready ON
// ************************
$(document).ready(function() {
	//Модальные окна / FancyBox
	$("a.foto, a.photo, a.modal").fancybox({
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.5,
				'padding'			: 2
	});
	$("a[rel=gal]").fancybox({
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'titlePosition' 	: 'over',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.8,
				'padding'			: 2,
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Фото ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
				}
			});
	$("#iframe").fancybox({
				'width'				: '75%',
				'height'			: '75%',
				'autoScale'			: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.8,
				'type'				: 'iframe'
			});
	$("#in_div").fancybox({
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.2,
				'padding'			: 2
			});

	//Основное меню
	$('#topmenu .menu li').hover(
		function() {
			$(this).find('ul:first').slideDown('fast').show();
			$(this).find('a:first').addClass("hover");
		},
		function() {
			$(this).find('ul:first').hide();
			$(this).find('a:first').removeClass("hover");
		}
	);

	//Закладки в коментариях
	$("#comments_tabs > ul#tabs").tabs();
	//вывод чекбокса для согласия
	$("#c4ek").prepend("<input type='checkbox' name='iagree' value='valeur' onClick='AuthorizeValidation(this.form)' /> Я не спамер");
	$("#c4ek_in").prepend("<input name='validation' type='submit' id='save' value='Регистрация' disabled />");
	
	$("#copyright .fl img").css({opacity: "0.4"}).mouseover(function() {$(this).css({opacity: "1"});}).mouseout(function() {$(this).css({opacity: "0.4"}); });
	


});
// *************************
// jQuery document.ready OFF
