//	Global Search Box Delete "Search" on Click
function swapValues() {
	jQuery(".swap_value").each(function(i){
        swapValues[i] = jQuery(this).val();
        jQuery(this).focus(function(){
            if (jQuery(this).val() == swapValues[i]) {
                jQuery(this).val("").css('color', '#000');
            }
        }).blur(function(){
            if ($.trim(jQuery(this).val()) == "") {
                jQuery(this).val(swapValues[i]).css('color', '#b5b5b5');
            }
        });
    });
}
jQuery(function() {
	swapValues();
});


// Weather WIDGET.
 jQuery(document).ready(function(){
 	jQuery("ul#moreCities").css("display", "block");
 	jQuery("#moreCities li:first-child").addClass("buttonPrevious");
	jQuery("#moreCities li:last-child").addClass("buttonNext");
	jQuery("#moreCities li:first-child ~ li:not(:last-child)").addClass("circleNav");

jQuery(function(){
	jQuery("#weather_widget > div + div").hide();
	jQuery("#weather_widget > div:first-child").addClass("current");
	addEvents();
});
function addEvents() {
	jQuery("#moreCities li:first-child").click(function(){
		weatherPrevious();
	});
	jQuery("#moreCities li:first-child ~ li:not(:last-child)").click(function(){
		weatherGoto(jQuery(this).text());
	});
	jQuery("#moreCities li:last-child").click(function(){
		weatherNext();
	});
}
function removeEvents(){
	jQuery("#moreCities > *").unbind();
}
function weatherNext() {
	if (!jQuery("#weather_widget > div.current + div").length) weatherGoto(1); 
	removeEvents();
	jQuery("#weather_widget > div.current").fadeOut("normal", function(){
		jQuery("#weather_widget > div.current + div").fadeIn("normal").addClass("current").prev().removeClass("current");
		weatherSync();
	});
}
function weatherPrevious() {
	if (!jQuery("#weather_widget > div + div.current").length) weatherGoto(jQuery("#moreCities li").length - 2);
	removeEvents();
	jQuery("#weather_widget > div.current").fadeOut("normal", function(){
		jQuery("#weather_widget > div + div.current").prev().fadeIn("normal").addClass("current").next().removeClass("current");
		weatherSync();
	});
}
function weatherGoto(context) {
	jQuery("#weather_widget > div.current").fadeOut("normal", function(){
		removeEvents();
		jQuery('#weather_widget > div:nth-child(' + parseInt(context) + ')').fadeIn("normal").addClass("current");
		weatherSync();
	}).removeClass("current");
}
function weatherSync() {
	var currentIndex = jQuery("#weather_widget > div.current").prevAll("div").length + 2;
	jQuery("#moreCities li").removeClass("current");
	jQuery("#moreCities li:nth-child(" + currentIndex + ")").addClass("current");
	addEvents();
}

 });