﻿// ================= JALPAK International America, Inc. - javascript.css ==================

//About Us
    // Highlight Selected Office
    function officeselected(ofcdiv) {
        document.getElementById('laxdiv').style.borderColor = '#E8E8E8';
        document.getElementById('nycdiv').style.borderColor = '#E8E8E8';
        document.getElementById('sfodiv').style.borderColor = '#E8E8E8';
        document.getElementById('lasdiv').style.borderColor = '#E8E8E8';
        document.getElementById('yvrdiv').style.borderColor = '#E8E8E8';
        document.getElementById('tyodiv').style.borderColor = '#E8E8E8';
        document.getElementById('osadiv').style.borderColor = '#E8E8E8';
        document.getElementById(ofcdiv).style.borderColor = '#CC0000';
    }

    // Bloat Image
    function imgbloat(imgid) {
        document.getElementById(imgid).setAttribute('width', '171');
        document.getElementById(imgid).setAttribute('height', '40');
    }

    function imgshrink(imgid) {
        document.getElementById(imgid).setAttribute('width', '150');
        document.getElementById(imgid).setAttribute('height', '35');
    }

    function imgbloatjpn(imgid) {
        document.getElementById(imgid).setAttribute('width', '147');
        document.getElementById(imgid).setAttribute('height', '40');
    }

    function imgshrinkjpn(imgid) {
        document.getElementById(imgid).setAttribute('width', '129');
        document.getElementById(imgid).setAttribute('height', '35');
    }

//Global Functions

// Image Blur/Static
    function imgblur(imageObj) {
        var image = document.getElementById(imageObj);
        image.style.opacity = 0.6;
        image.filters.alpha.opacity = 60;
    }

    function imgstatic(imageObj) {
        var image = document.getElementById(imageObj);
        image.style.opacity = 1;
        image.filters.alpha.opacity = 100;
    }

//VERFIED (but needs upgrade)
    function box1_hover() {
        hover('#C00000', 'box1');
        advhover_fadeout(60, 'box2');
        advhover_fadeout(60, 'box3');
        advhover_fadeout(60, 'box4');
    }

    function box2_hover() {
        hover('#C00000', 'box2');
        advhover_fadeout(60, 'box1');
        advhover_fadeout(60, 'box3');
        advhover_fadeout(60, 'box4');
    }

    function box3_hover() {
        hover('#C00000', 'box3');
        advhover_fadeout(60, 'box2');
        advhover_fadeout(60, 'box1');
        advhover_fadeout(60, 'box4');
    }

    function box4_hover() {
        hover('#C00000', 'box4');
        advhover_fadeout(60, 'box2');
        advhover_fadeout(60, 'box3');
        advhover_fadeout(60, 'box1');
    }

    function box1_nonhover() {
        nonhover('gray', 'box1');
        advhover_fadein(60, 'box2');
        advhover_fadein(60, 'box3');
        advhover_fadein(60, 'box4');
    }

    function box2_nonhover() {
        nonhover('gray', 'box2');
        advhover_fadein(60, 'box1');
        advhover_fadein(60, 'box3');
        advhover_fadein(60, 'box4');
    }

    function box3_nonhover() {
        nonhover('gray', 'box3');
        advhover_fadein(60, 'box2');
        advhover_fadein(60, 'box1');
        advhover_fadein(60, 'box4');
    }

    function box4_nonhover() {
        nonhover('gray', 'box4');
        advhover_fadein(60, 'box2');
        advhover_fadein(60, 'box3');
        advhover_fadein(60, 'box1');
    }


//VERIFIED
    function advhover_fadeout(endopacity, imgObj) {

        imageId = imgObj;
        image = document.getElementById(imageId);
        setOpacity(image, 100);
        image.style.visibility = "visible";
        fadeOut(imageId, 100, endopacity);
        //fadeIn(imageId, 0);
    }

//VERIFIED
    function fadeOut(objId, cur_opacity, opacity) {
        //document.getElementById(objId).innerHTML = cur_opacity + "/" + opacity;
        if (document.getElementById) {
            obj = document.getElementById(objId);
            if (cur_opacity >= opacity) {
                setOpacity(obj, cur_opacity);
                cur_opacity -= 15;
                window.setTimeout("fadeOut('" + objId + "'," + cur_opacity + "," + opacity + ")", 10);
            }
        }
    }

//VERIFIED
    function advhover_fadein(startopacity, imgObj) {

        document.body.style.cursor = "default";

        imageId = imgObj;
        image = document.getElementById(imageId);
        setOpacity(image, startopacity);
        image.style.visibility = "visible";
        //fadeOut(imageId, 100);
        fadeIn(imageId, startopacity);
    }

//VERIFIED
    function fadeIn(objId, opacity) {
        //document.getElementById(objId).innerHTML = opacity;
        if (document.getElementById) {
            obj = document.getElementById(objId);
            if (opacity <= 100) {
                setOpacity(obj, opacity);
                opacity += 15;
                window.setTimeout("fadeIn('" + objId + "'," + opacity + ")", 10);
            }
        }
    }

//VERIFIED
    function setOpacity(obj, opacity) {
        opacity = (opacity == 100) ? 99.999 : opacity;
        // IE/Win
        obj.style.filter = "alpha(opacity:" + opacity + ")";
        // Safari<1.2, Konqueror
        obj.style.KHTMLOpacity = opacity / 100;
        // Older Mozilla and Firefox
        obj.style.MozOpacity = opacity / 100;
        // Safari 1.2, newer Firefox and Mozilla, CSS3
        obj.style.opacity = opacity / 100;
   }

