$(function()
{	
	$('#country-select').change( function()
	{
		$('#country-form').submit();
	});
	
	$('#country-form').submit( function()
	{
		window.location = $('#country-form option:selected').val();
		return false;
	});
});

//GET Variable function
function $_GET(q,s) {
	s = s ? s : window.location.search;
	var re = new RegExp('&'+q+'(?:=([^&]*))?(?=&|$)','i');
	return (s=s.replace(/^\?/,'&').match(re)) ? (typeof s[1] == 'undefined' ? '' : decodeURIComponent(s[1])) : undefined;
	
} 

$(document).ready(function(){
	
	//Loading fancybox
	$("#virtual-tour").fancybox({
		'width'				: 800,
		'height'			: 400,
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'scrolling'			: 'no',
		'overlayOpacity'	: 0.7,
		'overlayColor'		: '#000000'
	});
	
	//Checking for fancybox GET Param
	var popup = $_GET('popup');
	
	if(popup == '360'){
	
		$("#virtual-tour").trigger('click');
	
	}
	
	
	 //Bubble hover functionality...
	$(".bubble a").hover(function() {
	if($.browser.msie){   
	$(this).next("em").show();
	} else {
	$(this).next("em").stop(true, true).animate({opacity: "show", top: "-110"}, "slow");
	}
	}, function() {
	if($.browser.msie){   
	$(this).next("em").hide();
	} else {
	$(this).next("em").animate({opacity: "hide", top: "-120"}, "fast");
	}
	
	});
	if($.browser.msie){   
	$(".bubble a").click(function(){$(".bubble em").hide();});
	} else {
	$(".bubble a").click(function(){$(".bubble em").animate({opacity: "hide", top: "-120"}, "fast");});
	}



 
});


