$(function () {
	$('#menu>li>a').mouseover(function() {
		if (!$(this).parent('li').children('ul').is(':visible')) {
			$('#menu>li>ul').slideUp('fast', function() {
			
			});
			$(this).parent('li').children('ul').slideDown('fast');	
		}
	});	
	
	$("a.imgbox").imgbox();
	
	window.setTimeout(function(){changeText(0)}, 3000);
	
	$('select.changeCurrency').change(function() {
		setPrices($(this).val());
	})
});

$(document).ready(function() {
	setPrices('eur');
})

function changeText(textId) {
	
	var welcome = new Array("Business Assistant and Administrator available for assignments<br> in the EU and worldwide. The business is based in PRAGUE, Czech Republic",
	'I specialise on providing business assistant, administrative, clerical,<br> managerial counselling, travel and lifestyle and leisure services.',
	'<strong>Independent Business Assistant and Administrator</strong><br>');	
	
	
	
	$('p.welcome span').animate({opacity: "0"}, 'fast', 'swing', function() {		
		$('p.welcome span').html(welcome[textId]);
		$('p.welcome span').animate({opacity: "1"});
	});
	
	var newId = (textId == 2) ? 0 : textId+1;
	window.setTimeout(function(){changeText(newId)}, 4000);
}

function setPrices(currency) {
	$('span.price').each(function() {
		var price = $(this).attr('title');
		
		if (currency == 'czk') {
		 	var output = price + ' czk';
		} else if (currency == 'usd') {
			if (price == 300) var output = '$ 18';
			if (price == 400) var output = '$ 25';
			if (price == 500) var output = '$ 32';
			if (price == 2000) var output = '$ 120';			
		} else if (currency == 'eur') {
			var output = '€ ' + (price/25);
		}
		
		$(this).html(output);
	})
	
}
