function getRandomPod(){
	var tempArray = [
		'<li class="gift first"><a href=""><span>Gift</span><img src="/_images/pods/gift.jpg" alt="" /></a></li>',
		'<li class="home"><a href=""><span>Home</span><img src="/_images/pods/home.jpg" alt="" /></a></li>',
		'<li class="greetings"><a href=""><span>Greetings &amp; Stationery</span><img src="/_images/pods/greetings-and-stationery.jpg" alt="" /></a></li>',
		'<li class="jewellery first"><a href=""><span>Jewellery &amp; Fashion</span><img src="/_images/pods/jewellery-and-fashion.jpg" alt="" /></a></li>'
	];
	
	var ranNum = Math.floor(Math.random() * (tempArray.length - 0) + 0);
	$('#sideCol .pods').html('<li class="rotate"><ul><li><a href=""><img src="/_images/pods/buy-for-all-seasons.png" alt="" /></a></li><li><a href=""><img src="/_images/pods/easter-bunny.png" alt="" /></a></li><li><a href=""><img src="/_images/pods/love.png" alt="" /></a></li><li><a href=""><img src="/_images/pods/christmas-fairy.png" alt="" /></a></li><li><a href=""><img src="/_images/pods/bunting.png" alt="" /></a></li></ul></li>' + '<li class="intro"><a href=""><span>Intro North</span><img src="/_images/pods/intro-north.jpg" alt="" /></a></li>' + tempArray[ranNum])
		 
}

$(document).ready(function(){
	
	$('input').customInput();
	
	
	$('#exhibitorSlides img').qtip({
	   content: {
		  attr: 'alt'
	   },
		position: {
			my: 'bottom left',  // Position my top left...
			at: 'top center', // at the bottom right of...
			target: 'mouse'
		},
		style: {
			classes: 'ui-tooltip-dark ui-tooltip-shadow'	
		}
	   })
	
	
	$('#customVideoPlayer').flash({
		src: '/_images/flash/YoutubePlayer.swf',
		width:650,
		height: 400,
		flashvars:	{
			videoID:"yAJn3CD2atU", 
			videoQuality:"hd1080", 
			videoBackgroundColor:"0x666666",
			strokeColor:"0x999999",
			controlColor:"0x333333",
			controlHoverColor:"0xed1c24",
			defaultVol:30
		}
	});
	
	//Pods	
     getRandomPod();

	// Forms
	$('.contentForm select').selectmenu();

	// Carousels
	$("#productStack").carouFredSel({
		items: {
			visible: 1,
			width: 300,
			height: 530
		},
		scroll: {
			fx: "crossfade",
			duration: 1000
		}
	});	

	$("#exhibitorSlides").carouFredSel({
		width: 800,
		height: 120,
		items: {
			visible: 5,
			width: 160,
			height: 120
		},
		scroll: 1,
		prev: "#slideShow .controls .prev",
		next: "#slideShow .controls .next"
	});
	
	$("li.rotate ul").carouFredSel({
		width: 200,
		height: 135,
		items: {
			visible: 1
		},
		scroll: 1
	});
	
	// Register Colour
	var registerColours = ["#f4792a", "#c4d82e", "#00accd", "#f1678c", "#da1a32", "2d4245"];
	var colourPos = 0;
	
	$('#header .register .wrapper').css({ backgroundColor: registerColours[colourPos] });
	changeColour();

	function changeColour(){
		$('#header .register .wrapper').animate({ backgroundColor: registerColours[colourPos] }, 1000, function(){
			colourPos += 1;
			if (colourPos >= registerColours.length-1){
				colourPos = 0;
			}
			setTimeout(function(){changeColour();}, 2500);
		});
	}

	//Ticker	
	//$("#keyBrands .wrapper ul").liScroll({travelocity: 0.07});
	var ticker = new $.newsTicker( $('#keyBrands ul') );


	//Pop-ups
	$('ul#exhibitorSlides a').colorbox();
	$('ul.thumbnails a').colorbox();
	$('ul.seminars a').colorbox();
	
	//FAQs Accordian
	Accordian();

	// Deep Links Toggle
    $("ul.surgeries").hide();

	$("h2.surgeries").click(function (e) {
    	$(this).next('ul.surgeries').slideToggle(500);
		return false;
    });
	
	
	$('#mainLogo').bind( "mouseover", flipLogo);
	function flipLogo(){
		$(this).children('img').css({'position':'absolute'})
		$('#mainLogo').unbind( "mouseover", flipLogo);
		$(this).children('img').animate({width:'0px', height:'163px', left:'55px'}, 200);								  
		$(this).children('img').delay(200).animate({width:'101px', height:'163px', left:'5px'}, 200, function(){
			$('#mainLogo').bind( "mouseover", flipLogo);																											  
		});							
	}
	
});


function Accordian() {
	var togglers = $('.faqAccordion h2');
	var elements = ".details";

	$(elements).each(function(){
		if ($(this).parentsUntil('ul').parent().hasClass('faqAccordion')){
			$(this).hide();	
		}
	});
	
	togglers.click(
	function() {
		if ($(this).parentsUntil('ul').parent().hasClass('faqAccordion')){
			var checkElement = $(this).next();
				if((checkElement.is(elements)) && (checkElement.is(':visible'))) {
				checkElement.slideUp(500);
				return false;
			}
			if((checkElement.is(elements)) && (!checkElement.is(':visible'))) {
				$(elements).each(function(){
					if ($(this).parentsUntil('ul').parent().hasClass('faqAccordion')){
						$(this).slideUp(500);	
					}
				});
				checkElement.slideDown(500);
				return false;
			}
		}
	});
}

