jQuery(document).ready(function() {
	
	//weather service
	$('#weathercity').change(function () {
		$('#localweatherholder').html('Loading...');
		$.post("http://www.bulgarianestate4u.com/bg/weather", { city: $('#weathercity :selected').text() }, function(data){ $('#localweatherholder').html(data) });
	});
	//end weather service
	
	//currencycalculator
	$('#calculate').click(function () {
		$('#result').val('Calculating...');
		$.post("http://www.bulgarianestate4u.com/bg/currency", { convert: $('#convert :selected').text(), into : $('#into :selected').text(), amount : $('#amount').val() }, function(data){ $('#result').val(data) });
	});
	//end currencycalculator
	
	//top offers
	$("#flags a").hover(function() { //On hover...
		
		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
		
		//Set a background image(thumbOver) on the &lt;a&gt; tag 
		$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		//Animate the image to 0 opacity (fade it out)
		$(this).find("span").stop().animate({opacity: 0}, 600);
	} , function() { //on hover out...
		//Animate the image back to 100% opacity (fade it back in)
		$(this).find("span").stop().animate({opacity: 1}, 300);
	});
	
	$(".top-btn").click(function(){
		id = $(this).attr('title');
		url = $('#url'+id).html();
		$('#top-offers').css('background','url(' + $('#img'+id).attr('title') +') center center');
		$('#top-info').html($('#img'+id).html());
    	$('#top-info').click(function(){window.location=url});
	});
	//end top offers
	
	//login
	$("#loginDialog").colorbox({width:"300px", inline:true, href:"#loginDialogContent"});
	//end login	
	
});


function show_hide(divName)
{
	if (document.getElementById) { obj=document.getElementById(divName) }
	else if (document.all) { obj=document.all[divName]; }
	if (obj) {
		if (obj.style.display == "none") { obj.style.display = '';}
		else { obj.style.display = 'none';}
	}
}