

function jqPngFix() {
    try {
        //ie6 png transperency fix
        $.each($("img[src$=.png],img[src$=.PNG]"), function () {
            var img = $(this);
            img.css({"width": img.width(),"height": img.height(), "filter": "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img.attr("src") + "', sizingMethod='scale')"});
            img.attr("src","/images/construct/blank.gif");
        });
    } catch(e) {
        alert(e.description)
    }
}
$(document).ready(function(){

	$('#notice').hide();
	$('li.submenu').each(function(){
		var position = $(this).position();
		$(this).children('ul').css({
			'left': position.left
		});
	});
	
	$(".twitter").tweet({
	  count: 3,
	  query: "from:AldoZilli http",
	  loading_text: "searching twitter..."
	});
	$(".aldotwitter").tweet({
	  count: 6,
	  query: "from:AldoZilli http",
	  loading_text: "searching twitter..."
	});
    
	
	$(".restaurant").change(function() {
	if(this.value=='Zilli Green'){
		$('#notice').show();
	}
	else{
		$('#notice').hide();
	}
	
});

	if ($.browser.msie && $.browser.version == '6.0') {
		jqPngFix();
	}
	$('.nav li.fourth, .nav li.last').wrapInner('<span />');
	
	$('#sitesearch input[type="text"]').fadeTo('fast',0.8);
	$('#sitesearch label').hide();
	$('#sitesearch input[type="text"]').each(function() {
		$(this).attr('value',$(this).prev().html());
	});
	$('#sitesearch input[type="text"]').bind({
		focus: function() {
			$(this).fadeTo('fast',1);
			if ($(this).attr("value") == $(this).prev().html()) {
				$(this).attr("value","");
			}
		},
		blur: function() {
			$(this).fadeTo('fast',0.8);
			if (!$(this).attr("value")) {
				$(this).attr("value",$(this).prev().html());
			}
		}
	});
	
	
	$('.formRow input[type="text"], .formRow textarea').fadeTo('fast',0.5);
	$('.formRow input[type="text"], .formRow textarea').bind({
		focus: function() {
			$(this).fadeTo('fast',1);
		},
		blur: function() {
			$(this).fadeTo('fast',0.5);
		}
	});
	$('input[type="submit"]').each(function() {
		$(this).replaceWith('<p class="cta submit"><a href="#">'+$(this).attr('value')+'</a></p>');
	});
	$('p.cta.submit a').click(function() {
		$(this).parents('form').submit();
		return false;
	});
	$('.standfirst p:first, .standfirst .panel p:first-child').addClass('standfirst');
	
	$('p.video').append('<span />');
	
});
