﻿                //
                // 季節を春・梅雨・夏・秋・冬にわけて写真を変化させる
                // 蔵元写真と寿司の写真は単純にランダム表示
                // Copyright Y.Amano 2009.06.05 Ver. 1.0
                // 2009.06.06:下部の4種類写真の表示位置をランダム表示に変更
                //



               today=new Date();
                    month=today.getMonth()+1;
                  //month=12;                                                                                                // For Debug
                  //month=prompt("Month?",1);                                                             // For Debug 

                    //document.write("今月は",month,"月<BR>");                              // For Debug

//------------------------------　各要素ごとのランダム数値発生  ---------------------------------------------------
                    brewery_random=Math.floor(Math.random()*9)+1;                    //蔵元数設定9蔵元
                    photo_random=Math.floor(Math.random()*6)+1;                         //季節毎の写真枚数6枚
                    sushi_random=Math.floor(Math.random()*16)+1;                       //寿司写真16枚
                    place_random=Math.floor(Math.random()*24)+1;                         //写真表示位置組合種類4箇所の組合4C4=24種類

//---------------------------------　各月を季節に定義  -------------------------------------------------------------------
                        if (((month==12) | (month==1) | (month==2))){                       //12月～2月を冬と定義
                             season="winter";
                        }
                             else if ((month>=3) && (month <=5)) {                                  //3月～5月を春と定義
                                  season="spring";
                             }

                                else if (month==6) {                                                                //6月を梅雨と定義
                                      season="rainy";
                                }
                                     else if ((month>=7) && (month <=8)) {                         //7月～8月を夏と定義
                                          season="summer";
                                     }
                                         else if ((month>=9) && (month <12)) {                      //9月～11月を秋と定義
                                              season="fall";
                                         }  

                                              // else {                                                                             // 異常処理0, 12以上
                                              //     season="others";
                                              // }
           
          //document.write("季節は",season,"です。<BR>");                                      // For Debug
          //document.write("蔵元写真はB",brewery_random,".jpgです<BR>");    // For Debug
          //document.write("写真は",season,photo_random,".jpgです。<BR>");     // For Debug  

//--------------------------------------------------- 各写真のHTML表示定義 ------------------------------------------------------------------         
          photo_season="<IMG SRC='photo/"+season+photo_random+".jpg' 'width='141' height='100' border='0' >"                              //季節の景色
          photo_sake="<IMG SRC='sake/"+season+photo_random+".jpg' 'width='141' height='100' border='0' >";                               //季節の酒シーン
          photo_sushi="<IMG SRC='sushi/sushi"+sushi_random+".jpg' 'width='141' height='100' border='0' >";                                   //寿司
          photo_brewery="<IMG SRC='photo/B"+brewery_random+".jpg'  'width='141' height='100' border='0' >"                                      //蔵元
        //document.write("<IMG src='photo/",season,photo_random,".jpg 'width='141' height='100' border='0'><IMG src='masu_zake.jpg' width='141' height='100' border='0'><IMG src='photo/B",brewery_random,".jpg  'width='141' height='100' border='0'>");

　　 //document.write("<IMG SRC='photo/",season,photo_random,".jpg' width='141' height='100' border='0' >");  //季節の景色
　　 //document.write("<IMG SRC='photo/B",brewery_random,".jpg' width='141' height='100' border='0' >");         //蔵元写真

