if ( $.browser.msie && $.browser.version <=6 ) { 
$(document).ready(function(){  
alert("this version of internet explorer is not supported. please update your current web browser");
self.close();
});
}
else if ( $.browser.msie && $.browser.version <9 ) { 
$(document).ready(function(){  

var curr = new Date();
var liveRacing = new Date("May 03, 2011");

if(curr > liveRacing) {
$("#slider_reel").css('background-image','url(images/image_1.png)');
}
else{
$("#slider_reel").css('background-image','url(images/image_race.png)');
}

$("body").show();
$("#about_section, #contact_section").hide();
$("#welcome_banner, #index_section, #slider_reel").show();
$("#slide_counter").hide();
$("#index_sub").css("width" , 960);
$(".dates").css("margin-left" , 50);
$("#other_browser_text p").hide();

$('a.home_btn').click(function(){
	$("#about_section, #contact_section").hide();
	$("#index_section").show();
	$('a.about_btn,.contact_btn').css('color','#999999');
	$('a.home_btn').css('color','white');
});

$('.about_btn').click(function(){
	$("#index_section, #contact_section").hide();
	$("#about_section").show();
	$('a.home_btn,.contact_btn').css('color','#999999');
	$('a.about_btn').css('color','white');
});


$('.contact_btn').click(function(){
	$("#index_section, #about_section").hide();
	$("#contact_section").show();
	$('a.home_btn,.about_btn').css('color','#999999');
	$('a.contact_btn').css('color','white');
	initialize();
});



function initialize() {
  	var myLatlng = new google.maps.LatLng(39.457005,-74.64519);
  	var markCent = new google.maps.LatLng(39.452495, -74.647082);
  	var myOptions = {
  	zoom: 15,
  	center: myLatlng,
  	mapTypeId: google.maps.MapTypeId.HYBRID
	}

	var map = new google.maps.Map(document.getElementById("map_holder"), myOptions);

	var contentString = '<div class="info_window">'+
    '<h4>Atlantic City Race Course</h4>'+
	'<p class="info_space">4501 Black Horse Pike<br/> Mays Landing, NJ 08330-3142</p>'+
	'<a href="http://maps.google.com/maps?hl=en&sugexp=ldymls&xhr=t&cp=17&bav=on.2,or.r_gc.r_pw.&um=1&ie=UTF-8&q=atlantic+city+race+course&fb=1&gl=us&hq=race+course&hnear=Atlantic+City,+NJ&cid=0,0,9384661		424062219369&ei=mpOtTcW1D4bG0QGMzPG7Cw&sa=X&oi=local_result&ct=image&resnum=2&sqi=2&ved=0CCgQnwIwAQ">directions</a>'
	'</div>';

	var infowindow = new google.maps.InfoWindow({
    content: contentString
	});

	var marker = new google.maps.Marker({
    position: markCent,
    map: map,
    title:"Atlantic City Race Course"
	});

	infowindow.open(map,marker);

	google.maps.event.addListener(marker, 'click', function() {
  	infowindow.open(map,marker);
	});

  
  	};




});
} 
else { 
$(document).ready(function(){    
$("body").show();
checkPage();
var i = 1 
var time = 10000
var speed = 800
var storedHash = document.location.hash;
imageOne();

$("#index_section, #about_section, #contact_section, #logo_holder, #live_race_btn, #nav_holder, #footer_contain, .break, .break_bottom").hide();
$('a.home_btn, .low_link_h').css('color','white');
$("#ie_text p,#ie_text").hide();

function openingFadeMain(){
setTimeout(function() {$("#logo_holder").fadeIn(1000)},1000);
setTimeout(function() {$("#nav_holder").fadeIn(1000)},1200);
setTimeout(function() {$("#index_section,.break, .break_bottom").fadeIn(1000)},1500);
setTimeout(function() {$("#footer_contain").fadeIn(1000)},2200);
setTimeout(function() {$("#welcome_banner").hide().fadeIn(1000)},2500);
setTimeout(function() {$("#live_race_btn").fadeIn(1000)},3000);
};

function openingFadeElse(){
setTimeout(function() {$("#logo_holder,.break, .break_bottom").fadeIn(1000)},1000);
setTimeout(function() {$("#nav_holder").fadeIn(1000)},1200);
setTimeout(function() {$("#footer_contain").fadeIn(1000)},2200);

};

setInterval(function() {nextSlide()}, time);

$('#slide_counter').addClass("counter_1");		
	

$('a.home_btn, .low_link_h').click(function(){
	homeSection();
});

$('.about_btn, .low_link_a').click(function(){
	aboutSection();
});


$('.contact_btn, .low_link_c').click(function(){
	contactSection();
});



// home section functions
function homeSection(){
	fadeBanner();
	$('a.about_btn,.contact_btn, .low_link_a, .low_link_c').css('color','#999999');
	$('a.home_btn, .low_link_h').css('color','white');
	$("#about_section, #contact_section").hide();
	$("#index_section").fadeIn(1000);
	GUnload();
};

// about section functions
function aboutSection(){
	$("#welcome_banner, #live_race_btn").css('display','none');
	$('a.home_btn,.contact_btn, .low_link_h, .low_link_c').css('color','#999999');
	$('a.about_btn, .low_link_a').css('color','white');
	$("#index_section, #contact_section").hide();
	$("#about_section").fadeIn(1000);
	GUnload();
};

// contact section functions
function contactSection(){
	//alert(loc);
	$("#welcome_banner, #live_race_btn").css('display','none');
	$('a.home_btn,.about_btn, .low_link_h, .low_link_a').css('color','#999999');
	$('a.contact_btn, .low_link_c').css('color','white');
	$("#index_section,#about_section").hide();
	$("#contact_section").fadeIn(1000);
	initialize();
};


// banner fade in
function fadeBanner(){
	setTimeout(function() {$("#welcome_banner").fadeIn(1000)},800);
	setTimeout(function() {$("#live_race_btn").fadeIn(1000)},1200);
};


// check url hash function 
function checkPage(){
	var h= window.location.hash;
	if(h == "#about"){
		setTimeout(function() {aboutSection()},1000);
		openingFadeElse();
		$("#welcome_banner").css('display','none');
	}
	else if(h == "#contact"){
		setTimeout(function() {contactSection()},1000);
		openingFadeElse();
		$("#welcome_banner").css('display','none');
	}
	else{
		var fadeOpen = openingFadeMain();	
	}	
};


function imageOne(){
	$("#slider_reel").fadeOut();
	var curr = new Date();
	var liveRacing = new Date("May 03, 2011");

	function checkPromo(){
		if(curr > liveRacing) {
     $("#slider_reel").css('background-image','url(images/image_1.png)');
	}
	else{
	 $("#slider_reel").css('background-image','url(images/image_race.png)');
	}
	};
	
	setTimeout(function(){checkPromo()},500);
	setTimeout(function() {$("#slider_reel").fadeIn(1500)},500);
	setTimeout(function(){$("#slide_counter").css('background-image','url(images/counter_1.png)')},500);
};

function imageTwo(){
	$("#slider_reel").fadeOut();
	setTimeout(function(){$("#slider_reel").css('background-image','url(images/image_2.png)')},500);
	setTimeout(function() {$("#slider_reel").fadeIn(1500)},500);
	setTimeout(function(){$("#slide_counter").css('background-image','url(images/counter_2.png)')},500);
};

function imageThree(){
	$("#slider_reel").fadeOut();
	setTimeout(function(){$("#slider_reel").css('background-image','url(images/image_3.png)')},500);
	setTimeout(function() {$("#slider_reel").fadeIn(1500)},500);
	setTimeout(function(){$("#slide_counter").css('background-image','url(images/counter_3.png)')},500);
};

function initialize() {
  	var myLatlng = new google.maps.LatLng(39.457005,-74.64519);
  	var markCent = new google.maps.LatLng(39.452495, -74.647082);
  	var myOptions = {
  	zoom: 15,
  	center: myLatlng,
  	mapTypeId: google.maps.MapTypeId.HYBRID
	}

	var map = new google.maps.Map(document.getElementById("map_holder"), myOptions);

	var contentString = '<div class="info_window">'+
    '<h4>Atlantic City Race Course</h4>'+
	'<p class="info_space">4501 Black Horse Pike<br/> Mays Landing, NJ 08330-3142</p>'+
	'<a href="http://maps.google.com/maps?hl=en&sugexp=ldymls&xhr=t&cp=17&bav=on.2,or.r_gc.r_pw.&um=1&ie=UTF-8&q=atlantic+city+race+course&fb=1&gl=us&hq=race+course&hnear=Atlantic+City,+NJ&cid=0,0,9384661		424062219369&ei=mpOtTcW1D4bG0QGMzPG7Cw&sa=X&oi=local_result&ct=image&resnum=2&sqi=2&ved=0CCgQnwIwAQ">directions</a>'
	'</div>';

	var infowindow = new google.maps.InfoWindow({
    content: contentString
	});

	var marker = new google.maps.Marker({
    position: markCent,
    map: map,
    title:"Atlantic City Race Course"
	});

	infowindow.open(map,marker);

	google.maps.event.addListener(marker, 'click', function() {
  	infowindow.open(map,marker);
	});

  
  	}


// slider
function nextSlide(){
if(i<=3){
i++
switch(i)
	   	
			{
				case 1:
				imageOne();
				break;
				
				case 2:
				imageTwo();
				break;
				
				case 3:
				imageThree();
				i=0;
				break;
				
				
			}

}
};



});
}
