var all_movies = Array();
var movieWidth = 320;
var movieHeight = 255;
/* begin Page */
function playAll() {

       var marginLeft = (480 - movieWidth) / 3;

       $("#movie").css('width', movieWidth);
       $("#movie").css('height', movieHeight);

       marginLeft = 0;

       var txt =  '<object style="margin-left: ' + marginLeft + 'px" width="' + movieWidth + '" height="' + movieHeight +'" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B">';

       txt +=  ' <param value="' + all_movies[0] + '" name="src">';
       txt +=  ' <param value="true" name="controller">';
       txt +=  ' <param value="true" name="autoplay">';

	for(i = 1; i < all_movies.length; i++) {
		txt += ' <param name="qtnext' + i + '" value = "&lt;' + all_movies[i] + '&gt;T&lt;myself&gt;"';
	}

         txt += ' <embed autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download/" width="' + movieWidth + '" height="' + movieHeight +'" src="' + all_movies[0] + '"';
	 for(i = 1; i < all_movies.length; i++) {
		txt += ' qtnext' + i + '="&lt;' + all_movies[i] + '&gt;T&lt;myself&gt;"';
	 }
         txt += '></embed></object>';         
	
        $("#movie").html(txt);

	$.fancybox({
		'padding'		: 0,
		'autoScale'	: false,
		'transitionIn'	: 'none',
		'transitionOut'	: 'none',
		'title'			: this.title,
		'href'			: '#movie',
		'type'		: 'inline',
		'onStart'		: function(){$("#movie").show()},
		'onClosed'		: function(){$("#movie").hide()},
		'onCancel'		: function(){$("#movie").hide()}
	});

}

$(document).ready(function(){


     $("#videos a").css("opacity", "0.8");

     $("#videos a").hover(function() {
	 $("#videos").append("<div id='subtitle'>" + $(this).find("img").attr('alt') + "</div>");
         $(this).animate({opacity: "1"}, 400);
     }, function() {
         $("#subtitle").remove();
         $(this).animate({opacity: "0.8"}, 400);
     });

	$("#movie").hide();

     $("#videos a").click(function() {
         var movie_url = $(this).attr('href');
         var size = $(this).find("img").attr('rel');
	 var mWidth = 320;
	 var mHeight = 255;

	 if(size.length == 7) {
             mWidth = size.substr(0, 3);
             mHeight = size.substr(4, 3);
         }

         var marginLeft = (480 - mWidth) / 3;
	$("#movie").css('width',mWidth);
	$("#movie").css('height',mHeight);
         $("#movie").html(
          '<object width="' + mWidth + '" height="' + mHeight + '" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"><param value="' + movie_url + '" name="src"><embed autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download/" width="' + mWidth + '" height="' + mHeight + '" src="' + movie_url + '"></embed></object>'
         );
	$.fancybox({
		'padding'		: 0,
		'autoScale'		: false,
		'transitionIn'	: 'none',
		'transitionOut'	: 'none',
		'title'			: this.title,
		'href'			: '#movie',
		'type'			: 'inline',
		'onStart'		: function(){$("#movie").show()},
		'onClosed'		: function(){$("#movie").hide()},
		'onCancel'		: function(){$("#movie").hide()}
	});
         return false;
     });

     if($("#right-content h1").length > 0) {
	var name = $("#right-content h1").text();
	if(name == 'Janie Bryant') {
		if($("#videos a").length == 0) {
			var text = $.trim($("#default_text").val());
			if(text != undefined && text != null && text.length > 0) {
				$("#videos").html(text);
			}
		}
	}
     }


     if($("#videos a").length > 0) {
        $("#videos a").each(function() {
            all_movies[all_movies.length] = $(this).attr('href');

         var size = $(this).find("img").attr('rel');

	 if(size.length == 7) {
             var mWidth = size.substr(0, 3);
             var mHeight = size.substr(4, 3);
	     if(movieWidth < mWidth) {
		movieWidth = mWidth;
             }
	     if(movieHeight < mHeight) {
		movieHeight = mHeight;
             }
         }

        });
	$("#videos").append("<div id='play_all_button'><a href='javascript:playAll()'>PLAY ALL</a></div>");
     }

     var effectDuration = 200;

     var roster_is_shown = false;
     var allow_to_hide = true;

     $(".letter_f.R").click(function() {
	allow_to_hide = false;	
     });

     $(".letter_f.R").hover(function() {

	if(roster_is_shown == true) {
		$("#home-roster-content").fadeIn(500);
		return;
	}
	roster_is_shown = true;
	$("#home-roster-content").css("visibility", "inherit").css("display", "none").fadeIn(500);

     }, function() {

	if(allow_to_hide) {
		$("#home-roster-content").fadeOut(500);	
	}

     });


     $(".letter_f.A").hover(function() {
          $(".Sheet").append("<div id='subheader' class='about'>About Us</div>");
	  $("#subheader").css("display", "none").fadeIn(500);
     }, function() {
          $("#subheader").remove();
     });

     $(".letter_f.N").hover(function() {
          $(".Sheet").append("<div id='subheader' class='news'>News</div>");
	  $("#subheader").css("display", "none").fadeIn(500);
     }, function() {
          $("#subheader").remove();
     });

     $(".letter_f.T").hover(function() {
          $(".Sheet").append("<div id='subheader' class='touch'>Touch</div>");
	  $("#subheader").css("display", "none").fadeIn(500);
     }, function() {
          $("#subheader").remove();
     });

     $(".letter_f.R").click(function() {
	return false;
     });

     $(".column.directors-photography").show(1000);
     $(".column.production-designers").show(1000);
     $(".column.costume-designers").show(1000);


     $(".letter_f.R").fadeIn(effectDuration, function() {

     $(".letter_f.A").fadeIn(effectDuration, function() {

     $(".letter_f.D").fadeIn(effectDuration, function() {

        var bird_src = $(".bird img").attr("src");
        bird_src = bird_src.substr(bird_src, bird_src.length - 3) + "png";
        var image = new Image();
	image.src = bird_src;

        $(".bird").css("display", "block").css("opacity", 0).animate({opacity: 1, bottom: "138px", left: "267px"}, 2000, 'easeOutCubic', function() {
		var bird_src = $(".bird img").attr("src");
		bird_src = bird_src.substr(bird_src, bird_src.length - 3) + "png";
		$(".bird img").attr("src", bird_src);	
		$(".bird").css({opacity: 1, bottom: "149px", left: "282px"});	
	});

     $(".letter_f.I").fadeIn(effectDuration, function() {

     $(".letter_f.A2").fadeIn(effectDuration, function() {

     $(".letter_f.N").fadeIn(effectDuration, function() {

     $(".letter_f.T").fadeIn(effectDuration, function() {

       if(!$.browser.msie) {
            $(".letter_f a").hover(
                function() {
                     $(this).animate({opacity: "0.7"}, 400);
                },
                function() {
                     $(this).animate({opacity: "1"}, 400);
                }
             );
        }

     });

     });

     });

     });

     });

     });

     });

});


