﻿function addSels(SelName,nvlist,IsClear)
{		
	if(IsClear=="clear")
	{
		clearSel(SelName);
	}
	
	if(nvlist.length==0)
	return;	
	
	var A=nvlist.split("|");
	
	if(A.length % 2 !=0)
	{
		clearSel(SelName);
		return;
	}
	
	var Sel=document.getElementById(SelName);
	var item;
	//alert(A.length);
	for(var i=0;i<A.length;i+=2)
	{
		
		item=new Option(A[i+1],A[i]);
		try{Sel.add(item);}catch(e){}	
	}	
}
function addSel(SelName,n,v)
{	var item=new Option(n,v);
	try{
		var Sel=document.getElementById(SelName);
		Sel.add(item);
	}catch(e){}	
}
function clearSel(SelName)
{
	try{	
	var Sel=document.getElementById(SelName);
	//alert("ALL:"+Sel.length);
	for(i=Sel.length-1;i>=0;i--)
	{		
		Sel.remove(i);
	}		
	}catch(e){}	
}

function play_flv(flv_flash_name,tW,tH)
{
	var flash_a='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"   WIDTH='
	+tW
	+' HEIGHT='
	+tH
	+'>'
	+'<embed src="/Templet/Media/play_flv.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
	+'type="application/x-shockwave-flash" width="'
	+tW
	+'" height="'
	+tH
	+'" wmode="transparent" ></embed>'
	+'<param name=WMODE value=Transparent>'	
	+'<PARAM NAME=movie VALUE="/Templet/Media/play_flv.swf"></OBJECT>'
	
	document.write(flash_a);
}

function flashnews(_width,_height,photo,url){
	
	var interval_time=5;
	var focus_width=_width;
	var focus_height=_height;
	var text_height=0;
	var text_mtop = 0;
	var text_lm = 0;
	var textmargin = text_mtop+"|"+text_lm;
	var textcolor = "#ff0000|0x000000";
	var text_align= 'left';
	var swf_height = focus_height+text_height+text_mtop;
	var borderStyle="0|0xaeaeae|100";

	var pics=photo; //'/flash/a.jpg|/flash/a.jpg';
	//alert(url);
	url=url.replace(/\&/g,"$");
	//alert(url);
	var links=url; //'#|#';
	var texts='';

	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'
				   + focus_width +'" height="'+ swf_height +'">');
	document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/Templet/Media/hotnews.swf"> <param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics='
	+pics+'&links='+links
	+'&texts='+texts+'&borderwidth='
	+focus_width+'&borderheight='
	+focus_height+'&textheight='
	+text_height+'&textmargin='
	+textmargin+'&textcolor='
	+textcolor+'&borderstyle='
	+borderStyle+'&text_align='
	+text_align+'&interval_time='
	+interval_time+'">');
	document.write('<embed src="/Templet/Media/hotnews.swf" wmode="opaque" FlashVars="pics='
	+pics+'&links='+links+'&texts='+texts+'&borderwidth='
	+focus_width+'&borderheight='+focus_height+'&textheight='
	+text_height+'&textmargin='+textmargin+'&textcolor='
	+textcolor+'&borderstyle='+borderStyle+'&text_align='
	+text_align+'&interval_time='+interval_time
	+'" menu="false" bgcolor="#ffffff" quality="high" width="'
	+ focus_width +'" height="'+ swf_height 
	+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"'
	+' pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
	
}

