// JavaScript Document
function openWin(URL,args,Width,Height,isResize,Style)
{
	var newWin,param;
	if(typeof(isResize)=="undefined")isResize=false;
	if(typeof(Style)=="undefined")
	{Style=0;}
	else if(isNaN(Style)==true)
	{Style=0;}
	
	if(Style==1 || Style==2)
	{
		param="dialogWidth:"+Width+"px;";
		param+="dialogHeight:"+Height+"px;";
		if(isResize)
		{param+="resizeable:yes;";}
		else
		{param+="resizable:no;";}
		param+="edge:raised;enter:yes;help:no;status:no;";
		if(Style==1)
		{newWin=window.showModalDialog(URL,args,param);}
		else
		{window.showModelessDialog(URL,args,param);}
		return newWin;
	}
	else
	{
		param="width="+Width+""
		param+=",height="+Height;
		if(isResize)
		{param+=",resize=1"}
		else
		{param+=",resize=0"}
		param+=",toolbar=0,menubar=0,scrollbars=0,location=0,status=1;"
		
		newWin=window.open(URL,args,param);
		newWin.focus();
		return newWin;
	}		
}

function openLink(obj)
{
	var newWin;
	if(obj.options[obj.selectedIndex].text!=obj.options[obj.selectedIndex].value && obj.options[obj.selectedIndex].value!="")
	newWin=window.open(obj.value);	
	if(typeof(newWin)=="undefined")
	{
			if(window.confirm("你的浏览器禁止了弹出新窗口,是否在当前窗口打开链接?"))
			{window.location.href=obj.value;}
	}
	newWin=null;
	obj.selectedIndex=0;
}

function WriteFlash(FlashUrl,width,height,vspace)
{
	var strMsg="";
	strMsg+="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"";
	strMsg+=" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\"";
	if(!isNaN(vspace))strMsg+=" vspace=\""+vspace+"\"";
	strMsg+=" width=\""+width+"\" height=\""+height+"\">\n";
	strMsg+="<param name=\"movie\" value=\""+FlashUrl+"\">";
	strMsg+="<param name=\"quality\" value=\"high\">";
	strMsg+="<param name=\"wmode\" value=\"transparent\">";
	strMsg+="<param name=\"SCALE\" value=\"exactfit\">";
	strMsg+="<embed src=\""+FlashUrl+"\"";
	strMsg+=" width=\""+width+"\"";
	strMsg+=" height=\""+height+"\"";
	strMsg+=" quality=\"high\"";
	if(!isNaN(vspace))strMsg+=" vspace=\""+vspace+"\"";
	strMsg+=" SCALE=\"exactfit\"";
	strMsg+=" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"";
	strMsg+=" wmode=\"transparent\"";
	strMsg+="\/>";
	strMsg+="</object>";
	document.writeln(strMsg);
}

function addFavorite(Url,Title)
{
	try
	{
		window.external.AddFavorite(Url,Title);
		return true;
	}
	catch(e)
	{
		alert("执行失败,可能是你的浏览器不是IE或已经关闭脚本执行功能!");
		return false;
	}
}

function setHomePage(obj,Url)
{
	try
	{
		obj.style.behavior="url(#default#homepage)";
		obj.setHomePage(Url);
		obj.style.behavior="";
		return true;
	}
	catch(e)
	{
		alert("执行失败,可能是你的浏览器不是IE或已经关闭脚本执行功能!");
		return false;
	}
}


function uploadImage(obj)
{
	alert(WebRoot+obj.value)
}


function selCheckBox(selButton,childButtons)
{
	try
	{
		var bolSel=selButton.checked;
		selButton.setAttribute("checked",bolSel)
		if(typeof(childButtons)=="undefined")
		{return false;}
		else if(typeof(childButtons.length)=="undefined" && typeof(childButtons)=="object")
		{childButtons.checked=bolSel;}
		else if(typeof(childButtons.length)=="number")
		{
			for(var i=0;i<childButtons.length;i++)
			childButtons[i].checked=bolSel;
		}
		return true;
	}
	catch(e)
	{
		alert(e.message);
		return false;
	}
}
