// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

$(function(){
	$('#admincarousel').jcarousel();
	$('#mycarousel li').css('visibility', 'visible')
	$f("player", "/swf/flowplayer-3.0.7.swf", { 
    clip: conf.clip,
	plugins: {
		controls: conf.skins.normal
	},
	canvas: conf.canvas,
	screen: conf.screen
    });
    $("#overlayButton").overlay({
      onBeforeLoad: function() {
		$f().hide().pause();
		this.getBackgroundImage().expose({color: "#000000"});
	  },  
      onClose: function() {
		$f().show().resume();
		$("#info").hide();
		$.expose.close();
	  } 
    });
	$('#twitterFeedsButton').overlay({
	  onBeforeLoad: function() {
	    $f().hide().pause();
		this.getBackgroundImage().expose({color: "#000000"});
	  },	
	  onClose: function() {
		$f().show().resume();
		$("#info").hide();
		$.expose.close();
	  }
	});
    $("#feed").tweet({
      username: "carneyUGVC",
      join_text: "auto",
      avatar_size: 50,
      count: 1,
      auto_join_text_default: "",
      auto_join_text_ed: "",
      auto_join_text_ing: "",
      auto_join_text_reply: "",
      auto_join_text_url: "",
      loading_text: "loading..."
    });
	$("#twitterOverlayInner").tweet({
	  username: "carneyUGVC",
	  join_text: "auto",
	  avatar_size: 0,
	  count: 10,
	  auto_join_text_default: "",
	  auto_join_text_ed: "",
	  auto_join_text_ing: "",
	  auto_join_text_reply: "",
	  auto_join_text_url: "",
	  loading_text: "loading..."
	});
	$("#shareForm").submit(function(e) {
      var form = $(this);
	  form.fadeTo(500, 0.1);
	  $.getJSON(form.attr("action") + "?" + form.serialize() + "&format=json&jsoncallback=?", function(json) {
		form.fadeTo(500, 1);
		var info = $("#info").show();
		if (json.message) {
		  info.addClass("alert").html(json.message);			
		} 
		else {
		  info.removeClass("alert").addClass("info").html("Email was successfully sent");
		} 
	  });	
      e.preventDefault();
	  return false;		
	});
	$("#embedPane textarea").html($f().embed().getEmbedCode());
	$("#shareTabs").tabs("#panes > div");
});
