﻿//if (self != top) {
//    top.location.replace("http://tw.search.yahoo.com/search;_ylt=A3TWBZJP0a5MnRIA33Br1gt.?p=%E5%A4%A7%E5%AD%B8%E7%9C%BC%E7%A7%91&fr2=sb-top&fr=yfp&rd=r1");
//}


//首頁
var eventWait2Run = null;
var now_flvMovie = null;

function str_flvMovie(swfName, _Str, _w, _h) {
    return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + _w + '" height="' + _h + '" id="' + swfName + '" title="' + _Str + '"><param name="movie" value="' + swfName + '.swf" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><object type="application/x-shockwave-flash" data="' + swfName + '.swf" width="' + _w + '" height="' + _h + '"><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="/Scripts/expressInstall.swf" /></object></object><script type="text/javascript">swfobject.registerObject("' + swfName + '");</script>';
}


function str_flashBanner(swfName, _Str, _w, _h) {
    return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + _w + '" height="' + _h + '" id="' + swfName + '" title="' + _Str + '"><param name="movie" value="Swf/' + swfName + '.swf" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><object type="application/x-shockwave-flash" data="Swf/' + swfName + '.swf" width="' + _w + '" height="' + _h + '"><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="/Scripts/expressInstall.swf" /></object></object><script type="text/javascript">swfobject.registerObject("' + swfName + '");</script>';
}


YUI().use("node", function(Y) {
    var newKind = function(e, getKind) {
        eventWait2Run = getKind;
        Y.Lang.later(300, Y, function() {
            if (eventWait2Run != getKind) return;

            getObj = Y.one("#newsTitle");

            if (getKind == 'News') {
                getObj.setStyle('background', 'url(/Images2/home/main_newsTitle.gif) left top no-repeat');
            }
            if (getKind == 'Media') {
                getObj.setStyle('background', 'url(/Images2/home/main_newsTitle.gif) left -30 no-repeat');
            }
            if (getKind == 'Medical') {
                getObj.setStyle('background', 'url(/Images2/home/main_newsTitle.gif) left -60 no-repeat');
            }

            Y.one("#News").setStyle('display', 'none');
            Y.one("#Media").setStyle('display', 'none');
            Y.one("#Medical").setStyle('display', 'none');

            Y.one("#" + getKind).setStyle('display', 'block');
        });
    }

    var mLClick = function(e) {
        myThis = e.currentTarget;
        var MID = myThis.get('id').replace('mL0', '');
        var _Str = "";
        if (MID == 1) {
            _Str = "Z-LASIK 原理與優勢";
        } else if (MID == 2) {
            _Str = "Z-LASIK 術前檢查";
        } else if (MID == 3) {
            _Str = "Z-LASIK 手術步驟";
        } else if (MID == 4) {
            _Str = "Z-LASIK 與傳統無刀比較篇";
        } else if (MID == 5) {
            _Str = "Z-LASIK 見證篇";
        }

        document.getElementById("movie").innerHTML = str_flvMovie('homeMovie' + MID, _Str, 204, 200);

        now_flvMovie = 'homeMovie' + MID;
        Y.one("#mL01").replaceClass('over', 'out');
        Y.one("#mL02").replaceClass('over', 'out');
        Y.one("#mL03").replaceClass('over', 'out');
        Y.one("#mL04").replaceClass('over', 'out');
        Y.one("#mL05").replaceClass('over', 'out');
        myThis.replaceClass('out', 'over');
    }

    var mLarge = function(e) {
        Y.one("#bigMVArea").setStyle('display', 'block');
        Y.on("click", function() {
            document.getElementById("bigMV").innerHTML = "";
            Y.one("#bigMVArea").setStyle('display', 'none');
            document.getElementById("movie").innerHTML = str_flvMovie(now_flvMovie, '', 204, 200);
        }, "#bMVClose");

        document.getElementById("movie").innerHTML = "";
        document.getElementById("bigMV").innerHTML = str_flvMovie(now_flvMovie + 'f', "全國實績近視治療突破 (大尺寸)", 420, 360);
    }

    var init = function() {
        Y.on("mouseover", newKind, "#NewsBtn", this, 'News');
        Y.on("mouseover", newKind, "#MediaBtn", this, 'Media');
        Y.on("mouseover", newKind, "#MedicalBtn", this, 'Medical');
        Y.on("mouseout", function() { eventWait2Run = null }, "#NewsBtn");
        Y.on("mouseout", function() { eventWait2Run = null }, "#MediaBtn");
        Y.on("mouseout", function() { eventWait2Run = null }, "#MedicalBtn");


        Y.on("click", mLClick, "#mL01");
        Y.on("click", mLClick, "#mL02");
        Y.on("click", mLClick, "#mL03");
        Y.on("click", mLClick, "#mL04");
        Y.on("click", mLClick, "#mL05");
        Y.on("click", mLarge, "#movieMask");


        Y.one("#Media").setStyle('display', 'none');
        Y.one("#Medical").setStyle('display', 'none');

        document.getElementById("flashBanner").innerHTML = str_flvMovie('homeMovie6', "全國實績近視治療突破", 215, 162);

        document.getElementById("movie").innerHTML = str_flvMovie('homeMovie1', "Z-LASIK 原理與優勢", 204, 200);
        now_flvMovie = 'homeMovie1';



        document.getElementById("forBannerBg").innerHTML = str_flashBanner('banner-head20101224', "JCI認證、萬人實證", 930, 200);

        document.getElementById("homeMarquee").innerHTML = '<marquee scrollamount="2" scrolldelay="10" width="100%" oonmouseover="this.stop();" oonmouseout="this.start();"></marquee>'
    }



    Y.on("domready", init);
})

function expExpand(getThis, getID) {
    getThis.style.display = 'none';
    document.getElementById("cont" + getID).style.height="inherit";
}
