/// <reference path="google.maps-v3-vsdoc.js" />
//When the DOM tree is loaded
$(document).ready(function() {
	$('#topMenu a')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0 -250px)"}, {duration:500})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:500})
		})

	$('#tabs').tabs({ fxFade: true, fxSpeed: 'fast' });

// for <select> navigations
$(".selectMenu").change( function() {
    window.location.href = $(this).val();
});



$(".productBox p").css("display","none");

$(".productBox").hover(function(){
$(this).children("p").fadeIn(500);
},function(){
$(this).children("p").fadeOut(500);
});



$('#notification').fadeIn('slow', function() {
	setTimeout(function () { $("#notification").fadeOut(3000) }, 10000);
});
			






    $("#subContainer").css("min-height",$(window).height() - 180 + "px"); 

    $("#primary").css("min-height",$(window).height() - 180 + "px"); 
});



function setMarkers(map, locations) {
    // Add markers to the map

    // Marker sizes are expressed as a Size of X,Y
    // where the origin of the image (0,0) is located
    // in the top left of the image.

    // Origins, anchor positions and coordinates of the marker
    // increase in the X direction to the right and in
    // the Y direction down.
    var image = new google.maps.MarkerImage('http://google-maps-icons.googlecode.com/files/convenience.png',
    // This marker is 20 pixels wide by 32 pixels tall.
      new google.maps.Size(40, 40),
    // The origin for this image is 0,0.
      new google.maps.Point(0, 0),
    // The anchor for this image is the base of the flagpole at 0,32.
      new google.maps.Point(0, 32));
    var shadow = new google.maps.MarkerImage('http://google-maps-icons.googlecode.com/files/shadow.png',
    // The shadow image is larger in the horizontal dimension
    // while the position and offset are the same as for the main image.
      new google.maps.Size(37, 32),
      new google.maps.Point(0, 0),
      new google.maps.Point(0, 32));
    // Shapes define the clickable region of the icon.
    // The type defines an HTML <area> element 'poly' which
    // traces out a polygon as a series of X,Y points. The final
    // coordinate closes the poly by connecting to the first
    // coordinate.
    var shape = {
        coord: [1, 1, 1, 20, 18, 20, 18, 1],
        type: 'poly'
    };
    for (var i = 0; i < locations.length; i++) {
        var beach = locations[i];
        var myLatLng = new google.maps.LatLng(beach[1], beach[2]);
        var marker = new google.maps.Marker({
            position: myLatLng,
            map: map,
            shadow: shadow,
            icon: image,
            shape: shape,
            title: beach[0],
            zIndex: beach[3]
        });
    }
}



function codeAddress(address) {
    var geocoder = new google.maps.Geocoder();
    if (geocoder) {
        geocoder.geocode({ 'address': address }, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
        
            return results[0].geometry.location;
            
        } else {
            alert("Geocode was not successful for the following reason: " + status);
        }
        });
    }
}