$(document).ready(function() {
	// jQuery Corners
	$('.corners-top').corner("6px top");
	$('.corners').corner("6px");
	$('.corners-bot').corner("6px bottom");
	$('a[rel="corners"]').corner("6px top");
	$('body').append("<div id='news-feed-temp-au'/>");
	$('body').append("<div id='news-feed-temp-nz'/>");
	// Html includes
	$('#news-feed-temp-au').load('http://www.pernod-ricard-pacific.com/news-proxy.php?country=au .main-col p:not(".intro"):lt(5)', function() { 
		$('#news-feed-temp-au p').each(
			function() {
				$('#news-feed-au').append('<div class="news-item"><p class="news-feed-date">' + $("span.date", this).text() + '</p><p><a href="'+$("a", this).attr("href")+'" class="feed-link">'+ $("a", this).text() +'</a></p><ul class="more-link"><li><a href="'+$("a", this).attr("href")+'">MORE</a></li></ul></div>');
			}
		)
		 // this is the DOM element
		$('#news-feed-temp-au').remove();
	});
	$('#news-feed-temp-nz').load('http://www.pernod-ricard-pacific.com/news-proxy.php?country=nz .main-col p:not(".intro"):lt(5)', function() { 
		$('#news-feed-temp-nz p').each(
			function() {
				$('#news-feed-nz').append('<div class="news-item"><p class="news-feed-date">' + $("span.date", this).text() + '</p><p><a href="'+$("a", this).attr("href")+'" class="feed-link">'+ $("a", this).text() +'</a></p><ul class="more-link"><li><a href="'+$("a", this).attr("href")+'">MORE</a></li></ul></div>');
			}
		)
		 // this is the DOM element
		$('#news-feed-temp-nz').remove();
	});

	function showcaseCycle() {
		$('#showcase-internal').cycle({
			fx: 'fade',
			timeout: 12000,
			random: true
		});
	}
	function recipeCycle() {
		$('#recipe-internal').cycle({
			fx: 'fade',
			timeout: 15000,
			random: true
		});
	}
	
	// Heros
	// Half
	$('#inc-company-half').load('/company/half.html');
	
	// Full
	$('#inc-people-full').load('/people/full.html');
	$('#inc-company-full').load('/company/full.html');
	
	// Showcase
	$('#inc-showcase').load('/showcase.html', showcaseCycle);
	
	// Showcase
	$('#inc-recipes').load('/recipes.html', recipeCycle);
	
	$('.input-site-search').each(function() {
		var default_value = this.value;
		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = '';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
			}
		});
	})
	$('a[href^="http://www.seek.com.au"]')
		.attr({
			target: "_blank"
	});
});