/*------------------------------------------------------------------
 
    [city] 
 
    Date:                               02/10/2011
    Version:                            1.0
	
-------------------------------------------------------------------*/

/*------------------------------------------------------------------
	start configuration
-------------------------------------------------------------------*/
$(document).ready(function() {

	//$("#flashContent").attr("style", "display: none;");
	$("#main_image_show").fadeIn("slow");
	
});

/*------------------------------------------------------------------
	resize window
-------------------------------------------------------------------*/
$(document).ready(function() {

	var window_w = $(window).width();
	$('#top').append("<style type=\"text/css\">.main_image {width: " + window_w + "px !important;}</style>");				

});

/*------------------------------------------------------------------
	search box text show / hide
-------------------------------------------------------------------*/
$(document).ready(function() {

	/* search_input: start */
	
	$('.show_hide').click(
		function() {
			if (this.value == this.defaultValue) {
				this.value = '';
			}
		}
	);
	
	$('.show_hide').blur(
		function() {
			if (this.value == '') {
				this.value = this.defaultValue;
			}
		}
	);

	/* search_input: end */
	
});

/*------------------------------------------------------------------
	contact default title show / hide
-------------------------------------------------------------------*/
$(document).ready(function() {

	$("#email_topic").change(function(){ 
    	if($("#email_topic option:selected").attr('id') === 'default_topic'){ 
			$("#extra_element_box").removeClass("hidden_element");
			$("#extra_element_box").addClass("visible_element");
		} else{
			$("#extra_element_box").removeClass("visible_element");
			$("#extra_element_box").addClass("hidden_element");
		}
	})
	
});

/*------------------------------------------------------------------
	facebook share button
-------------------------------------------------------------------*/
function fbs_click() {
	u=location.href;
	t=document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}

/*------------------------------------------------------------------
	search on enter
-------------------------------------------------------------------*/
$(function(){
    $('input').keydown(function(e){
        if (e.keyCode == 13) {
            $(this).parents('form').submit();
            return false;
        }
    });
});
