﻿
$(document).ready(function() {	
	$('.index, .form-normal .div-other-language, .radio-section, .div-other-occupation, .qulification2, .qulification3, .employer2, .employer3').hide();
	$('.carousel').cycle({
        fx: 'fade'        
    });
		
	var indexTop=($(window).height()-$('.index').height())/2.5;
	var indexLeft=($(window).width()-$('.index').width())/2;

	$('.index').css({'left':indexLeft,'top':indexTop});
	$('.index').show();	
			   
	$('h3.question').click(function(){
			$(this).next('div.answer').slideToggle();
		});		
	$('.btn-showMap').click(function() {
			$('.googleMapHolder').slideDown();					 
		});
	
	$('.div-language').find('select').change(function(){
		if($(this).val()=='57') $('.form-normal .div-other-language').slideDown();
			else $('.form-normal .div-other-language').slideUp();
	});
	
	$('.div-occupation').find('select').change(function(){
		if($(this).val()=='185') $('.form-normal .div-other-occupation').slideDown();
			else $('.form-normal .div-other-occupation').slideUp();
	});

	
	$('.radio-box').each(function(){
		$(this).find('input:radio').each(function(){
			$(this).click(function(){
				if($(this).val()=='1') $(this).closest('div.radio-box').next().slideUp();
					else $(this).closest('div.radio-box').next().slideDown();
			});
		});
	});
	
	$('.btn-add-qulification2').click(function(){
		$('.qulification2').slideToggle();
		var text = $(this).text();
    	$(this).text(text == "Add another qualification?" ? "Remove this qualification?" : "Add another qualification?");
	});
	
	$('.btn-add-qulification3').click(function(){
		$('.qulification3').slideToggle();
		var text = $(this).text();
    	$(this).text(text == "Add another qualification?" ? "Remove this qualification?" : "Add another qualification?");
	});
	
	$('.btn-add-employer2').click(function(){
		$('.employer2').slideToggle();
		var text = $(this).text();
    	$(this).text(text == "Add another employer?" ? "Remove this employer?" : "Add another employer?");
	});
	
	$('.btn-add-employer3').click(function(){
		$('.employer3').slideToggle();
		var text = $(this).text();
    	$(this).text(text == "Add another employer?" ? "Remove this employer?" : "Add another employer?");
	});

	
	
});
