$(document).ready(function() {

        

	// Watermark date fields
    $(".prompt").focus(function(srcc) {
        if ($(this).val() == $(this)[0].title) {
            $(this).removeClass("promptActive");
            $(this).val("");
        }
    });
 
    $(".prompt").change(function(srcc) {
        if ($(this).val() != $(this)[0].title) {
            $(this).removeClass("promptActive");
        }
    });
 
    $(".prompt").blur(function() {
        if ($(this).val() == "") {
            $(this).addClass("promptActive");
            $(this).val($(this)[0].title);
        }
    });
    
    $('#search-input').val("");
    
    $('#search-input').keypress(function(e){
     
      if(e.which == 13)
      {
      	
      	searchVal = $('#search-input').val();
        if(searchVal != "Search" && searchVal != "")
        {
        	window.location.href = "/search/?q="+escape(searchVal);
        }
       }
        
      });
    
    $("#search-input").blur();
    
    setupHeader();
    
 
	// Setup Polls
    $("#poll-submit").click(function() {
    
        $.ajax({type: "POST",
     		 data: $('#poll-form-vote').serialize(),
        	 beforeSend: function(XMLHttpRequest) {
        	 	$("#poll-ajax").show();
        	 },
        	 success: function(data, textStatus) {
                $('#home-poll').html(data);
               
            }, 
        	error: function (XMLHttpRequest, textStatus, errorThrown) {
  				$("#poll-ajax").hide();
			},
			 url: "/polls/vote/"    
      });

    });
    
    // google map
    
    $("#eventMapBig").each(function () {
    
    	loadMap();
    
    }); 

});

function viewLink(url)
{
	window.location.href = url;
}

function setCurrentPage(page)
{		
	window.document["nav_home_2010"].SetVariable("currentPage", page);
	document.nav_home_2010.SetVariable("currentPage", page);
}


function countryChanged(element)
{
	document.forms['dealerSearchForm'].submit();
}


var currentOffset = 0; 



function showGalleryImage(imgURL)
{
	viewDiv = document.getElementById("eventGalleryView");
	
	if (viewDiv)
	{
		viewDiv.innerHTML = "<img src='/img/events/photos/"+imgURL+"' />"
	}
}


