
function initli(){
    $(".sliderCtn ul li").each(function(){
        var pos = $(this).offset();
        var pos2 = $(this).position();
        $(this).find('em').css({
            top:pos2.top -75,
            left:pos.left -180
        });
    });
}

function subMenu(){
   $("#center #keyrus_tabs li a.menu").hover(
        function(t){
            currentItem = t.currentTarget.id;
            $(this).next().slideDown();

            $("#center #keyrus_tabs li a.menu").each(function(idx){
                if(currentItem != 'submenu_items_' + idx){
                    if($(this).next().is(':visible')){
                        $(this).next().slideUp(100);
                    }
                }
            });
        });
		if($(".keyrus_submenu_2").length){
			$(".keyrus_submenu_2").parent().mouseleave(function(){
				//$(".keyrus_submenu_2:visible").slideUp()
				
					chrono = setTimeout(function(){
						$(".keyrus_submenu_2:visible").slideUp();
					},200);	
				
			}).mouseenter(function(){
				clearTimeout(chrono);
			});
		}
   /* if($(".keyrus_submenu_2").length){
       $('.keyrus_mainTop').mouseover(function(){
            $(".keyrus_submenu_2").slideUp(100);
        });
        $('.keyrus_mainTop').mouseover(function(){
            $(".keyrus_submenu_2").slideUp(100);
        });
		$("#keyrus_tabs").mouseleave(function(){
			$(".keyrus_submenu_2:visible").slideUp()
		}).mouseenter(function(){
			clearTimeout();
		});

    }*/
   

}
/*------------------------------- accordeon -------------------------*/
function initMenuPage() {
    $('#menuPage').hide();
    $('a.openReadMore').click(
        function() {
            if ($('#menuPage').is(':visible')){
                $('#menuPage').slideUp('slow');
                $(this).text($('p.openreadmore').text()).removeClass('closeReadMore');
                return false;
            }
            else{
                $('#menuPage').slideDown('normal');
                $(this).text($('p.closereadmore').text()).addClass('closeReadMore');
                return false;
            } 
        }
        );
}
/*----------------------------end accordeon -------------------------*/
$(function(){
    if($('#center .pane1, #center .pane2').length){
        $('#center .pane1, #center .pane2').jScrollPane({
            scrollbarWidth:8,
            scrollbarMargin:10
        });
		
        $('#center .detail_map').hide();
        $('#center.pageMap fieldset').hide();
		
        $('#center .detail_map').each(function(index) {
            if($(this).find('.pane1').html() != null){
                $(this).find('.pane2').parent().hide();
            }
        });
    }

    $('#center .keyrus_leftMap a').click(function(){
    	
        $('.pane1 a').removeClass('on')	;
        $('#center div.detail_map').hide();
        $('#center.pageMap fieldset').show();
        $('#center div.'+$(this).attr('id')).show();
        $('#center').find('fieldset').attr('class','keyrus_roundedBlock_big');
        $('#center').find('fieldset').addClass($(this).attr('class'));
		
        $('#center .detail_map').each(function(index) {
            if($(this).find('.pane1').html() != null){
                $(this).find('.pane2').parent().hide();
                $(this).find('.pane1 ul ul').hide();
            }
        });
      //slide first element
    	var elem = $('#center .keyrus_roundedBlock_big .keyrus_roundedBlock_Ctn .keyrus_rightMap')
					.find('a.parent').eq(0).addClass('on');

    	elem.addClass('on');
    	$('#center .keyrus_roundedBlock_big .keyrus_roundedBlock_Ctn .keyrus_rightMap')
    		.find('li.reg a').eq(0).addClass('on');

    	elementsCount = elem.parent().find('ul li').length;

    	if(elementsCount > 1){
    		elem.parent().find('ul').not(':visible').slideDown('slow', function() {
    			$('#center .pane1, #center .pane2').jScrollPane({
    				scrollbarWidth:8,
    				scrollbarMargin:10
    			});
    		});
    	} else if(elementsCount == 1){
    		$(this).parent().find('ul li a').click();
    	}
        
        $('#center div.detail_map').find('.pane2').eq(0).parent().show('slow', function(){ 
        	$('#center  .pane2').jScrollPane({
              scrollbarWidth:8,
              scrollbarMargin:10
          });
     	});
        // END   
        
        $('#center .pane1, #center .pane2').jScrollPane({
            scrollbarWidth:8,
            scrollbarMargin:10
        });
        return false;
    });
	
    $('.pane1 a.parent').click(function(){

        $(this).parents('ul').find('a.parent').removeClass('on');
      
        $(this).addClass('on');
        $('.pane1 ul ul  a').removeClass('on');
        $(this).parents('.jScrollPaneContainer').parent().find('.pane2').parent().hide('slow');
        //$('#center .pane2').parent().hide('slow');
        /*$(this).parents('ul').find('ul:visible').slideUp('slow', function() {
				$(this).parents('.pane1').jScrollPane({scrollbarWidth:8, scrollbarMargin:10});																																																												
		});*/
	
        $(this).parents('.pane1').find('li').not(':eq('+$(this).parent().index()+')').find('ul').slideUp('slow');
        
        elementsCount = $(this).parent().find('ul li').length;
        
        if(elementsCount > 1){
            $(this).parent().find('ul').not(':visible').slideDown('slow', function() {
                $('#center .pane1, #center .pane2').jScrollPane({
                    scrollbarWidth:8,
                    scrollbarMargin:10
                });
            });
          //slide first element
            $('#center div.detail_map').find('.pane2').eq(0).parent().show('slow', function(){ 
            	$('#center .keyrus_roundedBlock_big .keyrus_roundedBlock_Ctn .keyrus_rightMap')
     			.children('div').children('div').children('div').children('ul').children('li')
     			.children('ul').children('li').children('a').eq(0).addClass('on');
            });
           
        } else if(elementsCount == 1){
            $(this).parent().find('ul li a').click();
        }
        return false;
    });
	
    $('.pane1 ul ul  a').click(function(){
        $(this).parent().parent().find('a').removeClass('on');
        $(this).addClass('on');
        var id_a = $(this).attr('id');

        if($('#center .pane2').parent().is(':visible')){
	
            $(this).parents('.jScrollPaneContainer').parent().find('.pane2').parent().hide('slow' ,function(){
                
                });
            if(id_a && $('#center .'+id_a).html() != null){
                $('#center div.'+id_a).parent().show('slow', function(){
                    $('#center .pane1, #center .pane2').jScrollPane({
                        scrollbarWidth:8,
                        scrollbarMargin:10
                    });
                });
            }
        }
        else{
            if($('#center .'+id_a).html != null){
                $('#center div.'+id_a).parent().show('slow', function(){
                    $('#center  .pane2').jScrollPane({
                        scrollbarWidth:8,
                        scrollbarMargin:10
                    });
                });
            }
        }
        return false;
    });
	
});

