function mouseOver()
{
	document.body.style.cursor = 'pointer';
}

function mouseOut()
{
	document.body.style.cursor = 'default';
}

function brandOver(key)
{
	$('#brand'+key).css('background-image', 'url(\'/images/template/brandTabBGO.gif\')');
	$('#brandNavRO'+key).fadeIn(200);
}

function brandOut(key)
{
	$('#brand'+key).css('background-image', 'url(\'/images/template/brandTabBG.gif\')');
	$('#brandNavRO'+key).fadeOut(200);
}

function initialize(whichMap, lat, long, zoomLevel) {
	var latlng = new google.maps.LatLng(lat, long);
    
    
    if(whichMap == 'full')
    {
    	var myOptions = {
      	zoom: 11,
      	center: latlng,
      	mapTypeId: google.maps.MapTypeId.ROADMAP
    	};
    	var fullmap = new google.maps.Map(document.getElementById("mapContainer"),
        myOptions);    
    }
    else if(whichMap == 'details')
    {
    	
    	var myOptions = {
			      zoom: zoomLevel,
			      center: latlng,
			      mapTypeId: google.maps.MapTypeId.HYBRID
			    };    
  
	    var map = new google.maps.Map(document.getElementById("mapDetailsContainer"),
	    myOptions);
    	
	    var latlng = new google.maps.LatLng(lat, long);
	    
	    var infowindow = new google.maps.InfoWindow();
	    
	    var marker = new google.maps.Marker({
			position: new google.maps.LatLng(lat, long),
			map: map,
			title: "Upcoming Kiko Auction"
		});
	    
    }
    else
    {
		var myOptions = {
			      zoom: 9,
			      center: latlng,
			      mapTypeId: google.maps.MapTypeId.ROADMAP
			    };    
    
	    var map = new google.maps.Map(document.getElementById("mapSearchContainer"),
	    myOptions);
			
	    getListingsQuery = '';
		
		$.ajax({
		type: "POST",
		url: "/content/auctions/ajaxAuctions.php",
		data: getListingsQuery,
			
			success: function(position){
				//alert(position);
				
				var x = eval('(' + position + ')');
				
				var latlng = new google.maps.LatLng(40.827191, -81.403769);
			    
			    
				var locations = new Array;
				var infowindow = new google.maps.InfoWindow();
				
				
				$.each(x, function(index, itemData){
				if(itemData.lat != 0)
				{		
					
					var marker = new google.maps.Marker({
						position: new google.maps.LatLng(itemData.lat, itemData.log),
						map: map,
						title: "Upcoming Kiko Auction"
					});
					
					google.maps.event.addListener(marker, 'click', (function(marker, index) {
				        return function() {
				          infowindow.setContent('<div style="height: 150px;"><div style="text-align: center;font-weight: bold; font-size: 10pt;">'+itemData.eventDate+'</div><div style="text-align: center; font-size: 8pt; color: red;">'+itemData.desc+'</div><div style="text-align: center;"><img src="'+itemData.photo+'" width="75"></div><div style="text-align: center; font-size: 9pt; color: red; font-weight: bold;">'+itemData.eventTime+'</div><div style="text-align: center;font-size: 9pt;">'+itemData.address+'</div></div>');
				          infowindow.open(map, marker);
				        }
				      })(marker, index));
				      
				}
				
				}); 
			}
		});
        
         var myLatlng = new google.maps.LatLng(40.8657950, -81.3942610);
         
				var marker = new google.maps.Marker({
        		position: myLatlng, 
        		map: map,
        		title:"Upcoming Kiko Auction"
        		});
	}
}

function bannerRotation(bannerArray)
{
	
	var slideshowSpeed = 5000;
	var currentZindex = 100;
	var activeContainer = 1;  
	var currentImg = -1;
	var animating = false;
	
	var currentContainer = activeContainer;
	   
	if(activeContainer == 1) 
	{
		activeContainer = 2;
	} 
	else 
	{
		activeContainer = 1;
	}
	
	var navigate = function(direction) {
		
		   // Check if no animation is running. If it is, prevent the action
		   if(animating) 
		   {
		     return;
		   }
		  
		   // Check which current image we need to show
	      currentImg++;
	      
	      //alert(currentImg);
	      
	      if(currentImg == bannerArray.length) 
	      {
	         currentImg = 0;
	      }
	     
		  
		   // Check which container we need to use
		   var currentContainer = activeContainer;
		   if(activeContainer == 1) 
		   {
		      activeContainer = 2;
		   }
		   else
		   {
		      activeContainer = 1;
		   }
		   
		   showImage(bannerArray[currentImg], currentContainer, activeContainer);
		  
	};
		
	var showImage = function(photoObject, currentContainer, activeContainer) 
	{
		
	    animating = true;
	   
	    // Make sure the new container is always on the background
	    currentZindex--;
	    // Set the background image of the new active container
	       
	    $("#pictureduri")
	        .attr("href", photoObject.url)
	        .html(photoObject.title);
	       
	    // Fade out the current container
	    // and display the header text when animation is complete
	    $("#bannerimg" + activeContainer).fadeOut(function() 
	    {
	        setTimeout(function()
	        {
	            animating = false;
	            
	            $("#bannerimg" + activeContainer).css(
        	    {
        	    	"z-index" : currentZindex-1,
        	    	"display" : "block",
        	    	"background-image" : "url(" + photoObject.image + ")",
        	    });
	            
	        }, 500);
	    });
	    
	};
	
	
	var interval = setInterval(function() 
	{
		navigate("next");
	}, slideshowSpeed);
}

