jQuery(document).ready(function()
	{	
		
	
		setTimeout(function(){jQuery('.blink').blink(100);},1000);			
		
		
		jQuery('div#line marquee').marquee('pointer').mouseover(function () {
        jQuery(this).trigger('stop');
        }).mouseout(function () {
            jQuery(this).trigger('start');
        }).mousemove(function (event) {
            if (jQuery(this).data('drag') == true) {
                this.scrollLeft = jQuery(this).data('scrollX') + (jQuery(this).data('x') - event.clientX);
            }
        }).mousedown(function (event) {
            jQuery(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
        }).mouseup(function () {
            jQuery(this).data('drag', false);
        });
			
		jQuery('.gallery-box .nivoSlider-box').nivoSlider({controlNav:false, slices:15, animSpeed:1000, pauseTime:5000, effect:'random'});		
		jQuery(function(){jQuery('ul.sf-menu').superfish();});
		jQuery('.index .info').addClass('hidden');
			
		if (jQuery.browser.msie && 7 > parseInt(jQuery.browser.version)) 
			jQuery('#layout').css('height', 1).css('height', '');

		jQuery('.index .country-box').each(function()
		{
			var post = jQuery(this).find('span').text();
			var link = jQuery(this).find('form .form_link');
			//link.attr('href', link.attr('href') + '?post=' + encodeURIComponent(post));
			var path = link.attr('href')
			link.click(function() {
				setCookie('rigroup_vacancy', encodeURIComponent(post), path);
			});
		});
		
		jQuery('.index span.country-img').click(function()
		{
			clickVacancy(this);
		});
	});


    function setCookie (name, value, path) {
		document.cookie = name + "=" + escape(decodeURIComponent(value)) + '; path=' + path;
	}


	function clickVacancy(obj)
	{
		jQuery('.index span.selected').each(function()
		{
			var vacancy = jQuery(this).parent().parent().find('.info');
			vacancy.slideUp(500).addClass('hidden');
			jQuery(this).removeClass('selected');
		});
		
		var vacancy = jQuery(obj).parent().parent().find('.info');
		
		if ('none' == vacancy.css('display'))
		{
			vacancy.slideDown(500).removeClass('hidden');
			jQuery(obj).addClass('selected');
			
			setTimeout(function()
			{
				jQuery(window).scrollTop(jQuery(obj).offset().top - 100000);
			}, 100000);
		}
		
		if (jQuery.browser.msie && 7 > parseInt(jQuery.browser.version))
			setTimeout(function()
			{
				jQuery('#layout').css('height', 1).css('height', '');
			}, 300);
	}
