// JavaScript Document
 $(document).ready(function(){
							
		//dirty hack for scrolling logos in webkit browsers - right to left doesnt work so it now goes ltr, firefox and IE (Surprisingly) are fine 
		 if($.browser.webkit){
						 
			$('#carousel-supplier').jcarousel({
				scroll: 1,								  
				auto: 2,
				wrap: 'circular',
				rtl: false
			});
		
			
   		}else{
			$('#carousel-supplier').jcarousel({
				scroll: 1,								  
				auto: 2,
				wrap: 'circular',
				rtl: true
			});
   		}
		

		$('#carousel-member').jcarousel({
			scroll: 1,								  
			auto: 2,
			wrap: 'circular',
			rtl: false
		});
		
		//IE PNG fix
		$('body').supersleight({shim: './images/x.gif'});


		//Hero slider
		$('#hero').nivoSlider({
			effect:'sliceDown',
			slices:15,
			animSpeed:750,
			pauseTime:8000,
			startSlide:0, //Set starting Slide (0 index)
			controlNav:false,
			pauseOnHover:true
		}); 
		
		
		$('#mini-hero').nivoSlider({
			effect:'fold',
			slices:15,
			animSpeed:500,
			pauseTime:5000,
			startSlide:0, //Set starting Slide (0 index)
			controlNav:false,
			pauseOnHover:true
		}); 
		
	
		//scrolly supplier list
		$('#listholder').css('overflow', 'hidden');
		
		//Background colour and text colour, mouseover and mouseout
		var colorOver = '#FFDF00';
		var colorOut = '#888888';
		
		var textOver = '#333333';
		var textOut = '#dddddd';

		//Padding, mouseover
		var padLeft = '25px';
		var padRight = '25px';
		
		//Default Padding
		var defpadLeft = $('#list li a').css('paddingLeft');
		var defpadRight = $('#list li a').css('paddingRight');
			
		//Animate the LI on mouse over, mouse out
		$('#list li').click(function () {	
			//Make LI clickable
			window.location = $(this).find('a').attr('href');
			
		}).mouseover(function (){
			
			//mouse over LI and look for A element for transition
			$(this).find('a')
			.animate( { paddingLeft: padLeft, paddingRight: padRight}, { queue:false, duration:100 } )
			.animate( { backgroundColor: colorOver }, { queue:false, duration:200 })
			.animate( { color: textOver }, { queue:false, duration:200 });
	
		}).mouseout(function () {
		
			//mouse oout LI and look for A element and discard the mouse over transition
			$(this).find('a')
			.animate( { paddingLeft: defpadLeft, paddingRight: defpadRight}, { queue:false, duration:100 } )
			.animate( { backgroundColor: colorOut }, { queue:false, duration:200 })
			.animate( { color: textOut }, { queue:false, duration:200 });
		});	
		
		//Scroll the menu on mouse move above the #listholder layer
		$('#listholder').mousemove(function(e) {
	
			//listholder Offset, Top value
			var s_top = parseInt($('#listholder').offset().top);		
			
			//listholder Offset, Bottom value
			var s_bottom = parseInt($('#listholder').height() + s_top);
		
			//Roughly calculate the height of the list by multiply height of a single LI with the total of LIs
			var mheight = parseInt($('#list li').height() * $('#list li').length);
		
			//I used this coordinate and offset values for debuggin
			$('#debugging_mouse_axis').html("X Axis : " + e.pageX + " | Y Axis " + e.pageY);
			$('#debugging_status').html(Math.round(((s_top - e.pageY)/100) * mheight / 2));
				
			//Calculate the top value
			//This equation is not the perfect, but it 's very close	
			var top_value = Math.round(( (s_top - e.pageY) /100) * mheight / 2);
			
			//Animate the #list by chaging the top value
			$('#list').animate({top: top_value}, { queue:false, duration:5000}); //old duration:500
		});

		

}); 

function confirmSubmit()
{
var agree=confirm("Are you sure you wish to delete the whole thread? ");
if (agree)
	return true ;
else
	return false ;
}
 function confirmSubmit2()
{
var agree=confirm("Are you sure you wish to replace this with a strike out message?");
if (agree)
	return true ;
else
	return false ;
}