$(document).ready(function(){ 
    if($(".sliderCtn").length){
        $(".sliderCtn").jCarouselLite({
            btnPrev: ".ctrl_left",
            btnNext: ".ctrl_right",
            visible: 9,
            speed: 800,
            beforeStart: function(a) {
                $('.keryrus_slider .keyrus_vignette').html('');
            },
            afterEnd: function(a) {
                initli();
            }
        });
    }
    
    initli();

    $(".sliderCtn ul li").hover(function() {
        $(".sliderCtn em:visible").hide();
        $('.keryrus_slider .keyrus_vignette').html('');
        $('.keryrus_slider .keyrus_vignette').html('<em style="'+$(this).find('em').attr('style')+'">'+$(this).find('em').html()+'</em>');
        $(".sliderCtn ul li").removeClass('hover');
        $(this).addClass('hover');
        var pos2 = $(".sliderCtn ul li.hover").position();

        setTimeout('$(".keryrus_slider .keyrus_vignette").find("em").animate({opacity: "show", top: $(".sliderCtn ul li.hover").position().top-25}, "slow")',500);

    }, function() {
        $(".sliderCtn ul em:visible").hide();
    });

    // this initialises the demo scollpanes on the page.
    if($('#center .pane1, #center .pane2').length){
        $('#center .pane1, #center .pane2').jScrollPane({
            scrollbarWidth:8,
            scrollbarMargin:10
        });
    }
    

    $('#keyrus_wrapper').click(function(){
        //	if()
        $('.keyrus_menu .submenu:visible').slideUp('slow', function() {
            $(this).parent().removeClass('keyrus_on');
        });
    });

    if($('.keyrus_tools').length){
        $('.keyrus_tools').superfish();
    }
    /*
$('.keyrus_menu a.ctrl').click(function(){
        $('.keyrus_menu .keyrus_on').find('.submenu').slideUp('slow', function() {
            $(this).parent().removeClass('keyrus_on');
        });
        if($(this).next().hasClass('submenu')){
											 
            if(!$(this).parent().hasClass('keyrus_on')){
                $(this).parent().addClass('keyrus_on');
                $(this).next().slideDown('slow', function() {
					
                    });
            }else{
				
                $(this).next().slideUp('slow', function() {
                    $(this).parent().removeClass('keyrus_on');
                });
            }
            return false;
        }
    });*/
    
    $('#keyrus_wrapper').click(function(){
        //	if()
        $('.keyrus_menu .submenu:visible').slideUp('slow', function() {
            $(this).parent().removeClass('keyrus_on');
        });
    });

    //search.
    $('#search_field').bind('click', function(){
        $(this).val('');
    }
    );

    $('#search_field').bind('keypress', function(e){
        if(e.keyCode == 13){
            $('#form_search').submit();
        }
    });

    $('#submit_search_top').click(function(){
        $('#form_search').submit();
    })

    $('#form_search_bottom input:text').bind('click', function(){
        $(this).val('');
    })

    $('#form_search_bottom input:text').bind('keypress', function(e){
        if(e.keyCode == 13){
            $('#form_search_bottom').submit();
        }
    });

    $('#form_search_bottom .submit').bind('click', function(){
        $('#form_search_bottom').submit();
    })

    //Form send to friend;
    $('.back_to_sendtofriend_form').live('click', function(){
        $('#send_to_friend_form .error_msg').hide();
        $('#send_to_friend_form .success_msg').hide();
        $('#send_to_friend_container').slideDown();
    });
    //Test form fields
    $('#submit_send_to_friend').live('click', function(){
        var submitPage = '/id/' + $('#id_page').val();
        var error = false;
        var form =  $('#send_to_friend_form');

        var options = {
            url : submitPage,
            success : function(t)
            {
                $('#send_to_friend_form .error_msg').hide();
                $('#send_to_friend_form .success_msg').fadeIn();
                $('#send_to_friend_form .loader').hide();
                $('#send_to_friend_container').hide();
                enableFormFields('#send_to_friend_form');
            },
            //todo
            resetForm : false
            
        }
        //making ajax form
        form.ajaxForm(options);
        
        $('#send_to_friend_form .required').each(function(){
            if($(this).val() == ''){
                $(this).addClass('error');
                error = true;
            } else {
                $(this).removeClass('error');
            }
        });

        $('#send_to_friend_form .valid-email').each(function(){
            var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);

            if(!pattern.test($(this).val())){
                $(this).addClass('error');
                error = true;
            }
        });

        if(error){
            $('#send_to_friend_form .error_msg').fadeIn();
            $('#send_to_friend_form .success_msg').hide();
        } else {
            //ajax submit
            $('#send_to_friend_form .loader').fadeIn();
            form.submit();
            disableFormFields('#send_to_friend_form');
        }
        
        return false;

    });
    
    //End Form send to friend
    //Contact form
    $('.back_to_contact_form').click(function(){
        document.location = window.location;
        return false;
    });

    $('#submit_contact_form').click(function(){
        var error = false;
        var form =  $('#contact_form');

        var options = {
            success : function(t)
            {
                if (t == 'captcha_ko') {
                    $('#contact_form .error_msg_captcha').fadeIn();
                    $('#contact_form .error_msg').hide();
                    $('#contact_form .loader').hide();
                    $('#contact_form .success_msg').hide();
                }
                else{
                $('#contact_form .error_msg').hide();
                $('#contact_form .error_msg_captcha').hide();
                $('#contact_form .loader').hide();
                $('#contact_form .success_msg').fadeIn();
                
                $('#contact_form_container').hide();
                $('#mentions').hide();
                $('.keyrus_description').hide();
                $('h1').hide();
                $('.mandatory').hide();
                $('#confirmation').show();
                }
                enableFormFields('#contact_form');
               //$('#contact_form').reset();

            },
            

            resetForm : false,
            method : 'get'
}
        //making ajax form
        form.ajaxForm(options);

        $('#contact_form .required').each(function(){
            if($(this).val() == ''){
                $(this).addClass('error');
                error = true;
            } else {
                $(this).removeClass('error');
            }
        });

        $('#contact_form .valid-email').each(function(){
            var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);

            if(!pattern.test($(this).val())){
                $(this).addClass('error');
                error = true;
            }
        });

        if($('#country').val() == ''){
            error = true;
            $('#country').addClass('error');
        }
        
        if($('#distination').val() == ''){
            error = true;
            $('#distination').addClass('error');
        } else {
            $('#distination').removeClass('error');
        }

        if(error){
            $('#contact_form .error_msg').fadeIn();
            $('#contact_form .error_msg_captcha').hide();
            $.scrollTo(350, {
                easing:'elasout'
            });
            $('#contact_form .success_msg').hide();
        } else {
            //ajax submit
            $.scrollTo(350, {
                easing:'elasout'
            });
            $('#contact_form .loader').fadeIn();
            $('#contact_form .error_msg_captcha').hide();
            form.submit();
            disableFormFields('#contact_form');
        }
        
        return false;
    });
    
    //reset button
    $('.button_reset').click(function(){
        if($('#contact_form').length){
            $('#contact_form').resetForm();
        }
    });

    //End contact form

    
    //condidature form
    $('#submit_condidature_form').click(function(){
        var error = false;
        var form =  $('#condidature_form');

        var options = {
            success : function(t)
            {
                $('#condidature_form .error_msg').hide();
                $('#condidature_form .success_msg').fadeIn();
                enableFormFields('#condidature_form');
                  
            },
            resetForm : false,
            method : 'get'
        }

        $('#condidature_form .required').each(function(){
            
            if($(this).val() == ''){
                $(this).addClass('error');
                error = true;
            } else {
                $(this).removeClass('error');
            }
        });
        
        if ($('#countries').val() !=null){
            if($('#countries').val().length == 0) {
                $('#countries').addClass('error');
                error = true;
            } else {
                $('#countries').removeClass('error');
            }
        } else {
            $('#countries').addClass('error');
            error = true;
        }
        
        if($('#condidature_form #mobility:checked').length){
            $("#label_moblity").removeClass('error');
        } else {
            $("#label_moblity").addClass('error');
        }
        
        if($('#condidature_form #immediate:checked').length){
            $("#label_availability").removeClass('error');
        } else {
            $("#label_availability").addClass('error');
        }
        
        $('#condidature_form .valid-email').each(function(){
            var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);

            if(!pattern.test($(this).val())){
                $(this).addClass('error');
                error = true;
            }
        });
        
          
        if(error){
            $('#condidature_form .error_msg').fadeIn();
            $('#condidature_form .error_msg').html($('#condidature_form .error_value').val()) ;
            //$('#condidature_form .action').html('prob') ;

            $.scrollTo(350, {
                easing:'elasout'
            });
            $('#condidature_form .success_msg').hide();
            return false;
        }
        else {
            //ajax submit
            form.submit();
        }
          
        return false;
    });
    //End condidature form

    //Frames front

    /*------------------------------------------------------------------*/
    $('.keyrus_menu a.ctrl').hover(function(){

        if($(this).next().hasClass('submenu')){
            if(!$(this).parent().hasClass('keyrus_on')){
                $(this).parent().addClass('keyrus_on');
                //hide other
                $('.keyrus_menu a.ctrl').each(function(idx){
                    if($(this).attr('id') != "ctrl_" + idx){
                        $(this).next().slideUp();
                    }
                });

                $(this).next().slideDown('slow');
            } else {
                $(this).parent().addClass('keyrus_on');
                $('.keyrus_menu a.ctrl').each(function(idx){
                    if($(this).attr('id') != "ctrl_" + idx){
                        $(this).next().slideUp();
                    }
                });
                $(this).next().slideDown('slow');
            }
            return false;
        }
    },
    function(){
        $('.submenu').mouseleave(function(){
            $(this).slideUp();
            $(this).parent().removeClass('keyrus_on');
        });
    }
    );
	
    /*----------------------------------------------------------------------*/
    /*$('ul#keyrus_tabs li a').hover(function(){

        if($(this).next().hasClass('keyrus_submenu_2')){
            if(!$(this).parent().hasClass('keyrus_on')){
                $(this).parent().addClass('keyrus_on');
                $(this).next().slideDown('slow');
            } else {
                $(this).parent().addClass('keyrus_on');
                $(this).next().slideDown('slow');
            }

            return false;
        }
		
    },
    function(){
        $('ul.keyrus_submenu_2').mouseleave(function(){
            $(this).slideUp();
            $(this).parent().removeClass('keyrus_on');
        });
    }
    );
    
    /*------------------------------------------------------------------------*/
	
    /***********************************************************************/
	
    /*	function subMenu(){
	$("ul#keyrus_tabs li a").hover(
		function(){
			$(".keyrus_submenu_2").show();
		},
		function(){
			setTimeout(function() {
				$(".keyrus_submenu_2").hide();
			}, 999999);
		}
	);
}*/
    /***********************************************************************/

    /*$('.keyrus_menuL a').hover(function(){
        $('.keyrus_menuL a').removeClass('on');
        $(this).addClass('on');
        $('.keyrus_mainTop .keyrus_topContent').css('z-index','100');
        $('.keyrus_hp_content').slideDown('slow');
        $('#iframe').attr('src',$(this).attr('rel'));

    }, function(){
        $('.keyrus_hp_content').mouseleave(function(){
            $('.keyrus_hp_content').slideUp('slow',function(){
                $('.keyrus_mainTop .keyrus_topContent').css('z-index','0');
            });
        });
    });*/

	 
	 $('.keyrus_menuL a').mouseenter(function(){
		
		/*--- hide menu ---*/
		$('.keyrus_menu .submenu:visible').slideUp('slow', function() {
            $(this).parent().removeClass('keyrus_on');
			
        });	 
		$('.keyrus_menuL a').removeClass('on');
		$(this).addClass('on');
		idx = $(this).parent().index();
		
		$('.keyrus_mainTop .keyrus_topContent').css('z-index','100');	
		$('#iframe').hide();
	
		if($('.keyrus_welcome').position().left != 0){
			$('.keyrus_welcome').animate({left:"0px" }, 500, function() {
				$('#iframe').attr('src',$('.keyrus_menuL li:eq('+idx+') a').attr('rel'));	
				$('#iframe').show();	
				$('.keyrus_mn1').css('z-index','0');					
			});
		}else{
			$('#iframe').attr('src',$(this).attr('rel'));	
			$('#iframe').show();	
		}
  
	}, function (){return false});
	
	$('div.keyrus_topContent').mouseleave(function(event) {
		if($('.keyrus_welcome').is(':visible')){
			
			$('.keyrus_welcome').animate({left:"-700px" },560,function() {
				$('#iframe').hide();
				$('.keyrus_menuL a').removeClass('on');
				$('div.keyrus_hp_content').find('iframe').attr('src',"");
				$('.keyrus_mn1').css('z-index','200');
			});
		}
		$('.keyrus_mainTop .keyrus_topContent').css('z-index','0');
	});
  
    //disable click
    $('.keyrus_menuL a').click(function(){
		if(!$(this).hasClass('ignore')){
			return false;
		}
        
    });
    $('.close').click(function(){
        $('.keyrus_hp_content').slideUp('slow',function(){
            $('.keyrus_mainTop .keyrus_topContent').css('z-index','0');
        });
    });


    $('.thickboxLink').click(function(){
        tb_show('', '/send-to-friend/id/' + $(this).attr('id')
            + '?height=430&width=960&id=' + $(this).attr('id')
            + '&job=' + encodeURIComponent($(this).attr('name'))
            + '&link=' + encodeURIComponent(window.location.href)
            );

        return false;
    });

});


