jQuery.fn.liScroll = function(settings) {
		settings = jQuery.extend({
		travelocity: 0.08
		}, settings);		
		return this.each(function(){
				var $strip = jQuery(this);
				$strip.addClass("newsticker")
				var stripWidth = 0;
				var $mask = $strip.wrap("<div class='mask'></div>");
				var $tickercontainer = $strip.parent().wrap("<div class='tickercontainer'></div>");								
				var containerWidth = $strip.parent().parent().width();	//a.k.a. 'mask' width 	
				$strip.find("li").each(function(i){
				stripWidth += jQuery(this, i).width();
				});
				$strip.width(stripWidth);			
				var defTiming = stripWidth/settings.travelocity;
				var totalTravel = stripWidth+containerWidth;								
				function scrollnews(spazio, tempo){
				$strip.animate({left: '-='+ spazio}, tempo, "linear", function(){$strip.css("left", containerWidth); scrollnews(totalTravel, defTiming);});
				}
				scrollnews(totalTravel, defTiming);				
				$strip.hover(function(){
				jQuery(this).stop();
				},
				function(){
				var offset = jQuery(this).offset();
				var residualSpace = offset.left + stripWidth;
				var residualTime = residualSpace/settings.travelocity;
				scrollnews(residualSpace, residualTime);
				});			
		});	
};

// DOM READY
$(function() {

	//ticker
	$("ul#ticker").liScroll({travelocity: 0.05}); 

	//$("#lang-select").hide();

	//$("#language").click(function() {
		//$("#lang-select").toggle();	
		//$(this).toggleClass("border-g");
	//});

});


$(function() {
		   
	//$('input[type="text"]').addClass("text");			   
	//$('input[type="radio"]').addClass("radio");
	//$('input[type="checkbox"]').addClass("checkbox");
	//$('input[type="image"]').addClass("image");
	
	$('.listing li:nth-child(7n)').addClass("last");
	
	
	 // inside labels for inputs
	 $("input, textarea").labelify();
	
	 // home page slider
	 $('#slider1').anythingSlider({
	  buildArrows : false,
	  delay : 4000,
	  navigationFormatter : function(index, panel){
		  // Format navigation labels with text
		  return ['Product Range', 'Services', 'About Us', 'News'][index - 1];
	  }
	 });
	 
	 // Product detail options slide panel
	 $('#opts .panel .colours li:first-child').addClass("first");
	 $('#opts .panel .colours li:nth-child(9n)').addClass("last");
	 $('#opts .panel .accs li:nth-child(4n)').addClass("last");
	 
	 // ie fix, as not rendering transparent png correctly during opacity animation
	 //$('.plus-overlay').css('filter', 'alpha(opacity=50)');
	 
	 $("#opts a").hover(function() {
		$(this).next(".panel").animate({opacity: "show", left: "-309"}, "slow");
		//$(this).find('.plus-overlay').animate({opacity: "show"}, "slow");					
	 }, function() {
		$(this).next(".panel").animate({opacity: "hide", left: "-319"}, "fast");
		//$(this).find('.plus-overlay').animate({opacity: "hide"}, "fast");
		//$(this).find('.plus-overlay').hide();
	 });

	 jQuery.each(jQuery.browser, function(i) {
	 if($.browser.msie){	 
		 $("#opts a").hover(function() {
			$(this).find('.plus-overlay').show();	
						
		 }, function() {
			$(this).find('.plus-overlay').hide();
		 });
	 }else{
		 $("#opts a").hover(function() {
			$(this).find('.plus-overlay').animate({opacity: "show"}, "slow");	
						
		 }, function() {
			$(this).find('.plus-overlay').animate({opacity: "hide"}, "fast");
		 });
	 }
     });
		



});






function pageLoad() {

}