// VERIFIED
   function reset_navibar(menuObj) {

       var SelectedMenu = document.getElementById(menuObj);

       var border_color = "gray";
       var backgd_color = "#E8E8E8";
       var font_color = "gray";

       //reset menu border color
       SelectedMenu.style.borderColor = border_color;
//       menu1.style.borderColor = border_color;
//       menu2.style.borderColor = border_color;
//       menu3.style.borderColor = border_color;
//       menu4.style.borderColor = border_color;

       //reset menu background color
       SelectedMenu.style.backgroundColor = backgd_color;
//       menu1.style.backgroundColor = backgd_color;
//       menu2.style.backgroundColor = backgd_color;
//       menu3.style.backgroundColor = backgd_color;
//       menu4.style.backgroundColor = backgd_color;

       //reset menu font color
       SelectedMenu.style.color = font_color;
//       menu1.style.color = font_color;
//       menu2.style.color = font_color;
//       menu3.style.color = font_color;
//       menu4.style.color = font_color;

       //hide & set height for all submenu
//       submenu1.style.visibility = "hidden";
//       submenu1.style.height = "0px";
//       submenu2.style.visibility = "hidden";
//       submenu2.style.height = "0px";
//       submenu3.style.visibility = "hidden";
//       submenu3.style.height = "0px";
//       submenu4.style.visibility = "hidden";
//       submenu4.style.height = "0px";
   }


   function show_b2b_navibar(menuObj, submenuObj) {

       var SelectedMenu = document.getElementById(menuObj);
//       var menu1 = document.getElementById('menu1');
//       var menu2 = document.getElementById('menu2');
//       var menu3 = document.getElementById('menu3');
//       var menu4 = document.getElementById('menu4');

//       var border_color = "gray";
//       var backgd_color = "#E8E8E8";
//       var font_color = "gray";

       //reset menu border color
//       menu1.style.borderColor = border_color;
//       menu2.style.borderColor = border_color;
//       menu3.style.borderColor = border_color;
//       menu4.style.borderColor = border_color;

       //reset menu background color
//       menu1.style.backgroundColor = backgd_color;
//       menu2.style.backgroundColor = backgd_color;
//       menu3.style.backgroundColor = backgd_color;
//       menu4.style.backgroundColor = backgd_color;

       //reset menu font color
//       menu1.style.color = font_color;
//       menu2.style.color = font_color;
//       menu3.style.color = font_color;
//       menu4.style.color = font_color;

       //set selected menu colors;
       SelectedMenu.style.borderColor = "#CC0000";
       SelectedMenu.style.backgroundColor = "#CC0000";
       SelectedMenu.style.color = "white";

//       var SelectedSubMenu = document.getElementById(submenuObj);
//       var submenu1 = document.getElementById('submenu1');
//       var submenu2 = document.getElementById('submenu2');
//       var submenu3 = document.getElementById('submenu3');
//       var submenu4 = document.getElementById('submenu4');

       //hide & set height for all submenu
//       submenu1.style.visibility = "hidden";
//       submenu1.style.height = "0px";
//       submenu2.style.visibility = "hidden";
//       submenu2.style.height = "0px";
//       submenu3.style.visibility = "hidden";
//       submenu3.style.height = "0px";
//       submenu4.style.visibility = "hidden";
//       submenu4.style.height = "0px";

//       //show & set height for selected submenu
//       SelectedSubMenu.style.visibility = "visible";
//       SelectedSubMenu.style.height = "17px";

       advhover_fadein(70, menuObj);
   }

   function turnonred(divObj) {

       var showstatus = document.getElementById(divObj).getAttribute('sts');

       if (showstatus == 'inactive') {
           document.getElementById(divObj).style.backgroundColor = '#CC0000';
           document.getElementById(divObj).style.color = 'white';
           advhover_fadein(40, divObj);
           
       }
   }

   function turnoffred(divObj) {

       var showstatus = document.getElementById(divObj).getAttribute('sts');

       if (showstatus == 'inactive') {
           document.getElementById(divObj).style.backgroundColor = '#E8E8E8';
           document.getElementById(divObj).style.color = 'black';
           
       }
   }


   function makeactive(divCount, divObj) {

       for (var i = 1;i < divCount;i++) {
           var divIndex = i + "";
           var styleObj = document.getElementById('cat' + divIndex).style;

           styleObj.backgroundColor = "#E8E8E8";
           styleObj.color = "black";

           document.getElementById('cat' + divIndex).setAttribute('sts', 'inactive');
       }


       styleObj = document.getElementById(divObj).style;

       styleObj.backgroundColor = "gray";
       styleObj.color = "white";

       document.getElementById(divObj).setAttribute('sts', 'active');
   }

   function showcategory(divCount, divObj) {

       for (var i = 1;i < divCount;i++) {
           var divIndex = i + "";
           var styleObj = document.getElementById('cat' + divIndex + 'content').style;

           styleObj.width = '0px';
           styleObj.height = '0px';
           styleObj.visibility = 'hidden';
       }



       var contentId = document.getElementById(divObj).getAttribute('id') + 'content';
       styleObj = document.getElementById(contentId).style;

       styleObj.width = 'auto';
       styleObj.height = 'auto';
       styleObj.visibility = 'visible';

       document.getElementById('catcontentbox').scrollTop = 0;

       advhover_fadein(60, contentId);
   }




