// --- Startup ---

// Appel Style Sheet
document.write('<link rel="stylesheet" href="../../css/style.css" type="text/css">')

// Detection language
var lang = '';
if(document.location.href.indexOf('htmlen') != -1) lang = 'e'
if(document.location.href.indexOf('htmlfr') != -1) lang = 'f'


// pre chargement des images
if(document.images) {
  img1 = new Image();
  img1.src = "../../graphics/h_face_sitting_2.jpg";
  img2 = new Image();
  img2.src = "../../graphics/h_face_poundmaker_2.jpg";
  img3 = new Image();
  img3.src = "../../graphics/h_face_black_2.jpg";
  img4 = new Image();
  img4.src = "../../graphics/h_face_brant_2.jpg";
  img5 = new Image();
  img5.src = "../../graphics/h_face_pontiac_2.jpg";
  img6 = new Image();
  img6.src = "../../graphics/b_home_1" + lang + ".gif";
  img7 = new Image();
  img7.src = "../../graphics/b_nations_1" + lang + ".gif";
  img8 = new Image();
  img8.src = "../../graphics/b_interactive_1" + lang + ".gif";
  img9 = new Image();
  img9.src = "../../graphics/b_series_1" + lang + ".gif";
  img10 = new Image();
  img10.src = "../../graphics/b_gallery_1" + lang + ".gif";
  img11 = new Image();
  img11.src = "../../graphics/b_forum_1" + lang + ".gif";
  img12 = new Image();
  img12.src = "../../graphics/b_references_1" + lang + ".gif";
  img13 = new Image();
  img13.src = "../../graphics/h_name_sitting.gif";
  img14 = new Image();
  img14.src = "../../graphics/h_name_poundmaker.gif";
  img15 = new Image();
  img15.src = "../../graphics/h_name_black.gif";
  img16 = new Image();
  img16.src = "../../graphics/h_name_brant.gif";
  img17 = new Image();
  img17.src = "../../graphics/h_name_pontiac.gif";
  }

// --- Functions ---

// Rollover & Nav bar
var curNavbar = '';
function setNavBar(name) {if(document.images && name!='') {document.images['b_'+name].src='../../graphics/b_' + name + '_2' + lang + '.gif'; curNavbar=name;}}
function rollOver(name) {if(document.images && name!=curNavbar) document.images['b_'+name].src='../../graphics/b_' + name + '_1' + lang + '.gif'}
function rollOut(name) {if(document.images && name!=curNavbar) document.images['b_'+name].src='../../graphics/b_' + name + '_0' + lang + '.gif'}

var curFace = '';
function setFace(name) {if(document.images && name!='') {document.images['h_face_'+name].src='../../graphics/h_face_' + name + '_2.jpg'; document.images['h_name'].src='../../graphics/h_name_' + name + '.gif'; curFace=name;}}
function rollOverFace(name) {if(document.images && name!=curFace) document.images['h_face_'+name].src='../../graphics/h_face_' + name + '_2.jpg'; document.images['h_name'].src='../../graphics/h_name_' + name + '.gif'}
function rollOutFace(name) {
  if(document.images && name!=curFace) {
    document.images['h_face_'+name].src='../../graphics/h_face_' + name + '_0.jpg'; 
    if(curFace != '') document.images['h_name'].src='../../graphics/h_name_' + curFace + '.gif'
    else document.images['h_name'].src='../../graphics/spacer.gif'
    }
  }

// Media popup
var wpop = null;

function pictPopup(file, caption, width, height) {
  //alert('Pictures coming soon...\n' + file + '\n' + caption + '\n' + width + ' x ' + height);
  var w = width + 80;
  var h = height + 160;
  var tclose = (lang == 'e') ? 'close window' : 'fermer' ;
  var logo = (lang == 'e') ? 'popup_logo.gif' : 'popup_logo_f.gif' ;
  wpop = window.open('','mediapop','toolbar=no,location=no,directories=no,status=yes,menubar=no,title=no,scrollbars=no,resizable=yes,copyhistory=no,width=' + w + ',height=' + h);
  wpop.document.write('<html>\n');
  wpop.document.write('<head><title>Chiefs - Galafilm Productions - Montreal</title></head>\n');
  wpop.document.write('<body bgcolor="#642313"  marginheight="0" topmargin="0" marginwidth="5" leftmargin="5"><center>\n');
  wpop.document.write('<table cellspacing=0 cellpadding=0 border=0>\n');
  wpop.document.write('<tr><td align=center background="../../graphics/popup_ligne1.gif"><img src="../../graphics/' + logo + '" width=89 height=52></td></tr>\n');
  wpop.document.write('<tr><td align=center><img src="' + file + '" width = ' + width + ' height=' + height + ' vspace=6><br>\n');
  wpop.document.write('<font face="Verdana, Geneva, Arial, Helvetica" color="#fdb456" size=-1>' + caption + '</font></td></tr>\n');
  wpop.document.write('<tr><td><img src="../../graphics/spacer.gif" width=1 height=10></td></tr>\n');
  wpop.document.write('<tr><td align=right><a href="javascript:window.close()" style="text-decoration:none"><font face="Verdana, Geneva, Arial, Helvetica" color="#ea721d" size=-2>&gt;&nbsp;' + tclose + '</font></a></td></tr>\n');
  wpop.document.write('<tr><td><img src="../../graphics/spacer.gif" width=1 height=2></td></tr>\n');
  wpop.document.write('<tr><td bgcolor="#ce4419"><img src="../../graphics/spacer.gif" width=1 height=2></td></tr>\n');
  wpop.document.write('</table>\n');
  wpop.document.write('</body></html>\n');
  wpop.document.close();
  setTimeout('wpop.focus()', 500);
  }

