﻿
    function ShowModalDialog(target,openUrl,Width,Height){
        var returnValue = window.showModalDialog(openUrl, window, 
                             'dialogWidth:'+Width+'; dialogHeight:'+Height+'; center:yes; help:no; status:no; scroll:no; resizable:no');
        if (returnValue != null && returnValue != 'undifined'){
            if (target != ""){
                document.getElementById(target).value = returnValue;
            }
            else{
                if (returnValue == "OK"){
                    location.reload();
                }
            }
        }
    }
    function ShowImageDialog(image, target, openUrl, Width, Height){
        var returnValue = window.showModalDialog(openUrl, window, 
                             'dialogWidth:'+Width+'; dialogHeight:'+Height+'; center:yes; help:no; status:no; scroll:no; resizable:no');
        if (returnValue != null && returnValue != 'undifined'){
            if (target != ""){
                document.getElementById(image).src = returnValue.split("|")[0];
                document.getElementById(image).style.display = "block";
                document.getElementById(target).value = returnValue.split("|")[1];
            }
            else{
                if (returnValue == "OK"){
                    location.reload();
                }
            }
        }
    }
    
    function OpenCenterWindow(url, winName, width, height)
    {
        var iTop = (window.screen.availHeight - 30 - height)/2;
        var iLeft = (window.screen.availWidth - 10 - width)/2;
        if (window.dialogArguments != null){
            window.dialogArguments.open(url,winName,'width='+width+',height='+height+',left='+ iLeft +',top='+ iTop +', toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
        }
        else{
            window.open(url,winName,'width='+width+',height='+height+',left='+ iLeft +',top='+ iTop +', toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
        }
    }
    // 生成FLASH
function flashDraw(name,url,width,height,color,transparent) {
	if(transparent==null) transparent = false;
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
	document.write(' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"');
	document.write(' width=' + width + ' height="'+ height +'" name="' + name + '" id="' + url + '" align="middle">');
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="movie" value="' + url + '" />');
	document.write('<param name="quality" value="high" />');
	if(transparent)
		document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="'+url+'" width="'+width+'" height="'+height+'" quality=\"high\" wmode=\"transparent\"');
	document.write('pluginspage=\"http://www.macromedia.com/go/getflashplayer\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\"></embed>');
	if(color != "")
	    document.write('<param name="bgcolor" value="'+color+'" />');
	document.write('</object>');
}