function disableFormFields(form)
{
    $(form + ' input').attr('disabled', 'disabled');
    $(form + ' textarea').attr('disabled', 'disabled');
    $(form + ' select').attr('disabled', 'disabled');
}

function enableFormFields(form)
{
    $(form + ' input').attr('disabled', false);
    $(form + ' textarea').attr('disabled', false);
    $(form + ' select').attr('disabled', false);
}

//$(function(){
//    // this initialises the demo scollpanes on the page.
//    $('#center .pane1, #center .pane2').jScrollPane({
//        scrollbarWidth:8,
//        scrollbarMargin:10
//    });
//
//	
//
//	
//    $('.pane1 a.parent').click(function(){
//        $(this).parents('ul').find('a.parent').removeClass('on');
//        $(this).addClass('on');
//        $('.pane1 ul ul  a').removeClass('on');
//        $(this).parents('.jScrollPaneContainer').parent().find('.pane2').parent().hide('slow');
//        //$('#center .pane2').parent().hide('slow');
//        /*$(this).parents('ul').find('ul:visible').slideUp('slow', function() {
//				$(this).parents('.pane1').jScrollPane({scrollbarWidth:8, scrollbarMargin:10});																																																												
//		});*/
//	
//        $(this).parents('.pane1').find('li').not(':eq('+$(this).parent().index()+')').find('ul').slideUp('slow');
//        $(this).parent().find('ul').not(':visible').slideDown('slow', function() {
//            $('#center .pane1, #center .pane2').jScrollPane({
//                scrollbarWidth:8,
//                scrollbarMargin:10
//            });
//        });
//	
//        return false;
//    });
//	
//    $('.pane1 ul ul  a').click(function(){
//        $(this).parent().parent().find('a').removeClass('on');
//        $(this).addClass('on');
//        var id_a = $(this).attr('id');
//        if($('#center .pane2').parent().is(':visible')){
//			
//            $(this).parents('.jScrollPaneContainer').parent().find('.pane2').parent().hide('slow' ,function(){
//                if(id_a && $('#center .'+id_a).html() != null){
//                    $('#center div.'+id_a).parent().show('slow', function(){
//                        $('#center .pane1, #center .pane2').jScrollPane({
//                            scrollbarWidth:8,
//                            scrollbarMargin:10
//                        });
//                    });
//                }
//            });
//        }
//        else{
//            if($('#center .'+id_a).html != null){
//                $('#center div.'+id_a).parent().show('slow', function(){
//                    $('#center  .pane2').jScrollPane({
//                        scrollbarWidth:8,
//                        scrollbarMargin:10
//                    });
//                });
//            }
//        }
//        return false;
//    });
//	
//});
function initMenu() {
    $('#menu ul').hide();
    $('#menu ul:first').show();
    $('#menu li a').click(
        function() {
            var checkElement = $(this).next();
            if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
                return false;
            }
            if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
                $('#menu ul:visible').slideUp('normal');
                $('#menu a.menu_link.open').removeClass('open');
                $(this).addClass('open');
                checkElement.slideDown('normal');
                return false;
            }
        }
        );
}
$(document).ready(function(){ 

    if($('.keyrus_tools').length){
        $('.keyrus_tools').superfish();
    }
    /*
    $('.keyrus_menu a.ctrl').click(function(){
        $('.keyrus_menu .keyrus_on').find('.submenu').slideUp('slow', function() {
            $(this).parent().removeClass('keyrus_on');
        });
        if($(this).next().hasClass('submenu')){
											 
            if(!$(this).parent().hasClass('keyrus_on')){
                $(this).parent().addClass('keyrus_on');
                $(this).next().slideDown('slow', function() {
					
                    });
            }else{
				
                $(this).next().slideUp('slow', function() {
                    $(this).parent().removeClass('keyrus_on');
                });
            }
            return false;
        }
    });*/   
    $('#keyrus_wrapper').click(function(){
        //	if()
        $('.keyrus_menu .submenu:visible').slideUp('slow', function() {
            $(this).parent().removeClass('keyrus_on');
        });
    });
    
    /*------------------------------accordion------------------------------*/
    initMenuPage();
    initMenu();
    subMenu();
}); 






