function getGNGKod(kod){

	$.post("/sprav.php", { sprav: "gng", kod: kod },
  function(data){
    document.getElementById('kod_g').innerHTML = data;
  });

}

function getGNGTit(tit){

	$.post("/sprav.php", { sprav: "gng", tit: tit },
  function(data){
    document.getElementById('tit_g').innerHTML = data;
  });

}


function getETSNGKod(kod){

	$.post("/sprav.php", { sprav: "etsng", kod: kod },
  function(data){
    document.getElementById('kod_g').innerHTML = data;
  });

}

function getETSNGTit(tit){

	$.post("/sprav.php", { sprav: "etsng", tit: tit },
  function(data){
    document.getElementById('tit_g').innerHTML = data;
  });

}


function cals_submit(){

var pass = 0;
if ($('#in_1').val() == '') pass++; 
if ($('#in_3').val() == '') pass++;
if ($('#in_4').val() == '') pass++;
if ($('#in_6').val() == '') pass++;
if ($('#in_8').val() == '') pass++;
if ($('#in_11').val() == '') pass++;
if ($('#in_12').val() == '') pass++;
if ($('#in_15').val() == '') pass++;
if (pass>0) alert('Заполните обязательные поля!'); else $("#cals_stoim").submit();
}

function cals_submitEN(){
var pass = 0;
if ($('#in_1').val() == '') pass++;
if ($('#in_3').val() == '') pass++;
if ($('#in_4').val() == '') pass++;
if ($('#in_6').val() == '') pass++;
if ($('#in_8').val() == '') pass++;
if ($('#in_9').val() == '') pass++;
if ($('#in_11').val() == '') pass++;
if ($('#in_12').val() == '') pass++;
if ($('#in_15').val() == '') pass++;
if (pass>0) alert('Fill in the required fields!'); else $("#cals_stoim").submit();
}

function cals_submitDE(){
var pass = 0;
if ($('#in_1').val() == '') pass++;
if ($('#in_3').val() == '') pass++;
if ($('#in_4').val() == '') pass++;
if ($('#in_6').val() == '') pass++;
if ($('#in_8').val() == '') pass++;
if ($('#in_9').val() == '') pass++;
if ($('#in_11').val() == '') pass++;
if ($('#in_12').val() == '') pass++;
if ($('#in_15').val() == '') pass++;
if (pass>0) alert('Fullen Sie die erforderlichen Felder!'); else $("#cals_stoim").submit();
}

function showVideo(filename){

	var video_block = '<embed  flashvars="&file='+ filename +'&amp;skin=/templates/belint/images/video/silverywhite.swf" src="/templates/belint/images/video/player.swf" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" quality="high" name="mpl" width="400" height="350" type="application/x-shockwave-flash" />';					
	document.getElementById('VideoPlayer').innerHTML = video_block;

}

function CheckContactForm(){
	var pass = '';
	if(!document.getElementById('username').value.match(/^[а-яА-Яa-zA-Z-]+$/)){
		pass += 'Ошибка: некорректно введено имя!\n';
	}
	if(!document.getElementById('email').value.match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/)){
		pass += 'Ошибка: некорректно введен e-mail!\n';
	}
	if(document.getElementById('phone').value == ''){
		pass += 'Ошибка: поле телефон не может пустым!\n';
	}
	if(document.getElementById('phone').value.match(/[^0-9]/)){
		pass += 'Ошибка: телефон может состоять только из цифр!\n';
	}
	if(document.getElementById('textbody').value == ''){
		pass += 'Ошибка: сообщение не может пустое!\n';
	}	
	if(pass != ''){
		alert(pass);
	} else {
		document.contact_form.submit();
	}
}

function CheckContactFormEN(){
	var pass = '';
	if(!document.getElementById('username').value.match(/^[а-яА-Яa-zA-Z-]+$/)){
		pass += 'Error: The name is entered incorrectly!\n';
	}
	if(!document.getElementById('email').value.match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/)){
		pass += 'Error: incorrectly entered e-mail!\n';
	}
	if(document.getElementById('phone').value == ''){
		pass += 'Error: The field of the phone can not be empty!\n';
	}
	if(document.getElementById('phone').value.match(/[^0-9]/)){
		pass += 'Error: The phone can only consist of digits!\n';
	}
	if(pass != ''){
		alert(pass);
	} else {
		document.contact_form.submit();
	}
}


function CheckContactFormDE(){
	var pass = '';
	if(!document.getElementById('username').value.match(/^[а-яА-Яa-zA-Z-]+$/)){
		pass += 'Fehler: Der Name ist falsch eingegeben!\n';
	}
	if(!document.getElementById('email').value.match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/)){
		pass += 'Fehler: falsch eingegebene E-Mail!\n';
	}
	if(document.getElementById('phone').value == ''){
		pass += 'Fehler: Das Feld des Telefons kann nicht leer sein!\n';
	}
	if(document.getElementById('phone').value.match(/[^0-9]/)){
		pass += 'Fehler: Das Telefon kann nur aus Ziffern bestehen!\n';
	}
	if(pass != ''){
		alert(pass);
	} else {
		document.contact_form.submit();
	}
}

function Hide(){
jQuery("#flash_map").hide();
}

		jQuery(document).ready(function(){
	if(document.getElementById('gallery')) {
		jQuery("#gallery a").fancybox({
			hideOnContentClick: true,
			overlayShow: true,
			overlayOpacity: 0.5,
			zoomSpeedIn: 2100,
			zoomSpeedOut:600
		});   
	}
});

		jQuery(function(){
			jQuery("#faded").faded({
				crossfade: true,
				autoplay: 4000,
				autorestart: true,
				speed: 900
			});
		});
	
/*SCROLL*/
	
	jQuery(document).ready(function(){	jQuery('.scrollable').jScrollPane({		animateTo:true, 		showArrows:true, 		scrollbarWidth:50,		verticalDragMinHeight: 20,		verticalDragMaxHeight: 20	});
	
	jQuery('li a').click(function(event){
		var target = $('a[name='+$(this).attr('href').replace('#','')+']');
		var cont = $('.scrollable');
		var p = target.parent();
		var h = parseInt(p[0].offsetTop);
		cont[0].scrollTo(h);

		event.preventDefault();
	});
});
	
	

	
/*LOGO SCROLL*/	
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 2,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });		
	jQuery('.scroll-pane-arrows').jScrollPane(
					{
						showArrows: true,
						horizontalGutter: 10,						verticalDragMinHeight: 10,						verticalDragMaxHeight: 10
					}
				);	
});
/*GALLERY*/		


/*$(document).ready(function(){
    $(".btn-slide").click(function(){
        $(".block").slideToggle("slow");
        $(this).toggleClass("active");
    });
});*/

function ShowMap(){
	$('#flash_map').fadeIn('normal');
}

function HideMap(){
	$('#flash_map').fadeOut('normal');
}