//----------------------------------------------------各写真の表示順序 -----------------------------------------------------------------
//---------------- place_random値により写真の表示順序を変えて表示する。

           //document.write("表示位置は",place_random,"です。<BR>");  //For Debug

            if (place_random == 1) {
                                                    document.write(photo_season);       //1.季節の景色                               
                                                    document.write(photo_sake);           //2.季節の酒シーン
                                                    document.write(photo_sushi);          //3.寿司
                                                    document.write(photo_brewery);     //4.蔵元
           }
                 else if (place_random == 2) {
                                                    document.write(photo_season);       //1.季節の景色                               
                                                    document.write(photo_sake);           //2.季節の酒シーン
                                                    document.write(photo_brewery);     //4.蔵元
                                                    document.write(photo_sushi);          //3.寿司
                  }
            
                 else if (place_random == 3) {
                                                    document.write(photo_season);       //1.季節の景色
                                                    document.write(photo_sushi);          //3.寿司                               
                                                    document.write(photo_sake);           //2.季節の酒シーン
                                                    document.write(photo_brewery);     //4.蔵元
                 }

                  else if (place_random == 4) {                        
                                                    document.write(photo_season);       //1.季節の景色
                                                    document.write(photo_sushi);          //3.寿司
                                                    document.write(photo_brewery);     //4.蔵元                               
                                                    document.write(photo_sake);           //2.季節の酒シーン
                   }

                   else if (place_random == 5) {                        
                                                    document.write(photo_season);       //1.季節の景色
                                                    document.write(photo_brewery);     //4.蔵元                          
                                                    document.write(photo_sake);           //2.季節の酒シーン
                                                    document.write(photo_sushi);          //3.寿司     
                   }

                   else if (place_random == 6) {                        
                                                    document.write(photo_season);       //1.季節の景色
                                                    document.write(photo_brewery);     //4.蔵元 
                                                    document.write(photo_sushi);          //3.寿司                             
                                                    document.write(photo_sake);           //2.季節の酒シーン   
                   }

                   else if (place_random == 7) { 
                                                      document.write(photo_sake);           //2.季節の酒シーン
                                                      document.write(photo_season);       //1.季節の景色                             
                                                      document.write(photo_sushi);          //3.寿司
                                                      document.write(photo_brewery);     //4.蔵元
                   }

                   else if (place_random == 8) {                        
                                                      document.write(photo_sake);           //2.季節の酒シーン
                                                      document.write(photo_season);       //1.季節の景色                             
                                                      document.write(photo_brewery);     //4.蔵元
                                                      document.write(photo_sushi);          //3.寿司  
                   }

                   else if (place_random == 9) {
                                                      document.write(photo_sake);            //2.季節の酒シーン
                                                      document.write(photo_sushi);           //3.寿司
                                                      document.write(photo_season);        //1.季節の景色                             
                                                      document.write(photo_brewery);      //4.蔵元 
                   }

                   else if (place_random == 10) {                        
                                                      document.write(photo_sake);            //2.季節の酒シーン
                                                      document.write(photo_sushi);           //3.寿司
                                                      document.write(photo_brewery);      //4.蔵元 
                                                      document.write(photo_season);        //1.季節の景色                      
                   }

                   else if (place_random == 11) {
                                                      document.write(photo_sake);            //2.季節の酒シーン
                                                      document.write(photo_brewery);      //4.蔵元                        
                                                      document.write(photo_season);        //1.季節の景色
                                                      document.write(photo_sushi);           //3.寿司   
                  } 

                   else if (place_random == 12) {                        
                                                      document.write(photo_sake);            //2.季節の酒シーン
                                                      document.write(photo_brewery);      //4.蔵元
                                                      document.write(photo_sushi);           //3.寿司                        
                                                      document.write(photo_season);        //1.季節の景色
                  } 

                   else if (place_random == 13) {                        
                                                      document.write(photo_sushi);           //3.寿司                        
                                                      document.write(photo_season);        //1.季節の景色
                                                      document.write(photo_sake);            //2.季節の酒シーン
                                                      document.write(photo_brewery);      //4.蔵元
                  } 

                   else if (place_random == 14) {                        
                                                      document.write(photo_sushi);           //3.寿司                        
                                                      document.write(photo_season);        //1.季節の景色
                                                      document.write(photo_brewery);      //4.蔵元
                                                      document.write(photo_sake);            //2.季節の酒シーン
                  } 

                   else if (place_random == 15) {                        
                                                      document.write(photo_sushi);           //3.寿司
                                                      document.write(photo_sake);            //2.季節の酒シーン                        
                                                      document.write(photo_season);        //1.季節の景色
                                                      document.write(photo_brewery);      //4.蔵元
                  } 

                   else if (place_random == 16) {                        
                                                      document.write(photo_sushi);           //3.寿司
                                                      document.write(photo_sake);            //2.季節の酒シーン 
                                                      document.write(photo_brewery);      //4.蔵元                       
                                                      document.write(photo_season);        //1.季節の景色
                  } 

                   else if (place_random == 17) {                        
                                                      document.write(photo_sushi);           //3.寿司
                                                      document.write(photo_brewery);      //4.蔵元                       
                                                      document.write(photo_season);        //1.季節の景色
                                                      document.write(photo_sake);            //2.季節の酒シーン 
                  } 

                   else if (place_random == 18) {                        
                                                      document.write(photo_sushi);           //3.寿司
                                                      document.write(photo_brewery);      //4.蔵元
                                                      document.write(photo_sake);            //2.季節の酒シーン                        
                                                      document.write(photo_season);        //1.季節の景色
                  } 

                   else if (place_random == 19) {                        
                                                      document.write(photo_brewery);      //4.蔵元
                                                      document.write(photo_season);        //1.季節の景色
                                                      document.write(photo_sake);            //2.季節の酒シーン
                                                      document.write(photo_sushi);           //3.寿司             
                  } 


                   else if (place_random == 20) {                        
                                                      document.write(photo_brewery);      //4.蔵元
                                                      document.write(photo_season);        //1.季節の景色
                                                      document.write(photo_sushi);           //3.寿司
                                                      document.write(photo_sake);            //2.季節の酒シーン              
                  } 

                   else if (place_random == 21) {                        
                                                      document.write(photo_brewery);      //4.蔵元
                                                      document.write(photo_sake);            //2.季節の酒シーン      
                                                      document.write(photo_season);        //1.季節の景色
                                                      document.write(photo_sushi);           //3.寿司        
                  }

                   else if (place_random == 22) {                        
                                                      document.write(photo_brewery);      //4.蔵元
                                                      document.write(photo_sake);            //2.季節の酒シーン
                                                      document.write(photo_sushi);           //3.寿司            
                                                      document.write(photo_season);        //1.季節の景色 
                  }

                   else if (place_random == 23) {                        
                                                      document.write(photo_brewery);      //4.蔵元
                                                      document.write(photo_sushi);           //3.寿司 
                                                      document.write(photo_season);        //1.季節の景色 
                                                      document.write(photo_sake);            //2.季節の酒シーン          
                  }

                   else {                        
                                                      document.write(photo_brewery);      //4.蔵元
                                                      document.write(photo_sushi);           //3.寿司 
                                                      document.write(photo_sake);            //2.季節の酒シーン 
                                                      document.write(photo_season);        //1.季節の景色       
                  }