var DUR = 1.5;
var S_DUR = 1;
var _widths = [720, 720, 720, 720, 640, 640, 640];
var _heights = [405, 405, 480, 480, 360, 360, 360];
var _filenames = ['arroyo-final-colorandsound-web.mov', 'cs.mov', 'darjeeling.mov', 'mmd.mov', 'Taekwondo-Master-1-web.mov', 'Kissing-Master-1-web.mov', 'Camping-Master-1-web.mov'];

function s() {
new Effect.Opacity('films',{from: 0.9999, to: 1.0, duration:0});
}

function sBio(b) {
 if (this.bEffect) return;
// sContact(1);
 if ($('bio').className == 'i' && !b) {
   $('bio').className = '';
   $('films_player').innerHTML = '';
//   new Effect.Opacity('films', {from: 1.0, to: 0.0, duration: DUR});
   this.bEffect = new Effect.Opacity('bio', {from: 0.0, to: 1.0, duration: DUR});
//   setTimeout('$("films").className = "i"',DUR*1000 + 10);
   sFilm($('bio_link'));
   setTimeout('this.bEffect=null;if(this.gfId){sFilm(this.gfId);gFilm(this.gfId);}',DUR*1000 + 10);
   return false;
 } else {
//   $('films').className = '';
   this.bEffect = new Effect.Opacity('bio', {from: 1.0, to: 0.0, duration: (b ? DUR/2 : DUR)});
//   new Effect.Opacity('films', {from: 0.0, to: 1.0, duration: DUR});
   if (!b) sFilm($('bio_link'));
   setTimeout('$("bio").className = "i"',(b ? DUR/2:DUR)*1000 + 10);
   setTimeout('this.bEffect=null;if(this.gfId){sFilm(this.gfId);gFilm(this.gfId);}',(b?DUR/2:DUR)*1000 + 10);
   return true;
 }
}
function sWork() {
 if (this.wEffect) return false;
 var b = $('commercial_films_list').className == 'i';
 var s1 = (b ? '' : 'non') + 'commercial_films_list';
 var s2 = (b ? 'non' : '') + 'commercial_films_list';
 var l1 = (b ? '' : 'non') + 'commercial_link';
 var l2 = (b ? 'non' : '') + 'commercial_link';
 var cText = (b ? 'non-' : '') + 'commercial work';
 $(s1).className = '';
 $(l2).className = '';
 this.wEffect = new Effect.Opacity(s2, {from: 1.0, to: 0.0, duration: DUR});
 new Effect.Opacity(s1, {from: 0.0, to: 1.0, duration: DUR});
 new Effect.Opacity(l1, {from: 1.0, to: 0.0, duration: DUR});
 new Effect.Opacity(l2, {from: 0.0, to: 1.0, duration: DUR});
 setTimeout('$("' + s2 + '").className = "i"',DUR*1000 + 10);
 setTimeout('$("' + l1 + '").className = "i"',DUR*1000 + 10);
 setTimeout('this.wEffect = null;',DUR*1000 + 10);
}
function gFilm(id) {
 var newId = (id && (id.gf || id.gf == 0)) ? id.gf : id;
 if ($('film' + newId)) return false;
 if (this.bEffect) {
   this.gfId = {gf:id};
   return false;
 }
 var h = '<div class="films_player_item" id="film' + newId + '"><object width="' + _widths[newId] + '" height="' + (_heights[newId] + 15) + '" codebase="http://www.apple.com/qtactivex/qtplugin.cab" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"><param value="mov/' + _filenames[newId] + '" name="src"/><param value="#000000" name="bgcolor"/><param value="true" name="autoplay"/><param width="' + _widths[newId] + '" height="' + (_heights[newId] + 15) + '" value="video/quicktime" name="type"/><embed width="' + _widths[newId] + '" height="' + (_heights[newId] + 15) + '" pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime" autoplay="true" src="mov/' + _filenames[newId] + '"/></object></div>';
 this.gfId = null;
 setTimeout('$("films_player").innerHTML=\'' + h + '\';', (sBio(1) ? DUR/2*1000:0));
 return true;
}
function sFilm(f) {//alert((this.selFilm && this.selFilm.id) || null);
 var newF = (f && (f.gf || f.gf == 0)) ? $('film' + f.gf + '_link') : f;
 if (this.selFilm) {
  var n = this.selFilm;
  if (n.className){n.className = n.className.substring(0,((n.className.indexOf(' ') >= 0)?n.className.indexOf(' '):0));}
  if (n.id == newF.id) {
    this.selFilm = null;
    return;
  }
 }
 newF.className += ' selected';
 this.selFilm = newF;
}
function sContact(b) {
 if (this.cEffect) {
   return false;
 }
 this.cEffect = new Effect.Parallel([
   new Effect.Move($('contact_link'),{x:(b?187:-187),y:0,duration:S_DUR}),
   new Effect.Scale($('contact_activator'),(b?100:32), {scaleContent: false, scaleY: false, scaleFrom: (b?53:100), duration: S_DUR, scaleMode: {originalHeight: 31, originalWidth: 285}}),
   new Effect.Scale($('contact_link'), (b?0:100), {scaleContent: false, scaleY: false, scaleFrom:(b?100:0),duration:S_DUR,scaleMode: {originalHeight: 31, originalWidth: 150}})],{duration:S_DUR});
 setTimeout('$("contact_activator").title="' + (b?'':'activated') + '";this.cEffect=null;', S_DUR*1000);
/*

 if (this.cEffect || (b && $('contact').className == 'i')) return false;
 var b2 = b || $('contact').className == '';
 this.cEffect = new Effect.Opacity('contact', {from: b2 ? 1.0 : 0.0, to: b2 ? 0.0 : 1.0, duration: DUR});
 setTimeout('$("contact").className = "' + (b2 ? 'i' : '') + '";', (b2 ? DUR*1000+10 : 0));
 setTimeout('this.cEffect=null;',DUR*1000+10);*/
}