// VERIFIED
// Hover (border color change)
    function hover(colorCode, objID) {
        document.getElementById(objID).style.borderColor = colorCode;
    }

    function nonhover(colorCode, objID) {
        document.getElementById(objID).style.borderColor = colorCode;
    }


//VERIFIED
//// open submenu / close submenu
    function open_submenu(value) {

        var container = document.getElementById(value);

        //document.getElementById('optionaltour_div').style.visibility = "hidden";
        document.getElementById('america_div').style.visibility = "hidden";
        document.getElementById('canada_div').style.visibility = "hidden";
        document.getElementById('nanbei_div').style.visibility = "hidden";

        container.style.visibility = "visible";
    }

    function close_submenu(value) {

        if (value == 'all') {
            //document.getElementById('optionaltour_div').style.visibility = "hidden";
            document.getElementById('america_div').style.visibility = "hidden";
            document.getElementById('canada_div').style.visibility = "hidden";
            document.getElementById('nanbei_div').style.visibility = "hidden";
        }else {
            var container = document.getElementById(value);
            container.style.visibility = "hidden";
        }

    }



//VERIFIED
    // OPT List Hover
    function listhover(obj) {
        obj.borderColor = "#0A2D7E";
        obj.backgroundColor = "#B8C9F0";
    }
//VERIFIED
    // OPT List Static 
    function liststatic(obj) {
        obj.borderColor = "#5E7BBF";
        obj.backgroundColor = "White";
    }


// iframe manipulation
        function showlistframe(srcValue) {
        
            var frameObj = document.getElementById("framelist");
            frameObj.setAttribute("src", srcValue);
            
        }

        function showdetailframe(sfsvCode) {

            var srcValue = sfsvCode + ".htm";

            var frameObj = window.parent.document.getElementById("framedetail");
            frameObj.setAttribute("src", srcValue);

        }
        
        function setlistframeheight() {

            var frameObj = document.getElementById("framelist");
            var frameSrc = frameObj.getAttribute("src");

            if (frameSrc != "" ) {
                var divObj = window.frames["framelist"].document.getElementById("listbase");
                var divHeight = divObj.scrollHeight;

                frameObj.setAttribute("height", divHeight);
            }
        }

        function setdetailframeheight() {

            var frameObj = document.getElementById("framedetail");
            var frameSrc = frameObj.getAttribute("src");

            if (frameSrc != "") {
                var divObj = window.frames["framedetail"].document.getElementById("detailbase");
                var divHeight = divObj.scrollHeight;
                frameObj.setAttribute("height", divHeight);

                frameObj = document.getElementById("framelist");
                frameObj.setAttribute("height", 0);
            }
        }

       // OLD open_detail
        function open_detail(value) {

            document.getElementById(value).style.height = "auto";
            document.getElementById(value).style.visibility = "visible";
        }
        
        // open opt_cautionitems
        function open_cautionitems(value) {

            var divObj = document.getElementById(value);

            divObj.style.height = "auto";

            var incHeight = divObj.scrollHeight;

            var currentHeight = window.parent.document.getElementById("framedetail").scrollHeight;

            window.parent.document.getElementById("framedetail").setAttribute("height", currentHeight + incHeight);

            divObj.style.visibility = "visible";
            //divObj.style.height = incHeight + "px"

            document.getElementById("cautionbutton").style.visibility = "hidden";
            document.getElementById("cautionbutton").style.height = "0px";
        }

// Google API - RSS Feed Setup for StaffBlog in XML
function rssfeedsetup_staffblog() {
    var feedUrl = "http://jpia-staffblog.blogspot.com/feeds/posts/default"
    //var feedUrl = "http://feeds.feedburner.com/jalpakstaffblog"
    var feedLimit = 20
    var feedPointer = new google.feeds.Feed(feedUrl)

    feedPointer.setNumEntries(feedLimit)
    feedPointer.setResultFormat(google.feeds.Feed.XML_FORMAT)
    feedPointer.load(displayfeed_blog)
}

// Google API - RSS Feed Setup for Latest Genchi in XML
function rssfeedsetup_localinfo() {
    var feedUrl = "http://jpia-localinfo.blogspot.com/feeds/posts/default"
    //var feedUrl = "http://feeds.feedburner.com/jalpaklocalinfo"
    var feedLimit = 20
    var feedPointer = new google.feeds.Feed(feedUrl)

    feedPointer.setNumEntries(feedLimit)
    feedPointer.setResultFormat(google.feeds.Feed.XML_FORMAT)
    feedPointer.load(displayfeed_localinfo)
}

// Google API - RSS Feed Setup for Snow Report
function rssfeedsetup_snowreport() {
    var feedUrl = "http://feeds.feedburner.com/WhistlerBlackcomb-SnowReport"
    var feedLimit = 1
    var feedPointer = new google.feeds.Feed(feedUrl)

    feedPointer.setNumEntries(feedLimit)
    feedPointer.setResultFormat(google.feeds.Feed.XML_FORMAT)
    feedPointer.load(displayfeed_snowreport)
}

