/*	
	main.js
*/

function datesForStart() {
    today = new Date();
    xday = new Date(2004,0,1);
    remain = (xday.getTime() - today.getTime())/(24*60*60*1000);
    document.write(Math.ceil(remain));
}

function dayByDay() {
    today = new Date();
    xday = new Date(2004,0,1);
    txt = ''
    remain = (xday.getTime() - today.getTime())/(24*60*60*1000);
    if (remain>0) msg = '<B><FONT size="-1" color="#660000">スタートまであと </FONT><FONT color="#660000">' + Math.ceil(remain)+'</FONT><FONT size="-1"> 日</FONT></B>';
    if (Math.ceil(remain)==0) txt = 'いよいよ本日 13時(日本時間 21時) スタート';
    if (Math.ceil(remain)==-1) txt = 'レース2日目 スペイン カステロンまで 531km';
    if (Math.ceil(remain)==-2) txt = 'レース3日目 831km';
    if (Math.ceil(remain)==-3) txt = 'レース4日目752km';
    if (Math.ceil(remain)==-4) txt = 'レース5日目575km';
    if (Math.ceil(remain)==-5) txt = 'レース6日目803km';
    if (Math.ceil(remain)==-6) txt = 'レース7日目1055km';
    if (Math.ceil(remain)==-7) txt = 'レース8日目389km';
    if (Math.ceil(remain)==-8) txt = 'レース9日目739km';
    if (Math.ceil(remain)==-9) txt = 'レース10日目910km';
    if (Math.ceil(remain)==-10) txt = 'レース11日目751km';
    if (Math.ceil(remain)==-11) txt = '今日はボボデュラッソで休息日';
    if (Math.ceil(remain)==-12) txt = 'レース13日目 666km';
    if (Math.ceil(remain)==-13) txt = 'レース14日目733km';
    if (Math.ceil(remain)==-14) txt = 'レース15日目513km';
    if (Math.ceil(remain)==-15) txt = 'レース16日目630km';
    if (Math.ceil(remain)==-16) txt = 'レース17日目665km ダカール到着';
    if (Math.ceil(remain)==-17) txt = 'レース18日目113km ゴール！！';
 
    if (Math.ceil(remain)<=0) msg = '<B><FONT size="-1" color="#660000">' + txt + '</FONT></B>';

    document.write(msg);
}

function _HpbJumpURLinNewWindow(url) 
{
  if (url != '')
  {
    window.open(url, '_live', 'screenX=0,left=" + (screen.availWidth/2-255) + ",screenY=0,top=" + (screen.availHeight/2-265) + ",width=600,height=530,menubar=no,resizable=yes,titlebar=no,toolbar=no,alwaysRaised=yes,status=no,scrollbars=yes,fullscreen=0');
  }
}


var ImageFile = new Array();
    ImageFile[1] = new Image();    ImageFile[1].src  = "images/toplogo_partner/toplogo_taiyo.gif";
    ImageFile[2] = new Image();    ImageFile[2].src  = "images/toplogo_partner/toplogo_turbulence.gif";
    ImageFile[3] = new Image();    ImageFile[3].src  = "images/toplogo_partner/toplogo_weider.gif";
    ImageFile[4] = new Image();    ImageFile[4].src  = "images/toplogo_partner/toplogo_superball.gif";
    ImageFile[5] = new Image();    ImageFile[5].src  = "images/toplogo_partner/toplogo_oohashi.gif";
    ImageFile[6] = new Image();    ImageFile[6].src  = "images/toplogo_partner/toplogo_noguchi.gif";
    ImageFile[7] = new Image();    ImageFile[7].src = "images/toplogo_partner/toplogo_absolute.gif";
    ImageFile[8] = new Image();    ImageFile[8].src = "images/toplogo_partner/toplogo_mcjapan-net.gif";
    ImageFile[9] = new Image();    ImageFile[9].src = "images/toplogo_partner/toplogo_arai.gif";
    ImageFile[10] = new Image();   ImageFile[10].src = "images/toplogo_partner/toplogo_eandg.jpg";
    ImageFile[11] = new Image();   ImageFile[11].src = "images/toplogo_partner/toplogo_jkdp.gif";
    ImageFile[12] = new Image();   ImageFile[12].src = "images/toplogo_partner/toplogo_ktm.gif";
    ImageFile[13] = new Image();    ImageFile[13].src  = "images/toplogo_partner/toplogo_sunstar.gif";
    ImageFile[14] = new Image();    ImageFile[14].src  = "images/toplogo_partner/toplogo_fff.gif";
    ImageFile[15] = new Image();   ImageFile[15].src = "images/toplogo_partner/toplogo_alpinestars.gif";
//    ImageFile[1] = new Image();   ImageFile[14].src = "images/toplogo_partner/toplogo_fuji.gif";
//    ImageFile[1] = new Image();    ImageFile[6].src  = "images/toplogo_partner/toplogo_sunstar.gif";
//    ImageFile[8] = new Image();    ImageFile[8].src  = "images/toplogo_partner/toplogo_ogusho.gif";
//    ImageFile[5] = new Image();    ImageFile[5].src  = "images/toplogo_partner/toplogo_protrek.gif";
//    ImageFile[18] = new Image();   ImageFile[18].src = "images/toplogo_partner/toplogo_newlong.gif";
var ln = 15 // List Count
var i=0

function changeImage()
{
    today = new Date();
    a = Math.ceil(today.getTime()/(24*60*60*1000));
    
    if (i>=ln) i=0;

    ii = ((i+a) % ln) + 1;

    document.partnerlogo.src = ImageFile[ii].src;

    i++;
    
    setTimeout("changeImage()",7700);

}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



