$(function () {
	
$('#tiles').each(function() {
	$('a', this).attr({target: "_blank"});
});

// Font Size

$('#text-size').html('<span class="txt-smal">&#x391;</span><span class="txt-med">&#x391;</span><span class="txt-larg">&#x391;</span>');
$('.txt-smal').click(function () {
    $('#content-area, #slideshow-left').animate({'font-size':'100%'});
  });
  $('.txt-med').click(function () {
    $('#content-area, #slideshow-left').animate({'font-size':'115%'});
  });
  $('.txt-larg').click(function () {
    $('#content-area, #slideshow-left').animate({'font-size':'130%'});
  });


// RSS Feed

//  $('#ticker').rssfeed('http://bookkeeperderby.wordpress.com/feed/',{limit:3});
  $('#ticker').rssfeed('http://feeds.bbci.co.uk/news/health/rss.xml',{}, function(e) { $(e).find('div.rssBody').vTicker({ showItems:2}); });
});

// Scroll to top

$(function() {
$('a[href=#top]').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});
});

// Top nav dropdown 


$(function() {
$(".menu-header ul li").css("overflow","hidden");
$(".menu-header ul li").mouseover(function () {
    $(this).css("overflow","visible");
  });
  $("#top-nav ul li").mouseleave(function () {
    $(this).css("overflow","hidden");
  });
});


//Slideshow

$(function() {
	$('.slide-buttons').append('<div class="prev"><div class="arrow-left"></div></div><div class="next"><div class="arrow-right"></div></div>');
		   
    $('.slideshow').cycle({
		timeout:5000,
		speed:2000,
		prev:    '.prev',
        next:    '.next',
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, blindX, blindY, blindZ, cover, curtainX, curtainY, fade, fadeZoom, growX, growY, none, scrollUp, scrollDown, scrollLeft, scrollRight, scrollHorz, scrollVert, shuffle, slideX, slideY, toss, turnUp, turnDown, turnLeft, turnRight, uncover, wipe, zoom, http://jquery.malsup.com/cycle/options.html

	});
	$('.slide-banner').cycle({
		timeout:5000,
		speed:2000,
		prev:    '.prev',
        next:    '.next',
		fx: 'scrollHorz' // choose your transition type, ex: fade, scrollUp, shuffle, blindX, blindY, blindZ, cover, curtainX, curtainY, fade, fadeZoom, growX, growY, none, scrollUp, scrollDown, scrollLeft, scrollRight, scrollHorz, scrollVert, shuffle, slideX, slideY, toss, turnUp, turnDown, turnLeft, turnRight, uncover, wipe, zoom, http://jquery.malsup.com/cycle/options.html

	});
	
	$('.pause').cycle({
	}).cycle('pause');
	
	$('.slideshow, .slide-banner').hover(
        function() { $('.hide').fadeIn(); },
        function() { $('.hide').fadeOut(); }
    );
});

// Show/hide tiles sidebar

$(function() {
$("#hide-show").show();
$("#show").hide();
$("#tiles").animate({width: '120px'});

$("#hide").click(function() {
$("#tiles").animate({width: '10px'});
$("#hide").hide();
$("#show").show();
});
$("#show").click(function() {
$("#tiles").animate({width: '120px'});
$("#show").hide();
$("#hide").show();
});
});

// NHS Widget

$(function () { 
 $('#element').fsNHSWidget([3,2,4]);
 
 $('#about-element').html('<div id="about-element-but"><a><img src="wp-content/themes/Template-three-blue/img/nhs-about.gif" /></a></div><div id="about-element-txt">Find Services widget created by <a href="http://www.nhs.uk/Pages/HomePage.aspx" target="_blank">NHS Choices</a>. For further information regarding privacy, see our <a href="http://www.nhs.uk/aboutNHSChoices/aboutnhschoices/termsandconditions/Pages/Privacypolicy.aspx" target="_blank">Privacy Policy</a>. For further information regarding syndication, please contact <a href="mailto:nhssyndication@dh.gsi.gov.uk">NHS Choices Syndication Team.</a></div>');
$("#about-element-but").hover(function() {
$("#about-element-txt").toggle();
});

$("#element a").click(function() {
$("#about-element-txt").hide();
});

$("#element button").click(function() {
$("#about-element-txt").hide();
});

$("#about-element-txt").hover(function() {
$("#about-element-txt").toggle();
});

});