// Google API - RSS Feed Setup for Whistler Genchi Report
function rssfeedsetup_whistlerreport() {
    var feedUrl = "http://jalpak-ski-report.blogspot.com/feeds/posts/default"
    var feedLimit = 6
    var feedPointer = new google.feeds.Feed(feedUrl)

    feedPointer.setNumEntries(feedLimit)
    feedPointer.setResultFormat(google.feeds.Feed.XML_FORMAT)
    feedPointer.load(displayfeed_whistlerreport)
}

// Google API - RSS Feed Setup for Whistler Photo Album
function rssfeedsetup_whistlerphoto() {
    var feedUrl = "http://ww1.whistlerblackcomb.com/rss/photos.xml"
    var feedLimit = 12
    var feedPointer = new google.feeds.Feed(feedUrl)

    feedPointer.setNumEntries(feedLimit)
    feedPointer.setResultFormat(google.feeds.Feed.XML_FORMAT)
    feedPointer.load(displayfeed_whistlerphoto)
}

// Google API - RSS Feed Setup for Yahoo Weather in XML
function rssfeedsetup_yahooweather(woeId) {

    var feedUrl = "http://weather.yahooapis.com/forecastrss?p=" + woeId + "&u=c";
    var feedLimit = 1;
    var feedPointer = new google.feeds.Feed(feedUrl);

    feedPointer.setNumEntries(feedLimit);
    feedPointer.setResultFormat(google.feeds.Feed.XML_FORMAT);

    feedPointer.load(displayfeed_yahooweather);
    
}

function displayfeed_yahooweather(result) {

    if (!result.error) {
        //var theFeeds = result.xmlDocument.getElementsByTagName('channel');
        //var imgSrc = result.xmlDocument.getElementsByTagName('url')[0].firstChild.nodeValue;
        var imgUrl = 'http://l.yimg.com/a/i/us/we/52/'

        var curTemp = result.xmlDocument.getElementsByTagName('item')[0].getElementsByTagName('yweather:condition')[0].getAttribute('temp');
        var curCond = result.xmlDocument.getElementsByTagName('yweather:condition')[0].getAttribute('code');
        
        var frcstHitemp = result.xmlDocument.getElementsByTagName('yweather:forecast')[1].getAttribute('high');
        var frcstLowtemp = result.xmlDocument.getElementsByTagName('yweather:forecast')[1].getAttribute('low');
        var frcstCond = result.xmlDocument.getElementsByTagName('yweather:forecast')[1].getAttribute('code');

        var cityName = result.xmlDocument.getElementsByTagName('yweather:location')[0].getAttribute('city');

        var cityLabel = "";
        
        switch (cityName) {
            case "Los Angeles":
                cityLabel = "ロサンゼルス";
                break;
            case "New York":
                cityLabel = "ニューヨーク";
                break;
            case "San Francisco":
                cityLabel = "サンフランシスコ";
                break;
            case "Las Vegas":
                cityLabel = "ラスベガス";
                break;
            case "Vancouver":
                cityLabel = "バンクーバー";
                break;
            default:
                return;
        }

        var feedContainer = document.getElementById('feeddiv_yahooweather');
       
        feedContainer.innerHTML += "<div style='border-top: solid 1px #E8E8E8;'></div>" + "<span style='font-weight: bold;font-decoration: underline;'>" + cityLabel + "</span><br /><table cellpadding='0' cellspacing='0' border='0' class='noborder'><colgroup><col width='70' /><col width='81' /></colgroup><tr><td valign='top'>今日<br /><img src='" + imgUrl + curCond + ".gif' alt='' /><br />気温：" + curTemp + "c</td><td valign='top'>明日<br /><img src='" + imgUrl + frcstCond + ".gif' alt='' /><br />最高気温" + frcstHitemp + "c<br />最低気温" + frcstLowtemp + "c</td></tr></table><br />";
    }
}

// Google API - RSS Display for Staff Blog in XML
function displayfeed_blog(result) {
    var feedContainer = document.getElementById("feeddiv_staffblog");
    var feedTitle = document.getElementById("feeddiv_title_staffblog");

    if (!result.error) {

        var theFeeds = result.xmlDocument.getElementsByTagName('entry');
        var blogTitle = result.xmlDocument.getElementsByTagName('title')[0].firstChild.nodeValue;
        var blogUrl = result.xmlDocument.getElementsByTagName('link')[0].getAttribute('href');
        var rssOutput = "";
        var titleString = "";
        var counter = 0;

        feedTitle.innerHTML = "<img src='/images/icon01.gif'><a href='" + blogUrl + "' target='_blank' class='navy'>" + blogTitle + "</a>";

        for (var i = 0;i < theFeeds.length;i++) {

            var pubDate = theFeeds[i].getElementsByTagName('published')[0].firstChild.nodeValue.slice(0, 10);
            var dateString = "[&nbsp;" + pubDate + "&nbsp;/&nbsp;" + theFeeds[i].getElementsByTagName('author')[0].getElementsByTagName('name')[0].firstChild.nodeValue + "&nbsp;]";


            try {
                titleString = theFeeds[i].getElementsByTagName('title')[0].firstChild.nodeValue
            }
            catch (e) {
                continue;
            }

            counter += 1

            if (counter > 9) {
                break;
            }

            var urlString = theFeeds[i].getElementsByTagName('link')[0].getAttribute('href')

            //DIV Start
            rssOutput += "<div><img src='/images/icon01.gif'>&nbsp;"

            //New Icon
            if (i < 2) {
                rssOutput += "<span style='font-size: 10px;color: #CC0000;'>NEW !!!&nbsp;</span>"
            }

            //Title
            rssOutput += "<span>" + "<a href='" + urlString + "' target='_blank' class='navy'>" + titleString + "</a></span><br />";

            //Published Date
            rssOutput += "<span style='font-size: 10px;color: Gray;'>&nbsp;&nbsp;&nbsp;&nbsp;" + dateString + "</span></div><br />";

        }
        feedContainer.innerHTML = rssOutput + "続きは<img src='/images/icon01.gif'><a href='" + blogUrl + "' target='_blank' class='navy'>こちら</a>！！！";
    }
    else {
        feedContainer.innerHTML = "RSSフィード取得エラー"
    }
}


