/**
 *
 */
$(document).ready(function(){
	$("a[href*=\'http://\']:not([href*=\'"+location.hostname+"\'])").attr("target","_blank");
});

$(document).ready(function(){
	$("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target","_blank");
});
$(document).ready(function() {

	$(".pngfix").pngfix();

	if ($('hero')) {
		$("#hero ul").cycle({
			fx : "fade",
			speed : "slow",
			duration : 1000,
			timeout : 10000,
			pause : 1,
			random : 0,
			cleartype : 1,
			pager : "#pager",
			pauseOnPagerHover : true
		});
	}
	$("#quicksearch").defaultvalue("Enter your search here ..");
	$("#categories").accordion({
			header: ".parent",
			autoHeight: false,
			collapsible: true,
			clearStyle: true,
			active: false
		});
		$("#categories ul li:odd").addClass("odd");
		$("#categories ul li, #categories ul li.odd").hover(function(){
			$(this).addClass("hover");
		}, function(){
			$(this).removeClass("hover");
		});

	/*	$("a.inline").fancybox({
			padding:10,
			frameWidth:892,
			frameHeight:470,
			centerOnScroll:true,
			hideOnContentClick:false
		});
*/

	// Main Menu
	$.each($("#menu li ul"), function() {
		if ($("li", this).size() > 1) {
			$(this).addClass("submenu").closest("li").hover(function() {
				$("a:first", this).addClass("hover");
				$("ul", this).stop().fadeTo("fast", 0.95, function() {
					$(this).show();
				});
			}, function() {
				$("a:first", this).removeClass("hover");
				$("ul", this).stop().fadeTo("fast", 0, function() {
					$(this).hide();
				});
			});
		}
	});

});
function onBefore() {
	var el = $(this).parent();
	$('.description-container',el).animate({opacity: 0},50);
	$('.description-container',el).remove();
}

function onAfter() {
	if ($('img', this).attr("alt") !== "" && $('img', this).attr("rel") !=="") {
		var title = $('img', this).attr("alt");
		var desc = $('img',this).attr("rel");
		var lnk = $('a',this).attr("href");
		$('<a href="'+lnk+'" class="description-container"><span class="typo pngfix"><span id="description-heading" class="heading">'+title+'</span><span class="description">'+desc+'</span></span></a>').appendTo(this);
		$('.typo',this).css("opacity", 0);
		$('.typo',this).animate({opacity: 0.7},300);
		$(".heading").each( function() { FLIR.replace(this); } );
	}
}

$(document).ready(function(){
	$("ul.subnav:empty").css('display', 'none');
	var currentNav = $("ul#menu li.selected a").text();
	$("ul.subnav li:first").before('<li><a style="background:#683586;color:#fff;">' + currentNav + '</a></li>');
	$("h1.module:contains('Myer'), h1.module:contains('Target'), h1.module:contains('Coles'), h1.module:contains('Core Trading')").parent().addClass('trading-divs');
	$("h1.page-title:contains('Brand IQ')").css('display', 'none').next().css('border-top', 'none');
	$('#article-content').parent().addClass('article-full');
	$('h1.module:contains("Wheelchair,")').parent().addClass('wheelchair-mod');
	$('h1.module:contains("Customer Service Desk")').next().next().addClass('list-div');
	$('h2.module:contains("Mall Leasing")').next().find('a').attr('href', 'mailto:mallleasing@grandcentralshopping.com.au');
	$('#signupnew').attr('value', '');
	$('img[src="/image.php?libid=351&site=69"]').wrapAll('<a href="mailto:mallleasing@grandcentralshopping.com.au"></a>');

	$('a#slide-btn').click(function(){
		$('#search-div').animate({'width': 'toggle'});
	});
});