function audioPopup(file, caption, width, height, audiofile) 
  {
  if (file != '') {
    var w = width + 15 + 132 + 40;
    var h = height + 100;
    } else {
    var w = 132 + 40;
    var h = 220;
    }
  var tclose = (lang == 'e') ? 'close window' : 'fermer';
  var logo = (lang == 'e') ? 'popup_logo.gif' : 'popup_logo_f.gif' ;
  wpop = window.open('','mediapop','toolbar=no,location=no,directories=no,status=yes,menubar=no,title=no,scrollbars=no,resizable=yes,copyhistory=no,width=' + w + ',height=' + h);
  wpop.document.write('<html>\n');
  wpop.document.write('<head><title>Chiefs - Galafilm Productions - Montreal</title></head>\n');
  wpop.document.write('<body bgcolor="#642313"  marginheight="0" topmargin="0" marginwidth="5" leftmargin="5"><center>\n');
  wpop.document.write('<table cellspacing=0 cellpadding=0 border=0>\n');
  wpop.document.write('<tr><td align=center background="../../graphics/popup_ligne1.gif"><img src="../../graphics/' + logo + '" width=89 height=52></td></tr>\n');

  wpop.document.write('<tr><td>\n');
  wpop.document.write('<table cellspacing=0 cellpadding=0 border=0><tr>\n');
  if(file != '') {
    wpop.document.write('<td align=center><img src="' + file + '" width = ' + width + ' height=' + height + '><br></td>\n');
    wpop.document.write('<td><img src="../../graphics/spacer.gif" width=6 height=1></td>\n');
    wpop.document.write('<td background="../../graphics/dots2v_f.gif"><img src="../../graphics/spacer.gif" width=3 height=1></td>\n');
    wpop.document.write('<td><img src="../../graphics/spacer.gif" width=6 height=1></td>\n');
    }
  wpop.document.write('<td><font face="Verdana, Geneva, Arial, Helvetica" color="#fdb456" size=-1>' + caption + '</font><br><br>\n');
  wpop.document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" WIDTH=132 HEIGHT=30>\n');
  wpop.document.write('<PARAM NAME=movie VALUE="' + audiofile + '"> <PARAM NAME="PLAY" VALUE="true"> <PARAM NAME=loop VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#642316> \n');
  wpop.document.write('<EMBED src="' + audiofile + '" play=true loop=false quality=high bgcolor=#642316  WIDTH=132 HEIGHT=30 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>\n');
  wpop.document.write('</OBJECT></td></tr>\n');
  wpop.document.write('</table></td></tr>\n');

  wpop.document.write('<tr><td><img src="../../graphics/spacer.gif" width=1 height=18></td></tr>\n');
  wpop.document.write('<tr><td align=right><a href="javascript:window.close()" style="text-decoration:none"><font face="Verdana, Geneva, Arial, Helvetica" color="#ea721d" size=-2>&gt;&nbsp;' + tclose + '</font></a></td></tr>\n');
  wpop.document.write('<tr><td><img src="../../graphics/spacer.gif" width=1 height=2></td></tr>\n');
  wpop.document.write('<tr><td bgcolor="#ce4419"><img src="../../graphics/spacer.gif" width=1 height=2></td></tr>\n');
  wpop.document.write('</table>\n');
  wpop.document.write('</body></html>\n');
  wpop.document.close();
  setTimeout('wpop.focus()', 500);
  }