// Google API - RSS Display for Local Info in XML
function displayfeed_localinfo(result) {
    var feedContainer = document.getElementById("feeddiv_localinfo");
    var feedTitle = document.getElementById("feeddiv_title_localinfo");

    if (!result.error) {

        var theFeeds = result.xmlDocument.getElementsByTagName('entry');
        var blogTitle = result.xmlDocument.getElementsByTagName('title')[0].firstChild.nodeValue;
        var blogUrl = result.xmlDocument.getElementsByTagName('link')[0].getAttribute('href');
        var rssOutput = "";
        var titleString = "";
        var counter = 0;

        feedTitle.innerHTML = "<img src='/images/icon01.gif'><a href='" + blogUrl + "' target='_blank' class='navy'>" + blogTitle + "</a>";

        for (var i = 0;i < theFeeds.length;i++) {

            var pubDate = theFeeds[i].getElementsByTagName('published')[0].firstChild.nodeValue.slice(0, 10);
            var dateString = "[&nbsp;" + pubDate + "&nbsp;/&nbsp;" + theFeeds[i].getElementsByTagName('author')[0].getElementsByTagName('name')[0].firstChild.nodeValue + "&nbsp;]";

            
            try {
                titleString = theFeeds[i].getElementsByTagName('title')[0].firstChild.nodeValue
            }
            catch(e) {
                continue;
            }

            counter += 1

            if (counter > 9) {
                break;
            }

            var urlString = theFeeds[i].getElementsByTagName('link')[0].getAttribute('href')

            //DIV Start
            rssOutput += "<div><img src='/images/icon01.gif'>&nbsp;"

            //New Icon
            if (i < 2) {
                rssOutput += "<span style='font-size: 10px;color: #CC0000;'>NEW !!!&nbsp;</span>"
            }

            //Title
            rssOutput += "<span>" + "<a href='" + urlString + "' target='_blank' class='navy'>" + titleString + "</a></span><br />";

            //Published Date
            rssOutput += "<span style='font-size: 10px;color: Gray;'>&nbsp;&nbsp;&nbsp;&nbsp;" + dateString + "</span></div><br />";

        }
        feedContainer.innerHTML = rssOutput + "続きは<img src='/images/icon01.gif'><a href='" + blogUrl + "' target='_blank' class='navy'>こちら</a>！！！";
    }
    else {
        feedContainer.innerHTML = "RSSフィード取得エラー"
    }
}


// Google API - RSS Display for Snow Report in XML
function displayfeed_snowreport(result) {
    var feedContainer = document.getElementById("feeddiv_snowreport");

    if (!result.error) {

        var theFeeds = result.xmlDocument.getElementsByTagName('item');
        var rssOutput = "";
        var contentString = "";
        var cutOff = 0;

        var pubDate = theFeeds[0].getElementsByTagName('pubDate')[0].firstChild.nodeValue;

//        var pubMonth = pubDate.slice(
//        var pubDay =
//        var pubYear =
//        var pubTime =



        var dateString = pubDate + "&nbsp;現在<br /><br />";

        try {
            contentString = theFeeds[0].getElementsByTagName('description')[0].firstChild.nodeValue

            //alert(contentString);
            
            cutOff = contentString.indexOf("Peak Winds");
            
            contentString = contentString.slice(0, cutOff - 8);
            contentString += "</table>";
            contentString = contentString.replace("<td colspan='2'><strong>Snow Conditions", "<td colspan='2' class='header'><strong>積雪情報");
            contentString = contentString.replace("New Snow:", "新雪");
            contentString = contentString.replace("Last 24 Hours:", "過去24時間の積雪");
            contentString = contentString.replace("Last 48 Hours:", "過去48時間の積雪");
            contentString = contentString.replace("Last 7 Days:", "過去1週間の積雪");
            contentString = contentString.replace("Mid-Mountain Base:", "中腹の積雪(1650m)");
            contentString = contentString.replace("Total Cumulative Snowfall:", "今シーズンの総降雪量");
            contentString = contentString.replace("Surface Conditions:", "");//雪のコンディション
            contentString = contentString.replace("<td colspan='2'><strong>Weather", "<td colspan='2' class='header'><strong>現在の気温");
            contentString = contentString.replace("Peak Temperature:", "ウィスラー山頂(2182m)");
            contentString = contentString.replace("Alpine Temperature:", "ウィスラー中腹(1850m)");
            contentString = contentString.replace("Village Temperature", "ウィスラービレッジ(675m)");
        }
        catch (e) {
            contentString = "RSSフィード取得エラー";
        }
            
        //Description
        rssOutput += "<div class='snowreport'>" + contentString + "</div>";

        //Published Date
        rssOutput += "<div class='spacer10'></div><div class='snowreport'>" + dateString + "</div>";

        feedContainer.innerHTML = rssOutput;
    }
    else {
        feedContainer.innerHTML = "RSSフィード取得エラー"
    }
}

