﻿$(function(){

})

function hideShowFG(obj){
	$('.fg_lvl2_block').each(function(i) {
		if($(obj).parents('.fg_lvl1_block').find('.fg_lvl2_block')[0] == this){
			$(this).show("slow");
		}else{
			$(this).hide("slow");
		}
  });
}

function hideShowInt(obj){
	$('.int_lvl2_block').each(function(i) {
		if($(obj).parents('.int_lvl1_block').find('.int_lvl2_block')[0] == this){
			$(this).show("slow");
		}else{
			$(this).hide("slow");
		}
  });
}
function showPanaram(obj, idName){
	swfobject.embedSWF($(obj).attr("swf"), idName, "100%", "271", "9.0.0");
}

function validateFormSubmit(formSubmit){
	var sError = '';
	$("input", "form.send_mail").each(function(){
		if($(this).attr('req') && $(this).val()==''){sError='Не все обязательные поля заполнены'};
	});

	if(sError != ''){
		alert(sError);
		return false;
	};
	return true;
}
function captcha(){
		$('img.captcha')[0].src='/ctrl.html?ctrl=captcha&rnd='+Math.round(10000*Math.random());
		$('#postform_captcha').val('');
	}
	
function checkReview(frm){
	if ($('#name', frm).val()=='' || $('#text', frm).val()=='' || $('#postform_captcha', frm).val()=='' || $('#place', frm).val()=='0'){
		alert('Вы заполнили не все поля.');
		return false;
	}
	return true;
}

hs.graphicsDir = '/_com/highslide/graphics/';
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.fadeInOut = true;
hs.dimmingOpacity = 0.8;
hs.outlineType = 'rounded-white';
hs.captionEval = 'this.thumb.alt';
hs.marginBottom = 105; // make room for the thumbstrip and the controls
hs.numberPosition = 'caption';

// Add the slideshow providing the controlbar and the thumbstrip
hs.addSlideshow({
	//slideshowGroup: 'group1',
	interval: 5000,
	repeat: false,
	useControls: true,
	overlayOptions: {
		className: 'text-controls',
		position: 'bottom center',
		relativeTo: 'viewport',
		offsetY: -60
	},
	thumbstrip: {
		position: 'bottom center',
		mode: 'horizontal',
		relativeTo: 'viewport'
	}
});

function startGallery(id){
	var obj = $('a#thumb'+id+':first');
	hs.expand($(obj)[0], {slideshowGroup:id});
}