function formActionWD(f,fAction){
	//try{
		controlWindow=window.open(fAction
		,"surveywin"
		,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=300");
		document.all[f].target="surveywin";
		var selfAction=document.all[f].action;
		document.all[f].action=fAction;		
		document.all[f].submit();
		document.all[f].target="_self";
		document.all[f].action=selfAction;
		
		
	//}catch(E){}
}
function reloadPrePage()
{
	var parentWin = window.dialogArguments;
	parentWin.location.reload();
}

function openJsWD(_target,widtha,heighta)
{
window.open(_target, "_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="
+widtha+",height="
+heighta);
}

function localPageName()
{
	try{
			var   s   =   document.location.href;   
	  	s   =   s.substr(s.lastindexof("/")+1);   
	  return s;
  }catch(E){
  	return "";
  }
}

function print_TransFlash(flash_name,tW,tH)
{
	var flash_a='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"   WIDTH='
	+tW
	+' HEIGHT='
	+tH
	+'>'
	+'<embed src="'
	+flash_name
	+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" '
	+'type="application/x-shockwave-flash" width="'
	+tW
	+'" height="'
	+tH
	+'" wmode="transparent" ></embed>'
	+'<param name=WMODE value=Transparent>'
	+'<PARAM NAME=movie VALUE="'
	+flash_name
	+'"></OBJECT>'
	document.write(flash_a);
}

function print_Flash(flash_name,tW,tH)
{
	var flash_a='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"   WIDTH='
	+tW
	+' HEIGHT='
	+tH
	+'><PARAM NAME=movie VALUE="'
	+flash_name
	+'"><EMBED src="'
	+flash_name
	+'" WIDTH='
	+tW
	+' HEIGHT='
	+tH
	+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>'
	document.write(flash_a);
}

function CopyHtml(tDivFrom,tDivTarget,tLen,tVar,keepI_A)
{
	tDivTarget.innerHTML =tDivTarget.innerHTML+tDivFrom.innerHTML;
	try
	{
		for(i=1;i<=tLen;i++)
		{
			var correI=tVar.length-i;
			for(var k=0;k<keepI_A.length;k++)
			if(i.toString() != keepI_A[k].toString())
				tVar[correI].value="";
		}
	}catch(e){

	}
}


function ShowWindow(url, width, height)
{
	try{		
		var arr = showModelessDialog(url+"&A="+Math.random(), window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:yes;status:no");
	}catch(e){}
}

function ShowDialog(url, width, height)
{
	try{		
		var arr = showModalDialog(url+"&A="+Math.random(), window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
	}catch(e){}
}

function CopyAllHtml(tDivFrom,tDivTarget)
{
	try
	{
	document.getElementById(tDivTarget).innerHTML
		=document.getElementById(tDivTarget).innerHTML
			+document.getElementById(tDivFrom).innerHTML;
	}catch(e){

	}
}

function CopyKAllHtml(tDivFrom,tDivTarget,VarName,clearIndexList)
{
	try
	{
	document.getElementById(tDivTarget).innerHTML
		=document.getElementById(tDivTarget).innerHTML
			+document.getElementById(tDivFrom).innerHTML;	
	}catch(e){}
	try
	{
		if(clearIndexList.length==0)
			return;

		var tCheckBtn=document.getElementsByName(VarName);
		var allNul=tCheckBtn.length;
		var tListA=clearIndexList.split('|');
		var tListAN=tListA.length;
		
		if (allNul==undefined || tListAN==undefined)
			return;


		if(allNul<tListAN)
			return;

		for(var k=0;k<tListAN;k++)
		{
			var clearIndex=allNul-tListA[k];
			if(clearIndex>=0 && clearIndex<allNul)
			tCheckBtn[clearIndex].value="";
		}

	}catch(e){

	}
}

function objS_H(objName){
	try{
		
		if(document.getElementById(objName).style.display=="")
		{
			document.getElementById(objName).style.display='none';
		}else{
			document.getElementById(objName).style.display="";
		}
	}catch(e){}
}

function srcPIC(obj,tPic)
{
	try{
		obj.src=tPic;
		}catch(e){}
}

function newAjax()
{
	var xmlHttp;
	if(window.ActiveXObject)
	{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		
	}else if(window.XMLHttpRequest){
		xmlHttp=new XMLHttpRequest();
	}
	return xmlHttp;
}

function setHTML(obj,val)
{
	try{
	document.getElementById(obj).innerHTML=val;		
	}catch(e){}
}
function setVALUE(obj,val)
{
	try{
		document.getElementById(obj).value=val;
		
	}catch(e){}
}
function ER(str)
{
	if(str=="")
		return "<font color=green>√</font>";
	
	return "<font color=red>×</font><font color=red> "+str+"</font>";
}