// Google API - RSS Display for Whistler Photo Gallery in XML
function displayfeed_whistlerphoto(result) {
    var feedContainer = document.getElementById("feeddiv_whistlerphoto");
    var feedTitle = document.getElementById("feeddiv_title_whistlerphoto");

    if (!result.error) {

        var theFeeds = result.xmlDocument.getElementsByTagName('item');
        var blogUrl = result.xmlDocument.getElementsByTagName('link')[0].firstChild.nodeValue;
        var rssOutput = "";
        var titleString = "";
        var contentString = "";
        var urlString = "";
        var counter = 0;

        //blogUrl = blogUrl.replace("http://", "http://jpiaiis:8088/redirect1j.asp?url=");

        for (var i = 0;i < theFeeds.length;i++) {

            //var pubDate = theFeeds[i].getElementsByTagName('published')[0].firstChild.nodeValue.slice(0, 10);
            //var dateString = "[&nbsp;" + pubDate + "&nbsp;/&nbsp;" + theFeeds[i].getElementsByTagName('author')[0].getElementsByTagName('name')[0].firstChild.nodeValue + "&nbsp;]";


            try {
                titleString = theFeeds[i].getElementsByTagName('title')[0].firstChild.nodeValue
                contentString = theFeeds[i].getElementsByTagName('description')[0].firstChild.nodeValue
                urlString = theFeeds[i].getElementsByTagName('link')[0].firstChild.nodeValue
                
            }
            catch (e) {
                continue;
            }

            counter += 1

            if (counter > 10) {
                break;
            }

            var cutOff = contentString.indexOf("<img");

            contentString = contentString.slice(cutOff, contentString.length);

            contentString = contentString.replace("/>", "title='クリックすると拡大画像をご覧頂けます。' width='108' alt='' " + "class='photogallery' id='photo" + counter + "' onclick='openwebcam(this.id);' onmouseover='camHover(this.id);' onmouseout='camStatic(this.id);' />");

            //onmouseover="camHover(this.id, '#CC0000');" onmouseout="camStatic(this.id);"             
            
            //cutOff = contentString.indexOf("border=");

            //urlString = contentString.slice(10, cutOff - 2);

            //alert(contentString);
            
            //DIV Start
            rssOutput += "<div class='photogallery'>"

//onclick="openwebcam(this.id);"

            //Content
            //rssOutput += "<a href='" + urlString + "' target='_blank'>" + contentString + "</a></div>";
            rssOutput += contentString + "</div>";
        }
        feedContainer.innerHTML = rssOutput + "<div class='spacer10'></div><div style='clear: both;font-size: 10px;'>※画像をクリックすると拡大版をご覧頂けます<br />※写真館にある全写真は<img src='/images/icon01.gif'><a href='" + blogUrl + "' target='_blank' class='navy'>こちら</a>！！！</div>";
    }
    else {
        feedContainer.innerHTML = "RSSフィード取得エラー"
    }
}

// Google API - RSS Display for Whistler Genchi Report in XML
function displayfeed_whistlerreport(result) {
    var feedContainer = document.getElementById("feeddiv_whistlerreport");
    var feedTitle = document.getElementById("feeddiv_title_whistlerreport");

    if (!result.error) {

        var theFeeds = result.xmlDocument.getElementsByTagName('entry');
        var blogUrl = result.xmlDocument.getElementsByTagName('link')[0].getAttribute('href');
        var rssOutput = "";
        var titleString = "";
        var contentString = "";
        var counter = 0;


        for (var i = 0;i < theFeeds.length;i++) {

            var pubDate = theFeeds[i].getElementsByTagName('published')[0].firstChild.nodeValue.slice(0, 10);
            var dateString = "[&nbsp;" + pubDate + "&nbsp;/&nbsp;" + theFeeds[i].getElementsByTagName('author')[0].getElementsByTagName('name')[0].firstChild.nodeValue + "&nbsp;]";

            try {
                titleString = theFeeds[i].getElementsByTagName('title')[0].firstChild.nodeValue
                contentString = theFeeds[i].getElementsByTagName('content')[0].firstChild.nodeValue
            }
            catch (e) {
                continue;
            }

            counter += 1

            if (counter > 3) {
                break;
            }

            var urlString = theFeeds[i].getElementsByTagName('link')[0].getAttribute('href')

            //DIV Start
            rssOutput += "<div style='width: 240px;margin-bottom: 3px;border-bottom: solid 2px #E8E8E8;'><div>"


            //New Icon
            rssOutput += "<span style='font-size: 10px;color: #CC0000;'>NEW !!!&nbsp;</span>"

            //Title
            rssOutput += "<span style='font-size: 12px;font-weight: bold;'>" + titleString + "</span></div>";

            //Published Date
            rssOutput += "<div style='float: right;'><span style='font-size: 10px;color: Gray;'>&nbsp;&nbsp;&nbsp;&nbsp;" + dateString + "</span></div><div style='clear: both;'></div>";


            //Content
            rssOutput += "<div class='whistlerimg'>" + contentString + "</div></div>";

            //alert(contentString);

        }
        feedContainer.innerHTML = rssOutput + "<span style='font-size: 10px;'>続きは<img src='/images/icon01.gif'><a href='" + blogUrl + "' target='_blank' class='navy'>こちら</a>！！！</span>";
    }
    else {
        feedContainer.innerHTML = "RSSフィード取得エラー"
    }
}

