
function bannerSwitch() {
    var $active = $('#offer p.active');

    if ( $active.length == 0 ) $active = $('#offer p:last');

    // use this to pull the paragraphs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#offer p:first');

    // uncomment the 3 lines below to pull the banners in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "bannerSwitch()", 5000 );
});





function loadmap() {
    			var markLatlng = new google.maps.LatLng(-39.037841, 174.163243);
				var centreLatlng = new google.maps.LatLng(-39.03378617163027, 174.15390014648438);
    			var myOptions = {
      			zoom: 14,
      			center: centreLatlng,
     			 mapTypeId: google.maps.MapTypeId.ROADMAP
    			}
    			
				var map = new google.maps.Map(document.getElementById("map"), myOptions);
				var image = './images/marker.png';				
				
	 			var marker = new google.maps.Marker({
      			position: markLatlng, 
      			map: map,
				icon: image
  				});
  				}




$(document).ready(function(){
						   
						   
	// ADD BANNER CONTENT	
	$.get('./offers.html', function(data){
					$('#offer').html(data);
					});
	
	
	// MENU
				
	$(".sub").css({opacity: "0.9", display:"none"});
	

	//slide up and down

	$("#nav li").hover(function() {
	  $(this).find(".sub").stop(true, true).slideDown({duration: 'fast'}).animate({opacity: "0.9"});
	}, 
	
	function() {
	  $(this).find(".sub").slideUp({duration: 'slow'}).animate({opacity: "0.6"});
	});
	
	//original stay active
	
	$(".sub").hover(function() {
	  $(this).parent().addClass('menuhover');
	}, 
	
	function() {
	  $(this).parent().removeClass();
	});
	
	

//BROWSER SPCIFIC TO STOP SHIT NON-ANTIALIASED IE OPACITY


	var browserName=navigator.appName; 
 	
	if (browserName=="Microsoft Internet Explorer")
 				{ 
				
				// PRODUCT BOXES
					
					$(".productbox").hover(function() {
					  $(this).find("span.animated").animate({width: "205px", opacity: "1"});  
					}, 
					
					function() {
					  $(this).find("span.animated").animate({width: "100px", opacity: "0"});
					});
				
 				}
 	else
  				{
					
					// PRODUCT BOXES
					
					$(".productbox").hover(function() {
					  $(this).find("span.animated").animate({width: "205px", opacity: "1", zIndex: "4"});  
					   $(this).find("span.still").animate({zIndex: "3"});
					}, 
					
					function() {
					  $(this).find("span.animated").animate({width: "100px", opacity: "0" , zIndex: "3"});
					  $(this).find("span.still").animate({zIndex: "4"});
					});
					
					
					
					// OLD OFFER SCRIPT
    				
					/*
					$("#offer strong").css({opacity: "0"});
					$("#offer a").css({opacity: "0"});
					$("#offer em").css({opacity: "0"}); 

					$("#offer strong").delay(400).animate({opacity: "1"}, 1500);
					$("#offer a").delay(1000).animate({opacity: "1"}, 1500);
					$("#offer em").delay(2500).animate({opacity: "1"}, 800);
		
					//repeating offer blinks
	
					$( "#offer strong") .everyTime ( 5000, function (){
					$("#offer strong") .animate ({opacity: "0.3"}, 400 ).animate ({opacity: "1"}, 370 );
					});
					$( "#offer a") .everyTime ( 4000, function (){
					$("#offer a") .animate ({opacity: "0.3"}, 400 ).animate ({opacity: "1"}, 370 );
					});
					*/
										
					
					
   				}
	

});





