﻿
var bInitDialog = false

function initDialog()
{
if (bInitDialog) return
bInitDialog = true
document.write("<span id='dialogBox' style='display:none; z-index:10001'></span>")
document.write("<div id='dialogBoxShadow' style='display:none; z-index:10000' onclick='closeDialog()'></div>")
}

initDialog()
var dialogWidth
var dialogHeight

function showDialog(url, width, height, title)
{
dialogWidth = width
dialogHeight = height
var s
if (url == "http://211.152.36.149:8080/flash/main-2010.html")
{
s = "<embed wmode='opaque' src='/2010flash/flash/main-2010.swf' quality='high' bgcolor='#FFFFFF' width='997' height='547' name='myFlash' swLiveConnect='true' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"
}
else
{
s = "<embed wmode='opaque' src='/2010flash/flash/main.swf' quality='high' bgcolor='#FFFFFF' width='997' height='547' name='myFlash' swLiveConnect='true' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"
}
dialogBox.innerHTML = s
dialogBox.style.position = "absolute"
dialogBox.style.top = (document.body.clientHeight - height) / 2 + document.body.scrollTop
dialogBox.style.left = (document.body.clientWidth - width) / 2 + document.body.scrollLeft
dialogBox.style.display = ""
showShadow()
window.attachEvent("onresize", window_onresize)
dialogBox.attachEvent("onmousedown", dialogBox_onmousedown)
dialogBox.attachEvent("onmouseup", dialogBox_onmouseup)
window.document.attachEvent("onmousemove", window_document_onmousemove)
}

function closeDialog()
{
dialogBox.innerHTML = ""
closeShadow()
window.detachEvent("onresize", window_onresize)
}

var bDrag = false
var xDrag
var yDrag

function dialogBox_onmousedown()
{
bDrag = true
xDrag = dialogBox.offsetLeft - window.event.x
yDrag = dialogBox.offsetTop - window.event.y
}

function window_document_onmousemove()
{
if (!bDrag) return 
dialogBox.style.top = window.event.y + yDrag
dialogBox.style.left = window.event.x + xDrag
}

function dialogBox_onmouseup()
{
bDrag = false
}

function showShadow()
{
var oShadow = dialogBoxShadow
oShadow['style']['position'] = "absolute"
oShadow['style']['display']	= ""
oShadow['style']['opacity']	= "0.6"
oShadow['style']['filter'] = "alpha(opacity=60)"
oShadow['style']['background'] = "#000"
oShadow['style']['top'] = "0px"
oShadow['style']['left'] = "0px"

oShadow['style']['width'] = (document.body.scrollLeft + document.body.clientWidth) + "px"
oShadow['style']['height'] = (document.body.scrollTop + document.body.clientHeight) + "px"
window.setTimeout("resetShadow()", 1)
}

function closeShadow()
{
dialogBoxShadow.style.display = "none"
}

function resetShadow()
{
var oShadow = dialogBoxShadow;
oShadow['style']['width'] = document.body.scrollWidth + "px";
oShadow['style']['height'] = document.body.scrollHeight + "px";
}

function window_onresize()
{
dialogBox.style.top = (document.body.clientHeight - dialogHeight) / 2 + document.body.scrollTop
dialogBox.style.left = (document.body.clientWidth - dialogWidth) / 2 + document.body.scrollLeft
showShadow()
}