// Google Search Box - Reset Text Field if left as default value
function resetsearchbox() {
    var currententry = document.getElementById('searchtext').getAttribute('value')
    if (currententry == 'www.jalpak.com内を検索できます') {
        document.getElementById('searchtext').setAttribute('value', '');
        document.getElementById('searchtext').style.color = 'black';
    }
}

function zoomclose_hover(divObj) {

    document.getElementById(divObj).style.backgroundColor = "#CC0000";
}

function zoomclose_static(divObj) {

    document.getElementById(divObj).style.backgroundColor = "Gray";
}

function piczoomclose_hover(divObj) {

    document.getElementById(divObj).style.backgroundColor = "#CC0000";
}

function piczoomclose_static(divObj) {

    document.getElementById(divObj).style.backgroundColor = "Gray";
}

function zoomreset() {

    document.getElementById('mlbpic').setAttribute("src", "/images/loadingpic.jpg");
    document.getElementById('ZoomedPic').style.visibility = 'hidden';
    setOpacity(document.getElementById('commonbaseDiv'), 100);
    document.getElementById('mlbpic').setAttribute('width', '');
    document.getElementById('mlbpic').setAttribute('height', '');

}

function piczoomreset() {

    document.getElementById('zoompicDiv').style.visibility = 'hidden';
    document.getElementById('zoompicDiv').style.width = '0px';
    document.getElementById('zoompicDiv').style.height = '0px';

    document.getElementById('zoompicImg').setAttribute("src", "/images/loadingpic.jpg");
    document.getElementById('zoompicImg').setAttribute('width', '900');
    document.getElementById('zoompicImg').setAttribute('height', '600');

    document.getElementById('zoompictitle').innerHTML = '';

    setOpacity(document.getElementById('commonbaseDiv'), 100);

}

function piczoom(imgObj) {

    //Fill Title
    document.getElementById('zoompictitle').innerHTML = document.getElementById('zoompictitle_src').innerHTML;

    //obtain id name to be used for part of file name
    var imgSrc = document.getElementById(imgObj).getAttribute("src").replace('tn_', '');
    //set img tag src attribue
    document.getElementById('zoompicImg').setAttribute("src", imgSrc);

    //obtain height/width info from thumbnail and calc height to width ratio
    var orgPicHeight = document.getElementById(imgObj).height;
    var orgPicWidth = document.getElementById(imgObj).width;
    var ratio = orgPicHeight / orgPicWidth;

    //width and height to be used for zoomed pic
    var picWidth = 0;
    var picHeight = 0;

    //determine ratio if it is V or H, set width/height according to current window size
    if (ratio < 1) {//Yokonaga
        picWidth = (document.documentElement.clientWidth * 0.7);
        picHeight = picWidth * ratio;
    } else {//Tatenaga
        picHeight = (document.documentElement.clientHeight * 0.85);
        picWidth = picHeight / ratio;
    }

    //position img based on window size
    var posLeft = (document.documentElement.clientWidth - picWidth) / 2;
    var posTop = (document.documentElement.clientHeight - picHeight) / 2;

    //error trap in case position is less than zero
    if (posLeft <= 0) {
        posLeft = 10;
    }
    if (posTop <= 0) {
        posTop = 10;
    }

    //set style for img
    document.getElementById('zoompicDiv').style.width = picWidth + 'px';
    document.getElementById('zoompicDiv').style.height = 'auto';
    document.getElementById('zoompicDiv').style.left = posLeft + 'px';
    document.getElementById('zoompicDiv').style.top = (document.documentElement.scrollTop + posTop - 10) + 'px';
    document.getElementById('zoompicDiv').style.visibility = 'visible';

    //resize zoomed img
    document.getElementById('zoompicImg').setAttribute('width', picWidth);
    document.getElementById('zoompicImg').setAttribute('height', picHeight);

    //blur background
    setOpacity(document.getElementById('commonbaseDiv'), 20);

}

function searchOn() {
    try {
        document.getElementById('searchbox').style.backgroundColor = "White";
        document.getElementById('searchbox').style.borderColor = "Gray";
        document.getElementById('searchbox').style.borderWidth = "2px";
        document.getElementById('searchbox').style.padding = "2px 0px 0px 4px";

        document.getElementById('searchbox').style.opacity = 1.0;
        document.getElementById('searchbox').filters.alpha.opacity = 100;
    } catch (e) { }
}

function searchOff() {
    try {
        var customSearchControl = new google.search.CustomSearchControl('015027169135932676145:yclgb9ffaoc');
        customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
        customSearchControl.draw('cse');

        document.getElementById('searchbox').style.backgroundColor = "Transparent";
        document.getElementById('searchbox').style.borderColor = "White";
        document.getElementById('searchbox').style.borderWidth = "0px";
        document.getElementById('searchbox').style.padding = "4px 2px 2px 6px";

        document.getElementById('searchbox').style.opacity = 0.6;
        document.getElementById('searchbox').filters.alpha.opacity = 60;
    } catch (e) { }
}