function videoPopup(file, caption, width, height) {
  //alert('Pictures coming soon...\n' + file + '\n' + caption + '\n' + width + ' x ' + height);
  var player = ''; 
  var opt = file.split('?');
  file = opt[0];
  if(opt[1]) {		// Player forcé en argument ?qt ou ?mp
    player = opt[1];
    setCookie('PLAYER', player, 999);
    } else {		// Player par défaut ou dans cookie
    player = getCookie('PLAYER');
    }
  if (player == '') {player = 'qt';}	// Quick Time par défaut
  if(file.lastIndexOf('.') != -1) file = file.substring(0, file.lastIndexOf('.'))
  var htmlvideo = 'video';
  var htmlswitch = 'other player';
  if(player == 'qt') {
    htmlvideo = '<embed src="' + file + '.mov" width=' + width + ' height=' + height + ' autoplay="true" controler="true" scale="Aspect" bgcolor="#642313"></embed>';
    htmlswitch = '<a href="javascript:window.opener.videoPopup(\'' + file + '.wmv?mp\', \'' + caption + '\', ' + width + ', ' + height + ')" style="text-decoration:none"><font face="Verdana, Geneva, Arial, Helvetica" color="#ea721d" size=-2>&gt;&nbsp;Media Player</font></a>';
    }
  if(player == 'mp') {
    htmlvideo = '<OBJECT ID="MediaPlayer" WIDTH=' +width + ' HEIGHT=' + height + ' classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">';
    htmlvideo = htmlvideo + '<PARAM NAME="FileName" VALUE="' + file + '.wmv"><PARAM NAME="ShowControls" VALUE="0"><PARAM NAME="ShowDisplay" VALUE="0"><PARAM NAME="ShowStatusBar" VALUE="0"><PARAM NAME="AutoSize" VALUE="0">';
    htmlvideo = htmlvideo + '<EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" filename="' + file + '.wmv" src="' + file + '.wmv" Name="MediaPlayer" ShowControls=0 ShowDisplay=0 ShowStatusBar=0 width=' + width + ' height=' + height + '></EMBED></OBJECT>';
    htmlswitch = '<a href="javascript:window.opener.videoPopup(\'' + file + '.mov?qt\', \'' + caption + '\', ' + width + ', ' + height + ')" style="text-decoration:none"><font face="Verdana, Geneva, Arial, Helvetica" color="#ea721d" size=-2>&gt;&nbsp;Quick Time</font></a>';
    }
  var w = width + 80;
  var h = height + 150;
  var tclose = (lang == 'e') ? 'Close window' : 'Fermer';
  var logo = (lang == 'e') ? 'popup_logo.gif' : 'popup_logo_f.gif' ;
  wpop = window.open('','mediapop','toolbar=no,location=no,directories=no,status=yes,menubar=no,title=no,scrollbars=no,resizable=yes,copyhistory=no,width=' + w + ',height=' + h);
  wpop.opener = self;
  wpop.document.write('<html>\n');
  wpop.document.write('<head><title>Chiefs - Galafilm Productions - Montreal</title></head>\n');
  wpop.document.write('<body bgcolor="#642313"  marginheight="0" topmargin="0" marginwidth="5" leftmargin="5"><center>\n');
  wpop.document.write('<table cellspacing=0 cellpadding=0 border=0>\n');
  wpop.document.write('<tr><td align=center background="../../graphics/popup_ligne1.gif"><img src="../../graphics/' + logo + '" width=89 height=52></td></tr>\n');
  wpop.document.write('<tr><td align=center>' + htmlvideo + '<br>\n');
  wpop.document.write('<font face="Verdana, Geneva, Arial, Helvetica" color="#fdb456" size=-1>' + caption + '</font></td></tr>\n');
  wpop.document.write('<tr><td><img src="../../graphics/spacer.gif" width=1 height=10></td></tr>\n');
  wpop.document.write('<tr><td align=right>' + htmlswitch + '&nbsp;<a href="javascript:window.close()" style="text-decoration:none"><font face="Verdana, Geneva, Arial, Helvetica" color="#ea721d" size=-2>&gt;&nbsp;' + tclose + '</font></a></td></tr>\n');
  wpop.document.write('<tr><td><img src="../../graphics/spacer.gif" width=1 height=2></td></tr>\n');
  wpop.document.write('<tr><td bgcolor="#ce4419"><img src="../../graphics/spacer.gif" width=1 height=2></td></tr>\n');
  wpop.document.write('</table>\n');
  wpop.document.write('</body></html>\n');
  wpop.document.close();
  setTimeout('wpop.focus()', 500);
  }
 
function htmlPopup(file, width, height) {
  var w = width;
  var h = height;
  wpop = window.open(file,'htmlpop','toolbar=no,location=no,directories=no,status=yes,menubar=no,title=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + w + ',height=' + h);
  setTimeout('wpop.focus()', 500);
  }

// Send page
function sendPage() {alert('Email coming soon ...')}

// Cookies
function setCookie(name, value, days) {
  if(value != "") {
    var date1 = new Date(); 
    var date2 = new Date(); 
    date2.setTime(date1.getTime() + 1000*60*60*24*days);
    document.cookie = name + '=' + escape(value) + '; expires=' + date2.toGMTString();
    }
  }

function getCookie(name) {
  var gato = document.cookie; 
  i1 = gato.indexOf(name+'=');
  if(i1 == -1) return "";
  i2 = gato.indexOf(';', i1);
  if(i2 == -1) i2 = gato.length;
  return unescape(gato.substring(i1 + name.length + 1, i2))
  }


