
jQuery(document).ready(function() 
{
//*********************************************************************************************************

rotatePics();

$('.leftPara h3').click(function(e) {
var bool = $(this).next().is(':visible');
e.stopPropagation();
if(!bool)
{

 $(this)
.parent().find('>div:visible')
//.animate({'height':'toggle'}, 'slow', 'easeOutBounce');
.slideToggle();
}

$(this).next()
//.animate({'height':'toggle'}, 'slow', 'easeOutBounce');
.slideToggle();

});


$('a.lightbox').click(function(e){
$('body').css('overflow-y', 'hidden');
$('<div id="overlay"></div>')
.css('top', $(document).scrollTop())
.css('opacity', '0')
.animate({'opacity': '0.7'},'fast')
.appendTo('body');

$('<div id="pop"></div>')
.appendTo('body')
.delay('1000')
.hide()
.fadeIn('slow');

var top = (jQuery(window).height() - jQuery('#pop').height())/2;
var left = (jQuery(window).width() - jQuery('#pop').width())/2;
jQuery('#pop').css({
	'top': top + $(document).scrollTop(),
	'left':left
	});
if ($(this).attr('id') == "pop1")
{
$('#pop').html('<h2>2010 - 2011 Presentation Night</h2> <p>Maesteg Quins celebrated an extremely successful season at their annual Presentation Night at their Talbot Street headquarters.</p><p>Guests included newly promoted Bridgend coach and former Ospreys flanker Steve Tandy, former Wales, Maesteg and Bridgend hooker Wayne Hall and newly capped Welsh prop Ryan Bevington.</p>After such a great season, the selections for the various awards were difficult  and protracted, but the awards went as follows:<p>Clubman of the Year was awarded to Tyrone Pritchard whose efforts both on and off the field have been exceptional.</p>')
.append('<p>Recipient of the 2nd XV Player of the Year award went from the &#8216;Biggest Loser&#8217; to the biggest winner, as prop forward Lee Powell lifted the cup.</p><p>Talented scrum-half Rhys Bevan was delighted to receive the Most Promising Player of the Year for his excellent performances throughout the season.</p><p>Players&#8217; Player of the Year went to someone who has come on leaps and bounds within a year and despite the closeness of the voting, proved a popular choice. Richard Teesdale scooped the prize.</p>')
.append('<p>The Conrad Hawes Cup for Player of the Year was a tough decision as there were so many players who could have received it. The decision went in favour of influential scrum-half Lee Ronan who has been an exceptional presence throughout the season.</p><p>Well done to all the award winners.</p>');
$('#pop').prepend('<img src="images/closelabel.gif" height="22" width="66"id="closePop">');
}
if($(this).attr('id') == "pop2")
{
$('#pop').html('<h2>Quins History</h2><p>Not many people know that a match report in 1901 tells of a match between Maesteg and MAESTEG QUINS.</p><p>We are far older than people believe.</p><p>Are you interested in history?</p><p>Do you have time to spare?</p><p>Would you like to play your part in researching the history of Maesteg Harlequins RFC?</p><p>Would you like to play your part in helping to write the history of Maesteg Harlequins RFC?</p><p>We need a team to tackle the research.</p>')
.append('<p>The work has already started – help finish it.  The more who help – the quicker it’s done.</p><p>A meeting of like minded individuals to be arranged for early August 2011.</p><p>IF INTERESTED SEE DAI BERRY ASAP</p>');
$('#pop').prepend('<img src="images/closelabel.gif" height="22" width="66"id="closePop">');
}
if($(this).attr('id') == "pop3")
{
$('#pop').html('<h2>Cerddin Brewery New Quins Kit Sponsors</h2><img src="images/cerddinBig1.gif" width="198" height="220" alt="Quins Sponsor logo" hspace="5" align="left">Founded in 2010, the Cerddin Brewery re-established brewing in the Llynfi valley after a lapse of over a century.Uniquely, it is the only ‘green’ brewery in Wales and is the only brewery in the borough.<br>Entrepreneurial owner and landlord of the Cross Inn David Morgan, eyed a gap in the market for quality cask ales and has achieved his goal of producing such a product. His ales incorporate the Welsh language and local historical twists in their titles include Maiden Ale, Cwrw Dai, Cwrw Tri and Cascade. At the launch of Cascade at the Cardiff Beer Festival, Morgan sold out of his product selling  gallons in a matter of hours.<br>')
.append('Maesteg Quins Chairman Robert Williams is delighted at the prospect of donning the Cerddin Brewery logo for the coming season. “The Cross Inn is already a magnificent supporter of Maesteg Quins. To gain the support of a burgeoning local business in the Cerddin Brewery is a tremendous boost to our club. “We are proud that as a local team, we have been chosen to promote the brand of a groundbreaking local business. It takes a great deal of bravery as well as hard work to start up a business in these difficult times.')
.append('Therefore the duty and responsibility Maesteg Quins has to the investment made by the Cerddin Brewery brand is a great one, but as Llynfi men it is a task we will carry with pride throughout our travels across Wales.Williams continued, “If we perform half as well as the Cerddin Brewery we will have a successful season.”Additionally the Quins are immensely grateful to their other sponsors, without whom, rugby would be impossible to sustain');
$('#pop').prepend('<img src="images/closelabel.gif" height="22" width="66"id="closePop">');
}

if($(this).attr('id') == "pop4")
{
$('#pop').html('<h2>Quins veteran Peter Jenkins with son Lloyd</h2><img src="images/PeterLloydJ.gif" height="435" width="450" alt="Quins veteran Peter Jenkins with son Lloyd" style="display:block; margin-left:auto; margin-right:auto">');
$('#pop').prepend('<img src="images/closelabel.gif" height="22" width="66"id="closePop">');
}


$('#closePop').click(function(){
$('#overlay ,#pop').fadeOut('slow', function(){
$('#overlay, #pop').remove();
$('body').css('overflow-y', 'auto');
});
});

e.preventDefault();
});

$('#sponsorHolding img:not(:first)').hide();

$('#sponsor-info li').click(function(e) {

    $('#sponsorHolding img').hide();

    $('#sponsor-info .current').removeClass("current");

    $(this).addClass('current');

    

    var clicked = $(this).find('a:first').attr('href');

    $('#sponsorHolding ' + clicked).fadeIn('fast');

	

    e.preventDefault();

  }).eq(0).addClass('current');


//************************************close jq**************************************************
});// ready function close
function rotatePics() {
var current = $('#photos .show');
var next = current.next().length? current.next() : current.parent().children(':first');
current.hide().removeClass('show');
next.fadeIn().addClass('show');
setTimeout(rotatePics,4000);
}

