function hideHumanValidationFields() {
	$('#hvalidation').prev().hide();
    $('#hvalidation').hide();
}

$(document).ready(function() {
  hideHumanValidationFields();
       
    $("a[rel~=external]").each(function(i){
        this.target="_blank";
    });	    

    $(".cmsContentContainer a, #album a").filter(function(){
        if($(this).attr('href').match(/\.(jpe?g|png|gif)/i)) {
            $(this).fancybox({
                'titlePosition' : 'inside'
            });
        }       
    });    
       
    $('.cmsContentContainer img').each(function() {
        if($(this).css('float') == 'left') {
            $(this).addClass('imageLeft');
        } else if($(this).css('float') == 'right') {
            $(this).addClass('imageRight');
        }
    });  

    $('#slider').nivoSlider({
        effect: 'fade',
        directionNav: false,
        controlNav: false,
        keyboardNav: false,
        pauseOnHover: false,
        animSpeed: 800,
        pauseTime: 10000
    });
    
    if($('#landing').length > 0) {
        $('.cmsContentContainer').hide();
        //$('html').css('background-repeat', 'no-repeat');
        setTimeout(function(){ 
            $('#landing').fadeOut();
            $('.cmsContentContainer').fadeIn();
            //$('html').css('background-repeat', 'repeat-x');
        }, 5000);
    }
    
    $('#submit_callme').click(function() {
        $('#callme').val(1);
        return;
    });
    
    $('.button_applicationform_1').click(function() {
        $('.applicationform_tab').slideUp();
        $('#profile').slideDown();
    });    
    
    $('.button_applicationform_2').click(function() {
        $('.applicationform_tab').slideUp();
        $('#education').slideDown();
    });
    
    $('.button_applicationform_3').click(function() {
        $('.applicationform_tab').slideUp();
        $('#linguistic').slideDown();
    });  
    
    $('.button_applicationform_4').click(function() {
        $('.applicationform_tab').slideUp();
        $('#experience').slideDown();
    });        
    
    $('.button_applicationform_5').click(function() {
        $('.applicationform_tab').slideUp();
        $('#assessment').slideDown();
    });   

    if ($("#skill_telephone_exchange option:checked").val() == 1) {
        $('#skill_telephone_exchange_type').show();
    }    
	$("#skill_telephone_exchange").change(function(){
		if ($("#skill_telephone_exchange option:checked").val() == 1) {
			$('#skill_telephone_exchange_type').show();
		}
		else{
			$('#skill_telephone_exchange_type').hide();
		}
	});  
    
    if ($("#registered_other_promotioncompany option:checked").val() == 2) {
        $('#registered_other_promotioncompany_tr').show();
    }    
	$("#registered_other_promotioncompany").change(function(){
		if ($("#registered_other_promotioncompany option:checked").val() == 2) {
			$('#registered_other_promotioncompany_tr').show();
		}
		else{
			$('#registered_other_promotioncompany_tr').hide();
		}
	});      
    
    if ($("#availability_days_not option:checked").val() == 2) {
        $('#availability_days_not_detail_tr').show();
    }    
	$("#availability_days_not").change(function(){
		if ($("#availability_days_not option:checked").val() == 2) {
			$('#availability_days_not_detail_tr').show();
		}
		else{
			$('#availability_days_not_detail_tr').hide();
		}
	});      
      
    if ($("#sollicitation_source option:checked").val() == 7) {
        $('#sollicitation_source_different_value_tr').show();
    }    
	$("#sollicitation_source").change(function(){
		if ($("#sollicitation_source option:checked").val() == 7) {
			$('#sollicitation_source_different_value_tr').show();
		}
		else{
			$('#sollicitation_source_different_value_tr').hide();
		}
	});         
});