function zoom(imgObj) {

    //obtain id name to be used for part of file name
    var picFileName = document.getElementById(imgObj).id;
    //set img tag src attribue
    document.getElementById('mlbpic').setAttribute("src", "/images/mlb/camp2010_" + picFileName + ".jpg");

    //obtain height/width info from thumbnail and calc height to width ratio
    var orgPicHeight = document.getElementById(imgObj).firstChild.height;
    var orgPicWidth = document.getElementById(imgObj).firstChild.width;
    var ratio = orgPicHeight / orgPicWidth;

    //width and height to be used for zoomed pic
    var picWidth = 0;
    var picHeight = 0;

    //determine ratio if it is V or H, set width/height according to current window size
    if (ratio < 1) {//Yokonaga
        picWidth = (document.documentElement.clientWidth * 0.7);
        picHeight = picWidth * ratio;
    }else {//Tatenaga
        picHeight = (document.documentElement.clientHeight * 0.85);
        picWidth = picHeight / ratio;
    }

    //resize zoomed img
    document.getElementById('mlbpic').setAttribute('width', picWidth);
    document.getElementById('mlbpic').setAttribute('height', picHeight);
    
    //position img based on window size
    var posLeft = (document.documentElement.clientWidth - picWidth) / 2;
    var posTop = (document.documentElement.clientHeight - picHeight) / 2;

    //error trap in case position is less than zero
    if (posLeft <= 0) {
        posLeft = 10;
    }
    if (posTop <= 0) {
        posTop = 10;
    }

    //set style for img
    document.getElementById('ZoomedPic').style.width = picWidth;
    document.getElementById('ZoomedPic').style.left = posLeft + 'px';
    document.getElementById('ZoomedPic').style.top = (document.documentElement.scrollTop + posTop - 10) + 'px';
    document.getElementById('ZoomedPic').style.visibility = 'visible';

    //blur background
    setOpacity(document.getElementById('commonbaseDiv'), 20);

}

function hover_menu (divObj) {

    document.getElementById(divObj).style.backgroundPosition = "bottom center";
}

function static_menu(divObj) {

    document.getElementById(divObj).style.backgroundPosition = "top center";
}

function setActive(tabObj) {

    try {
        document.getElementById(tabObj).style.backgroundColor = '#CC0000';
    }
    catch (e) {
        //nothing
    }
}

function setSidebar() {
    try {
        var isSidebar = document.getElementById('sidebarDiv').innerHTML;
        if (isSidebar.length == 0) {
            document.getElementById('contentbaseDiv').style.styleFloat = 'none';
            document.getElementById('contentbaseDiv').style.marginLeft = 'auto';
            document.getElementById('contentbaseDiv').style.marginRight = 'auto';
            document.getElementById('sidebarDiv').style.width = '0px';
            document.getElementById('sidebarDiv').style.height = '0px';
            document.getElementById('sidebarDiv').style.paddingLeft = '0px';
            document.getElementById('sidebarDiv').style.visibility = 'hidden';
        }
    } catch (e) { }
}

function ShowAndHide(showDiv, hideDiv) {
    var showStyle = document.getElementById(showDiv).style;
    var hideStyle = document.getElementById(hideDiv).style;

    showStyle.visibility = "visible";
    hideStyle.visibility = "hidden";

    showStyle.height = "auto";
    hideStyle.height = "0px";

    //showStyle.width = "702px";
    //hideStyle.width = "0px";

    showStyle.padding = "20px 10px 10px 10px";
    hideStyle.padding = "0px 0px 0px 0px";
}

function openSVinquiry() {
    try {
        var cur_href = document.location.href;
        var end = (cur_href.indexOf("?") == -1) ? cur_href.length : cur_href.indexOf("?");
        var cur_filename = cur_href.substring(cur_href.lastIndexOf("/") + 1, end);
        var svcode = cur_filename.slice(0, 6);
        var svtitle = encodeURIComponent(document.getElementById('svtitle').innerHTML);
        var url2open = 'https://www.jalpak.com/optionaltour/emailservice/opt_inquiry.aspx?svcode=' + svcode + '&svtitle=' + svtitle;
        var setHeight = screen.availHeight - 150;
        if (setHeight >= 850) {
            setHeight = 850;
        }
        var windowParm = 'toolbar=no,status=yes,menubar=no,location=yes,directories=yes,scrollbars=yes,width=956,height=' + setHeight;
        window.open(url2open, '', windowParm);
    } catch (e) {
    alert('お詫び：お問い合わせの機能をお使い頂けません。申し訳ありませんが少し時間をおいてから再度ご利用ください。');
    }
}

function swapImg(divObj) {
    for (var i = 0; i < endIndex; i++) {
        document.getElementById("Switch_" + i).style.backgroundColor = "White";
    }
    var imgIndex = document.getElementById(divObj).id.toString();
    imgIndex = imgIndex.slice(7, 8);

    document.getElementById("topIMG").setAttribute("src", "/images/titleimage_" + String(imgIndex) + fileExt);
    document.getElementById("topIMG").setAttribute("title", imgTitle[imgIndex]);

    document.getElementById("topAnchor").setAttribute("target", anchorTarget[imgIndex]);
    document.getElementById("topAnchor").setAttribute("href", url[imgIndex]);

    document.getElementById(divObj).style.backgroundColor = "Pink";
}