/* config */
var demofilm = 'GbDPy9fNK6A';
/*--------*/

/* utilities */
function getWinWidth(){
    if(window.innerWidth)
        return window.innerWidth;
    else
        return document.body.clientWidth;
}

function getWinHeight(){
    if(window.innerHeight)
        return window.innerHeight;
    else
        return document.body.clientHeight;
}
function getScrollY(){
    if(document.body.scrollTop)
        return document.body.scrollTop;
    else if(document.documentElement.scrollTop)
        return document.documentElement.scrollTop;
    else if(window.scrollY)
        return window.scrollY;
    else
        return 0;
}

/*--------*/


var mask = document.createElement('div');
mask.style.position='absolute';
mask.style.left='0px';
mask.style.top='0px';
mask.style.width = '100%';
mask.style.height='100%';
mask.style.zIndex='5';
mask.style.backgroundColor='black';
if(navigator.userAgent.indexOf('MSIE')!=-1)
    mask.style.filter='Alpha(Opacity=60)'; 
else
    mask.style.opacity='0.6';
var dialog = document.createElement('div');
dialog.style.position='absolute';
dialog.style.zIndex='6';
dialog.style.width='720px';
dialog.style.height='506px';
dialog.style.backgroundColor='white';
dialog.style.border='1px solid #603A14';
dialog.style.display='none';
document.body.appendChild(dialog);

mask.style.display='none';
document.body.appendChild(mask);

document.getElementById('play-video').onclick = function(){
    mask.style.display='block';
    dialog.style.display='block';
    dialog.innerHTML='<div style="border-bottom: 1px solid #8C673C;height:25px;background:url(image/bg_window_bar.png) repeat-x;"><img alt="標題" src="image/title_play_video.png" style="float:left;"><img style="float:right;cursor:pointer;" src="image/close_window.png" alt="關閉視窗" onclick="hide_video();"></div><object width="720" height="480"><param name="movie" value="http://www.youtube.com/v/'+demofilm+'&rel=0&color1=0xb1b1b1&color2=0xcfcfcf&hl=zh_TW&feature=player_detailpage&hd=1&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/'+demofilm+'&rel=0&color1=0xb1b1b1&color2=0xcfcfcf&hl=zh_TW&feature=player_detailpage&fs=1&hd=1&autoplay=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="720" height="480"></embed></object>';
    dialog.style.top=(mask.offsetHeight-480)/2+'px';
    dialog.style.left=(mask.offsetWidth-720)/2+'px';
}

function hide_video(){
    dialog.style.display='none';
    mask.style.display='none';
}