/* Generated with Artisteer version 2.1.0.16090, file checksum is 9FE3778F. */


var artEventHelper = {
  'bind' : function (obj, evt, fn) {
    if (obj.addEventListener)
      obj.addEventListener(evt, fn, false);
    else if (obj.attachEvent)
      obj.attachEvent('on' + evt, fn);
    else
      obj['on' + evt] = fn;
  }
};

var artLoadEvent = (function() {
  var userAgent = navigator.userAgent.toLowerCase();
  var browser = {
    version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
    safari: /webkit/.test(userAgent),
    opera: /opera/.test(userAgent),
    msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
    mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
  };

  var list = [];

  var done = false;
  var ready = function () {
    if (done) return;
    done = true;
    for (var i = 0; i < list.length; i++)
      list[i]();
  };
  
  if (document.addEventListener && !browser.opera)
    document.addEventListener('DOMContentLoaded', ready, false);
  
  if (browser.msie && window == top) {
    (function () {
      try {
        document.documentElement.doScroll('left');
      } catch (e) {
        setTimeout(arguments.callee, 10);
        return;
      }
      ready();
    })();
  }
  
  if (browser.opera) {
    document.addEventListener('DOMContentLoaded', function () {
      for (var i = 0; i < document.styleSheets.length; i++) {
        if (document.styleSheets[i].disabled) {
          setTimeout(arguments.callee, 10);
          return;
        }
      }
      ready();
    }, false);
  }
  
  if (browser.safari) {
    var numStyles;
    (function(){
      if (document.readyState != 'loaded' && document.readyState != 'complete') {
        setTimeout(arguments.callee, 10);
        return;
      }
      if ('undefined' == typeof numStyles) {
        numStyles = document.getElementsByTagName('style').length;
        var links = document.getElementsByTagName('link');
        for (var i = 0; i < links.length; i++) {
          numStyles += (links[i].getAttribute('rel') == 'stylesheet') ? 1 : 0;
        }
        if (document.styleSheets.length != numStyles) {
          setTimeout(arguments.callee, 0);
          return;
        }
      }
      ready();
    })();
  }

  artEventHelper.bind(window, 'load', ready);

  return ({
    add: function(f) {
      list.push(f);
    }
  })
})();

(function () {
  // fix ie blinking
  var m = document.uniqueID && document.compatMode && !window.XMLHttpRequest && document.execCommand;
  try{ if(!!m) { m("BackgroundImageCache", false, true); } }
  catch(oh){};
})();

