
//Local Variable with Flash Content id. default = flashcontent
var as_swf_name = "flashContent";

var addthis_config = {
	username: 'breakaisland',
	data_ga_tracker: pageTracker
};
var addthis_share = {
	title:'Breaka Island',
	description:'Breaka Island microsite'
};
function shareIt(url_send){
	addthis_share.url = url_send;
	addthis_url = url_send;
	addthis_sendto();
}

/** 
 * Callback method used after embed is attempted
 * Event object passed in has success boolean
 **/
function swfEmbedCallback(e){
	//remove the resize event handler from the window
	$(window).unbind('resize');
	
    if(e.success){
         // show the flash holder
        jQuery('#loadingDiv').fadeOut("fast", showFlash);
    }else{
		jQuery("#loadingDiv").fadeOut("fast", showAltContent);
    }
}
function showFlash(){
	jQuery('#flashContent').css('display', 'block');
}


// shows the alternate content or the flash expressInstall
function showAltContent(){
    if (swfobject.hasFlashPlayerVersion("6.0.65")) {
      // has Flash - can show the expressInstall
      jQuery('#flashContent').fadeIn("fast");
    }else {
      // no Flash - show html alt content
        jQuery('#altContent').fadeIn("fast");
    }
}

// resize handler to make sure the loading graphic is in the right place
function resizeHandler(e){
	$('#loadingDiv').css("top", ($(window).height() - $('#loadingDiv').height()) * 0.5 - 222);
  	$('#loadingDiv').css("left", ($(window).width() - $('#loadingDiv').width()) * 0.5 - 24);
}

function initJQuery(){
	if(typeof jQuery !== 'undefined') {  
		jQuery(document).ready(function(){
			$('#loadingDiv').css("top", ($(window).height() - $('#loadingDiv').height()) * 0.5 - 222);
			$('#loadingDiv').css("left", ($(window).width() - $('#loadingDiv').width()) * 0.5 - 24);
			
			jQuery('#flashContent').hide();
			
			$(window).resize(resizeHandler);
		});
	}else{
        setTimeout('initJQuery()',100);
	}
};
/////////////////////////////////////////////////////////////////////////////////////////////////
// FOCUS METHODS
/////////////////////////////////////////////////////////////////////////////////////////////////


//Method to dispatch an Event to Flash
function flashCallBack ( func ) {
  if( arguments.length > 1 ){
    document[as_swf_name][func]( Array.prototype.slice.call(arguments).slice(1)[0]);
  }else{
    document[as_swf_name][func]();
  }
}