(function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();


$(function() {

  $(".lightbox").fancybox();
  $(".youtube").fancybox({
    'width' : 680,
    'height' : 495,
    'autoScale' : false,
    'transitionIn' : 'none',
    'transitionOut' : 'none',
    'type' : 'iframe'
  });


  $('#text-size, .txt-smal, .txt-med, .txt-larg').hover(function() {
    $('.font-pop').show();
  });

  $('#text-size').mouseout(function() {
    $('.font-pop').hide();
  });
  
});	 

$(function() {
// Google Translate
$('#google-flags a').each(function() {
   var page = window.location;
   var flag = $(this).attr('rel');
   target="_blank" 
  
   var delang="English";if("en"==flag)var lang="English";"fr"==flag&&(lang="French");"af"==flag&&(lang="Afrikaans");"sq"==flag&&(lang="Albanian");"ar"==flag&&(lang="Arabic");"be"==flag&&(lang="Belarusian");"bg"==flag&&(lang="Bulgarian");"ca"==flag&&(lang="Catalan");"zh-CN"==flag&&(lang="Chinese (Simplified)");"zh-TW"==flag&&(lang="Chinese (Traditional)");"hr"==flag&&(lang="Croatian");"cs"==flag&&(lang="Czech");"da"==flag&&(lang="Danish");"nl"==flag&&(lang="Dutch");"et"==flag&&(lang="Estonian"); "tl"==flag&&(lang="Filipino");"fi"==flag&&(lang="Finnish");"fr"==flag&&(lang="French");"gl"==flag&&(lang="Galician");"de"==flag&&(lang="German");"el"==flag&&(lang="Greek");"ht"==flag&&(lang="Haitian Creole");"iw"==flag&&(lang="Hebrew");"hi"==flag&&(lang="Hindi");"hu"==flag&&(lang="Hungarian");"is"==flag&&(lang="Icelandic");"id"==flag&&(lang="Indonesian");"ga"==flag&&(lang="Irish");"it"==flag&&(lang="Italian");"ja"==flag&&(lang="Japanese");"ko"==flag&&(lang="Korean");"lv"==flag&&(lang="Latvian"); "lt"==flag&&(lang="Lithuanian");"mk"==flag&&(lang="Macedonian");"ms"==flag&&(lang="Malay");"mt"==flag&&(lang="Maltese");"no"==flag&&(lang="Norwegian");"fa"==flag&&(lang="Persian");"pl"==flag&&(lang="Polish");"pt"==flag&&(lang="Portuguese");"ro"==flag&&(lang="Romanian");"ru"==flag&&(lang="Russian");"sr"==flag&&(lang="Serbian");"sk"==flag&&(lang="Slovak");"sl"==flag&&(lang="Slovenian");"es"==flag&&(lang="Spanish");"sw"==flag&&(lang="Swahili");"sv"==flag&&(lang="Swedish");"th"==flag&&(lang="Thai"); "tr"==flag&&(lang="Turkish");"uk"==flag&&(lang="Ukrainian");"vi"==flag&&(lang="Vietnamese");"cy"==flag&&(lang="Welsh");"yi"==flag&&(lang="Yiddish");
  
   $(this).append('<img alt="'+lang+'" src="img/flags/'+flag+'.gif" />');
   $(this).attr('href', 'http://www.google.com/translate_c?hl=en&langpair=en%7C'+flag+'&u='+page+'');
   $(this).attr('title', 'Google Translate '+delang+' to '+lang+''); 
   $(this).attr('target','_blank');
 });
 
 $('#google-flags').prepend('<div style="background:url(img/flags/google.png) no-repeat 0 0; text-align:right; width:94px; height:20px; float:left; margin-top:5px; font-size:10px;">Translate</div>');
 $('#sml-flags').hide();
 
 $('#google-flags').mouseover(function() {
   $('#sml-flags').fadeIn();
 });
 
 $('#google-flags').mouseleave(function() {
   $('#sml-flags').fadeOut();
 });

});