function xGetElementsByClassName(clsName, parentEle, tagName) {
  var elements = null;
  var found = [];
  var slash = String.fromCharCode(92);
  var re = new RegExp(slash + "b" + clsName + slash + "b");
  if (!parentEle) parentEle = document;
  if (!tagName) tagName = '*';
  elements = parentEle.getElementsByTagName(tagName);
  if (elements) {
    for (var i = 0; i < elements.length; ++i) {
      if (elements[i].className.search(re) != -1) {
        found[found.length] = elements[i];
      }
    }
  }
  return found;
}

var styleUrlCached = null;
function GetStyleUrl() {
  if (null == styleUrlCached) {
    var ns;
    styleUrlCached = '';
    ns = document.getElementsByTagName('link');
    for (var i = 0; i < ns.length; i++) {
      var l = ns[i];
      if (l.href && /style\.css(\?.*)?$/.test(l.href)){
        return styleUrlCached = l.href.replace(/style\.css(\?.*)?$/,'');
      }
    }
    
    ns = document.getElementsByTagName('style');
    for (var i = 0; i < ns.length; i++) {
      var matches = new RegExp('import\\s+"([^"]+\\/)style\\.css"').exec(ns[i].innerHTML);
      if (null != matches && matches.length > 0)
        return styleUrlCached = matches[1];
    }
  }
  return styleUrlCached;
}


function artButtonSetupJsHover(btn)
{
    artEventHelper.bind(btn, 'mouseover', function() {
        var spans = btn.getElementsByTagName("span");
        if (spans.length > 0)
            spans[0].className += " hover";
    });
    artEventHelper.bind(btn, 'mouseout', function() {
        var spans = btn.getElementsByTagName("span");
        if (spans.length > 0)
            spans[0].className = spans[0].className.replace(/hover/, "").replace(/active/, "");
    });
    artEventHelper.bind(btn, 'mousedown', function() {
        var spans = btn.getElementsByTagName("span");
        if (spans.length > 0)
            spans[0].className += " active";
    });
    artEventHelper.bind(btn, 'mouseup', function() {
        var spans = btn.getElementsByTagName("span");
        if (spans.length > 0)
            spans[0].className = spans[0].className.replace(/active/, "");
    });
}

function artButtonsSetupJsHover() {
  var elements = xGetElementsByClassName("btn", document, "span");
  for (var i = 0; i < elements.length; i++) {
    if (!elements[i].tagName) continue;
    artButtonSetupJsHover(elements[i].parentNode);
  }
}
artLoadEvent.add(artButtonsSetupJsHover);

/* end Page */

/* begin Menu */
function Insert_Separators()
{
  var menus = xGetElementsByClassName("artmenu", document);
  for (var i = 0; i < menus.length; i++) {
    var menu = menus[i];
    var childs = menu.childNodes;
    var listItems = [];
    for (var j = 0; j < childs.length; j++){
      var el = childs[j];
      if (String(el.tagName).toLowerCase() == "li")listItems.push(el);
    }
    for (var j = 0; j < listItems.length - 1; j++){
      var span = document.createElement('span');
      span.className = 'separator';
      var li = document.createElement('li');
      li.appendChild(span);
      listItems[j].parentNode.insertBefore(li, listItems[j].nextSibling);
    }
  }
}
artLoadEvent.add(Insert_Separators);

function Menu_IE6Setup() {
  var isIE6 = navigator.userAgent.toLowerCase().indexOf("msie") != -1 
    && navigator.userAgent.toLowerCase().indexOf("msie 7") == -1;
  if (!isIE6) return;
  var aTmp2, i, j, oLI, aUL, aA;
  var aTmp = xGetElementsByClassName("artmenu", document, "ul");
  for (i=0;i<aTmp.length;i++) {
    aTmp2 = aTmp[i].getElementsByTagName("li");
    for (j=0;j<aTmp2.length;j++) {
      oLI = aTmp2[j];
      aUL = oLI.getElementsByTagName("ul");
      if (aUL && aUL.length) {
        oLI.UL = aUL[0];
        aA = oLI.getElementsByTagName("a");
        if (aA && aA.length)
        	oLI.A = aA[0];
         oLI.onmouseenter = function() {
         	this.className += " artmenuhover";
         	this.UL.className += " artmenuhoverUL";
         	if (this.A) this.A.className += " artmenuhoverA";
         };
        oLI.onmouseleave = function() {
          this.className = this.className.replace(/artmenuhover/,"");
          this.UL.className = this.UL.className.replace(/artmenuhoverUL/,"");
          if (this.A) this.A.className = this.A.className.replace(/artmenuhoverA/, "");
        };
      }
    }
  }
}
artLoadEvent.add(Menu_IE6Setup);
/* end Menu */


