//<![CDATA[
window.fbAsyncInit = function() {
	FB.init({appId: '146202712090395', status: true, cookie: true, xfbml: true});
	FB.Event.subscribe('edge.create', function(response) {
		AND.Omniture.logCL({
			link: response,
			props: {
				linkTrackVars: 'prop4,prop34,eVar32',
				prop4: 'facebook-like',
				prop34: 'facebook-like 2050207',
				eVar32: 'facebook-like 2050207'
			}
		});
	});
};
(function() {
	var div = document.createElement('div');
	div.setAttribute('id', 'fb-root');
	$('body').append(div);
	
	var e = document.createElement('script'); e.async = true;
	e.src = document.location.protocol +
	'//connect.facebook.net/en_GB/all.js#xfbml=1';
	document.getElementById('fb-root').appendChild(e);
}());

$(function() {
    //modify width/height values the bottom-teaser colTwo grayscale image to match to those of rgb image.
    var rgbWidth = $("div.bottom-teaser div.stories.colTwo.post div.article.news img.rgb").attr("width");
    var rgbHeight = $("div.bottom-teaser div.stories.colTwo.post div.article.news img.rgb").attr("height");
    $("div.bottom-teaser div.stories.colTwo.post div.article.news img.grayscale").attr("width", rgbWidth);
    $("div.bottom-teaser div.stories.colTwo.post div.article.news img.grayscale").attr("height", rgbHeight);

    //image rollover/fading effect on teasers
    $("div.stories div.article.page3Teaser").mouseover(function() {
        $(this).find("img.grayscale").stop().animate({ opacity: 0.0 }, {queue: false, duration: 'fast'});
		$(this).addClass("hover_it");
		$(this).find("h3").css("color","#cc3333");
    });
    $("div.stories div.article.page3Teaser").mouseout(function() {
        $(this).find("img.grayscale").stop().animate({ opacity: 1.0 }, {queue: false, duration: 'fast'});
		$(this).find("h3").css("color","#333");
		$(this).removeClass("hover_it");
    });

    //terms & conditions in a new pop-up window
    var url = $("div#footer_nav li:first").children().attr("href");
    $("div#footer_nav li:first").children().attr("href", "javascript:void(0);");
    $("div#footer_nav li:first").children().click(function() {
        window.open(url, "_blank", "channelmode=0,directories=0,fullscreen=0,height=" + screen.height + ",left=0,location=1,menubar=0,resizable=0,scrollbars=1,status=1,titlebar=1,toolbar=0,top=0,width=" + screen.width / 2);
    });
});
//]]>
