var film = new Array(".scrn",".cine",".prod",".advscrn");
var theater = new Array(".acting",".dramlit",".musical");
var f_classes = new Array(".c-130A",".c-130B",".c-135",".c-184",".c-C147",".c-188E");
var t_classes= new Array(".c-120A",".c-106",".c-120B",".c-110");
var orig = "";

var A_FILM = 1;
var A_THEATER = 2;
var T_CLASS = 3;
var F_CLASS = 4;

$(document).ready(function(){
//swfobject.embedSWF("classes8.swf", "classes", "659", "534", "8.0.0");

	$("a[href^='http']").attr("target","_blank");
	
	if ((navigator.appVersion.indexOf("Win")!=-1) && ($.browser.mozilla)) {
		$("#mybutton").css("position","relative").css("top","1px");
		$("#login #login-classes").css("bottom","16px");
	}
	else if ((navigator.appVersion.indexOf("Mac")!=-1) && ($.browser.safari)) {
		$("#mybutton").css("position","relative").css("bottom","2px");
	       	}

	$("#mybutton").click(function(event){
		event.preventDefault();
			$.ajax({
			method: "post",url: "mailinglist.php", data: "emailSubmit="+$("#emailSubmit").val(),
			success: function(html){ 
				$("#status").html(html);
				$("#emailSubmit").val("");
			
}
 }); //close $.ajax(
		
	});


	$("#film-online .schedule div.boxset a").hover(function(){
		action(A_FILM,$(this), true);
},function(){
		action(A_FILM,$(this), false);
});

	$("#theater-online .schedule div.boxset a").hover(function(){
		action(A_THEATER,$(this), true);
},function(){
		action(A_THEATER,$(this), false);
});

	$("#theater-online .breakdown ul li a").hover(function(){
		action(T_CLASS,$(this), true);
},function(){
		action(T_CLASS,$(this), false);
});

	$("#film-online .breakdown ul li a").hover(function(){
		action(F_CLASS,$(this), true);
},function(){
		action(F_CLASS,$(this), false);
});

      $("div.boxset a[class^='select-'],#login-classes span a").toggle(function(event) {
	  event.preventDefault();
	  
	  
	  }, function(event){
	      event.preventDefault();

	  });

      $("#login-classes div a").hover(function(){
	      orig = $("#login span#swap").html();
	      
	      if ($(this).attr("name") == "A") {
	      $("#login span#swap").html("<i>Session A begins June 21st</i>");
	      }
	      else {
	      $("#login span#swap").html("<i>Session C begins August 2nd</i>");
	      }


},function(){
	      var text = "";
	      if (orig != ""){
		  text = orig;
	      }
	      else {
		  text = "Choose course to enter Class Website";
	      }

  $("#login span#swap").html(text);
});
 
    
}); // ready

function action(chooser,obj,hoveron) {
	  var type = obj.attr("class").split("-")[1];
	  var remove = -1;
	  var secondaction = false;

	  if (chooser == A_FILM) {
	   var  myarray = film.slice();
	  }
	  else if (chooser == A_THEATER) {
	    var  myarray = theater.slice();
	  }
	  else if (chooser == T_CLASS) {
	      var myarray = t_classes.slice();
	      type = "c-" + type;
	      secondaction = true;
	  }
	  else { // class
	     var  myarray = f_classes.slice();
	     type = "c-" + type; // jquery classname
	     secondaction = true;


	  }

	  type = "." + type;

	      for(var i=0;i<myarray.length;i++) {
		  
		  if (myarray[i] == type) {
		      remove = i;
		  }
		 
	      }

	      var highlight = myarray[remove];
	      myarray.splice(remove,1);
	      var finallist = myarray.join(",");

	      if (hoveron) {
		  $(".schedule ul li").stop(true).css("opacity","1.0");
		  if (!secondaction) {
		      $(finallist).animate({opacity: 0.0}, 600);
		  }
		  else {
		       $(finallist).animate({opacity: 0.0}, 1000);
		  }
		  $(highlight).css({'color':'#7FBAF5'});
		  $(highlight+" span").css({'color':'#efac2a'});
		  


	      }
	      else {
  		  $(".schedule ul li").stop(true).css("text-decoration","none").css("opacity","1.0");
 		  $(highlight).css({'color':'gray','font-weight':'normal'});
  		  $(highlight+" span").css({'color':'#7fbaf5'});

	      }
	      
      }

