

$(document).ready(function(){
	var current = 0;
	var rotating = false;

    var callback = function(){
		if (rotating)
			return false;
		rotating = true;
	
        var index = $(this).index();
        var visible = $('.popup:visible');
		
        if(current != index){
            var invisible = $('.popup').eq(index);
            //$('#img'+current).fadeOut(1000);
            current = index;
            $('#showPopups li').removeClass('active');
            $(this).addClass('active');
            //$('#img'+index).fadeIn(1000);
            //$('#presentation').addClass('img'+index);

            visible.animate({top: '-140px', opacity: 0}, 500, function(){
                visible.hide();
				rotating = false;
            });
            invisible.show();
            invisible.css('top', '140px');
            invisible.css('opacity', 0);
            invisible.animate({top: '0px', opacity: 1}, 500);
        }
		
        return false;
    };
	
	//$('#showPopups li').click(callback);
	
	
	$('img').attr('title', '');
	
	listUpdate(1);
});

function listUpdate(number) {
	var heightSum = $('#contentIndexColumnLeft h2').height() - 65;
	for (var i = 0; i < number; i++) {
		heightSum += $('#contentIndexColumnLeft ul li:nth-child(' + i + ')').height();
	}
	if (number > 1) {
		heightSum += (number - 1) * 10;
	}
	
	$('.joinLine2').css('margin-top', heightSum + 'px');
	if (number > 1) {
		$('.joinLine3').height(parseInt($('.joinLine2').css('margin-top')) - 37);
		$('.joinLine3').css('top', 162 + $('.joinLine3').height() - heightSum + 'px');
	}
	else {
		$('.joinLine3').height(125 - 88 - ($('#contentIndexColumnLeft h2').height() - 65));
		$('.joinLine3').css('top', 125 - $('.joinLine3').height() + 'px');
	}
	
	$('#contentIndexColumnLeft ul li').removeClass('active');
	$('#contentIndexColumnLeft ul li:nth-child(' + i + ')').addClass('active');
	
	$('#imgLelel1').css('background-image', 'url(/images/listImage' + number + '.jpg)');
}

$(document).ready(function() {
    $('#cycle').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	/*
	$('#popupContainer').cycle({
		fx: 'scrollUp', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		cleartypeNoBg: true
	})*/;
		
});
function submitForm()
{
//alert('ok');
$('#search').submit();
  //document.('#search').submit();
}


var current = 0;
$(document).ready(function(){
    $('.vacancyLink a').click(function(){
        var id = $(this).parents('.vacancyRecord').attr('id');
        id = parseInt(id.replace(/vacancyRecord/ig, ""));
        $('#vacancyPopup'+id).fadeIn();
        return false;
    });
    $('.vacancyPopupClose').click(function(){
        $(this).parents('.vacancyPopup').fadeOut();
        return false;
    });
});


	
function vacancy_feedback_show(vacancy_id) {
	$('#vacancy_feedback').fadeIn();
	$('#vacancy_id').attr('value', vacancy_id);
}

function vacancy_content_show(vacancy_id) {
	if ($('#vacancy_item_content_'+vacancy_id).css('display') == 'none') {
		//alert('ok');
		$('#vacancy_item_content_'+vacancy_id).show();
		//$('#vacancy_item_content_'+vacancy_id).animate({ "opacity": "show"}, "slow", "easein");
		$('#vacancy_item_toggler_'+vacancy_id).css('color', '#FFF');
		$('#vacancy_item_toggler_'+vacancy_id).css('border-bottom-color', '#FFF');
		
		//location.href = '#' + vacancy_id;
	}
	else {
		//alert('no');
		//$('#vacancy_item_content_' + vacancy_id).animate({ height: 'hide' }, 500);
		$('#vacancy_item_content_'+vacancy_id).hide();
		$('#vacancy_item_toggler_' + vacancy_id).css('color', '#43B1E4');
		$('#vacancy_item_toggler_' + vacancy_id).css('border-bottom-color', '#43B1E4');
	}
}

$(function() {
			$("#tree").treeview({
				collapsed: false,
				animated: "medium",
				control:"#sidetreecontrol",
				persist: "location"
			});
		})


$(document).ready(function() {
					$().piroBox({
							my_speed: 400, //animation speed
							bg_alpha: 0.1, //background opacity
							slideShow : true, // true == slideshow on, false == slideshow off
							slideSpeed : 4, //slideshow duration in seconds(3 to 6 Recommended)
							close_all : '.piro_close,.piro_overlay'// add class .piro_overlay(with comma)if you want overlay click close piroBox

					});
				});

