
var prev_frame = 1
var homeSlide
var homeString = new Array()
var i
var t

function init() {
	homeSlide = document.getElementById('homeSlideHolder')
	var button1 = document.getElementById('button1')
	if (button1 != null) button1.style.backgroundPosition = 'left bottom';
	if (homeSlide) setTimeout("HomeTime()", 10000);
	
	

}

function homeslide(frame) {

	preloads = "images/seo_tn.jpg,images/product_website_website_tn.jpg,images/analytics.jpg".split(",")
	var tempImg = []

	for(var x=1;x<=preloads.length;x++) {
		tempImg[x] = new Image()
		tempImg[x].src = preloads[x]
	}

	homeString[1] = '<p><img src="images/seo_tn.jpg">A series of techniques that are implemented on and off a Website to help increase your rankings in the major Search Engines, such as Google. <a href="/seo">Learn more about SEO..</a></p>'
	homeString[2] = '<p><img src="images/product_website_website_tn.jpg">One of the many perks you obtain from CrucialClicks.com is a highly optimized website. What this means is that your site will not only be user-friendly, but search engine friendly. <a href="/website">Learn more about our websites..</a></p>'
	homeString[3] = '<p><img src="images/analytics.jpg">Google Analytics is a tool that monitors your Website and records useful statistical information. <a href="/google-analytics">Learn more about Google Analytics..</a></p>'

	document.getElementById('button'+prev_frame).style.backgroundPosition = 'left top'
	document.getElementById('button'+frame).style.backgroundPosition = 'left bottom'
	prev_frame = frame
	
	$('#homeSlideHolder').fadeOut('slow')
	setTimeout("homeSlide.innerHTML = homeString["+frame+"]", 1000)
	setTimeout("$('#homeSlideHolder').fadeIn('slow')", 1000)
	
// <div id="buttons"><a href="#" onclick="this.style.backgroundPosition = 'left bottom' ">1</a><a href="#">2</a><a href="#">3</a></div>


}


function homeslideDim(u) {
	/*
	homeSlide.style.opacity = u/100
	homeSlide.style.filter = 'alpha(opacity='+u+')'
	*/
}


function clearHomeTime() {
	clearTimeout(t);
}

function setHomeTime() {
	clearTimeout(t)
	t = setTimeout("HomeTime()", 10000)
}

function HomeTime() {
	clearTimeout(t)
	if (prev_frame == 3) { var frame = 1 } else { var frame = prev_frame+1 }
	homeslide(frame)
	t = setTimeout("HomeTime()", 10000);
}



var p

function pShow() {
clearTimeout(p)
$("#product_links").slideDown("fast");

}

function pHide() {
p = setTimeout("$('#product_links').slideUp(\"fast\")", 500)

}

var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
var marker;

function initialize() {
    var myLatlng = new google.maps.LatLng(26.27357,-80.293075);
    var myOptions = {
      zoom: 12,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
	
	directionsDisplay = new google.maps.DirectionsRenderer();
	directionsDisplay.setMap(map);
    directionsDisplay.setPanel(document.getElementById("directionsPanel"));
 
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
 
    var contentString = '<div id="content">'+
        '<b>You found our office!</b><br/><br/>CrucialClicks.com<br/>12375 W Sample Rd.<br/>Coral Springs, FL. 33065'+
        '</div>';
        
    var infowindow = new google.maps.InfoWindow({
        content: contentString
    });
 
    marker = new google.maps.Marker({
        position: myLatlng,
        map: map,
        title: 'You Found Us!'
    });
    google.maps.event.addListener(marker, 'click', function() {
      infowindow.open(map,marker);
    });
  }


function calcRoute(start) {

    var end = '12375 W Sample Rd Coral Springs FL 33065'
    var start = start;
    var request = {
        origin:start, 
        destination:end,
        travelMode: google.maps.DirectionsTravelMode.DRIVING
    };
    directionsService.route(request, function(response, status) {
      if (status == google.maps.DirectionsStatus.OK) {
	    document.getElementById("directionsPanel").innerHTML = '';
        directionsDisplay.setDirections(response);
		 directionsDisplay.setMap(map);
		 marker.setMap(null)

      }
    });
  return false;
  }
  


