/* Author: Matt Jurgemeyer

*/


/* Initiate the home page slider */
$(document).ready(function(){ $('#slider-code').tinycarousel(); });

/* Set Cufon font replacement rules*/
Cufon.replace('#home h1', { fontFamily: 'DIN-Light' });
Cufon.replace('#picker h3', { fontFamily: 'DIN-Light' });
Cufon.replace('nav .label', { fontFamily: 'DIN-Light' });
Cufon.replace('#intro h1', { fontFamily: 'Egypt' });
Cufon.replace('#intro h2', { fontFamily: 'Dincaps' });
Cufon.replace('#main h2', { fontFamily: 'Dincaps' });
Cufon.replace('#started h3', { fontFamily: 'DIN-Light' });

/* Set lightbox operations for Colorbox plugin*/
$(document).ready(function(){
	//Examples of how to assign the ColorBox event to elements
	$(".videopop").colorbox({iframe:true, innerWidth:540, innerHeight:328});
});

/* Add Map to Get Started Page */
function initialize() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(39.772213, -104.982498), 13);

    var myIcon = new GIcon(G_DEFAULT_ICON);
    myIcon.image = "/img/my_custom_icon.png";
    myIcon.iconSize = new GSize(32, 39);
    myIcon.shadow = "/img/my_custom_icon_shadow.png";
    myIcon.shadowSize = new GSize(53, 42);
    myIcon.iconAnchor = new GPoint(10, 29);
    myIcon.infoWindowAnchor = new GPoint(10, 14);
    myIcon.printImage = "/img/my_custom_icon_print.gif";
    myIcon.mozPrintImage = "/img/my_custom_icon_mozPrint.gif";
    myIcon.printShadow = "/img/my_custom_icon_printShadow.gif";
    myIcon.transparent = "/img/my_custom_icon_transparent.png";
    myIcon.imageMap = [ 10,29, 1,16, 0,5, 5,0, 12,4, 18,2, 21,12, 21,16 ]; 
    
    var markerOptions = { icon:myIcon };
    
    var marker = new GMarker(map.getCenter(), markerOptions);
    GEvent.addListener(marker, "click", function () {
      marker.openInfoWindowHtml("Achoo! Media<br/>3457 Ringsby Court, #304<br/>Denver, CO 80216");
    });
    map.addOverlay(marker);
  }
}

/*Check for support of html5 placeholder text*/
jQuery(function() {
   jQuery.support.placeholder = false;
   test = document.createElement('input');
   if('placeholder' in test) jQuery.support.placeholder = true;
});
// This adds placeholder support to browsers that wouldn't otherwise support it. 
$(function() {
   if(!$.support.placeholder) { 
      var active = document.activeElement;
      $(':text').focus(function () {
         if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
            $(this).val('').removeClass('hasPlaceholder');
         }
      }).blur(function () {
         if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
            $(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
         }
      });
      $(':text').blur();
      $(active).focus();
      $('form:eq(0)').submit(function () {
         $(':text.hasPlaceholder').val('');
      });
   }
});





