//by yjcity.com ########################################################
function sel_type(trsurl,turl)
{
	var sn,i,wdim,temp1,nurl;
	wdim=turl.split("|");
	sn=wdim.length;
	for (i=0;i<sn;i++)
	{
	nurl=wdim[i];
		temp1="<OPTION value='"+nurl+"'";
		if (trsurl==nurl) { temp1+=" selected"; }
		temp1+=">"+nurl+"</option>";
	document.write(temp1);
	}
}

function sel_type2(trsurl,turl)
{
	var sn,i,wdim,temp1,nurl;
	wdim=turl.split("|");
	sn=wdim.length;
	for (i=0;i<sn;i++)
	{
	nurl=wdim[i];
		temp1="<OPTION value='"+i+"'";
		if (trsurl==i) { temp1+=" selected"; }
		temp1+=">"+nurl+"</option>";
	document.write(temp1);
	}
}

function sel_type3(trsurl,turl1,turl2)
{
	var sn,i,wdim1,wdim2,temp1,nurl1,nurl2;
	wdim1=turl1.split("|");
	wdim2=turl2.split("|");
	sn=wdim1.length;
	for (i=0;i<sn;i++)
	{
	nurl1=wdim1[i];
	nurl2=wdim2[i];
		temp1="<OPTION value='"+nurl1+"'";
		if (trsurl==nurl1) { temp1+=" selected"; }
		temp1+=">"+nurl2+"</option>";
	document.write(temp1);
	}
}

function checkbox_type(trsurl,turl,frmName,tdNum)
{
	document.write("<table border='0' cellPadding='2' cellSpacing='0' width='100%'><tr>");
	var sn,i,wdim,temp1,nurl,nurl2;
	trsurl=","+trsurl+","
	wdim=turl.split("|");
	sn=wdim.length;
	for (i=0;i<sn;i++)
	{
	nurl=wdim[i];
		nurl2=","+nurl+","
		temp1="<td><input name='"+frmName+"' type='checkbox' value='"+nurl+"'";
		if (trsurl.indexOf(nurl2)>=0) { temp1+=" checked"; }
		temp1+=">"+nurl+"</option></td>";
	document.write(temp1);
	if((i+1) % tdNum==0){document.write("</tr><tr>");}
	}
	document.write("</tr></table>");
}

function yjcitySWF(m_name,m_width,m_height,m_transparent)
{
	var temp1="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\""+m_width+"\" height=\""+m_height+"\">";
	temp1+="<param name=\"movie\" value=\""+m_name+"\" />";
	temp1+="<param name=\"quality\" value=\"high\" />";
	if(m_transparent!=""){
		temp1+="<param name='wmode' value='transparent'>";
	}
	temp1+="<param name=\"menu\" value=\"false\" />";
	temp1+="<embed src=\""+m_name+"\" quality=\"high\" width=\""+m_width+"\" height=\""+m_height+"\" type=\"application/x-shockwave-flash\"";
	if(m_transparent!=""){
		temp1+=" wmode='transparent' ";
	}
	temp1+="/>";
	temp1+="</object>";
	return temp1;
}
//mWidth宽,mLine下划线编号,mIcon图标编号(01-22),mTitlePic标题图片编号,mTitleTxt标题文字,mURL更多链接
//如：myTitle('98%','01','02','02','','');
function myTitle(mWidth,mLine,mIcon,mTitlePic,mTitleTxt,mURL)
{
  var m_path=web_dir+"yjcity_tm/";
  var temp1="<table width="+mWidth+" border='0' cellpadding='0' cellspacing='0' background='"+m_path+"title/line"+mLine+".gif' bgcolor='#FFFFFF'>";
  temp1+="<tr><td width='10'><img src='"+m_path+"spacer.gif' width='1' height='1'></td>";
  temp1+="<td width='49'><img src='"+m_path+"icon/icon"+mIcon+".gif'></td>";
  if (mTitleTxt!=""){
  	temp1+="<td><b>"+mTitleTxt+"</b></td>";
  }else{
  temp1+="<td align='left' valign='top'><img src='"+m_path+"title/title"+mTitlePic+".gif'></td>";
  }
  if(mURL!=""){
  	temp1+="<td width='45'><a href='"+mURL+"'><img src='"+m_path+"title/more01.gif' width='41' height='16' border='0'></a></td>";
  }
  temp1+="</tr></table>";
  document.write (temp1);
}

//如：myTitle('98%','01','#FF0000','标题','news.asp');
function myTitle02(mWidth,mIcon,mBg,mTitleTxt,mURL)
{
	document.write("<table width=\""+mWidth+"\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\""+web_dir+"yjcity_tm/title/t_001_b.gif\" bgcolor=\""+mBg+"\">");
	document.write("  <tr>");
	document.write("    <td width=\"101\"><img src=\""+web_dir+"yjcity_tm/title/t_001_p_"+mIcon+".gif\" width=\"101\" height=\"67\"></td>");
	document.write("    <td>"+mTitleTxt+"</td>");
	document.write("    <td width=\"62\" align=\"right\"><a href='"+mURL+"'><img src=\""+web_dir+"yjcity_tm/title/t_001_m.gif\" width=\"62\" height=\"67\" border=\"0\"></a></td>");
	document.write("  </tr>");
	document.write("</table>");

}
//右阴影效果：<script language=javascript>right_bar(3);</script>
function right_bar(mImg)
{
  var temp1="<table width='100%'  border='0' cellspacing='0' cellpadding='0'>";
  temp1+="<tr><td background='"+web_dir+"yjcity_tm/table_img/right_bar" + mImg + ".jpg'>" + yjcitySWF(web_dir+"yjcity_tm/swf/right_bar.swf",40,400,"1");
  temp1+="</td></tr></table>";
  document.write (temp1);
}

//m_n表格编号(001-004),m_width宽,m_b=1为开始
//如：开始yjTable("002","80%",1);结束yjTable("002","80%",2);
function yjTable(m_n,m_width,m_b){
	var temp1
	var m_sp,m_path,m_border1,m_border2,m_border3,m_border4,m_border4a,m_img,m_bgcolor
	m_path=web_dir+"yjcity_tm/table_img/";
	m_sp=m_path+"spacer.gif";
	m_img=m_path+"t"+m_n;
	m_bgcolor="bgcolor='#FFFFFF'";
	if(m_n=="003" || m_n==4){
		m_bgcolor="";
	}
	if(m_n=="001" || m_n=="004" || m_n=="005" || m_n=="006"){
		m_border1=m_img+"_b1.gif";
		m_border2=m_img+"_b2.gif";
		m_border3=m_img+"_b3.gif";
		m_border4=m_img+"_b4.gif";
		m_border4a=m_img+"_b4a.gif";
	}else{
		m_border1=m_sp;
		m_border2=m_sp;
		m_border3=m_sp;
		m_border4=m_sp;
			}
	if (m_b==1){
		temp1= "<table width='"+m_width+"'  border='0' cellpadding='0' cellspacing='0' align='center'>";
		temp1=temp1+"<tr><td width='10'><img src='"+m_img+"_1.gif' width='10' height='10'></td>";
		temp1=temp1+"<td background='"+m_border1+"' "+m_bgcolor+"><img src='"+m_sp+"'></td>";
		temp1=temp1+"<td width='10'><img src='"+m_img+"_2.gif' width='10' height='10'></td></tr>";
		temp1=temp1+"<tr><td background='"+m_border2+"' "+m_bgcolor+"><img src='"+m_sp+"'></td>";
		if (m_n==4){m_bgcolor="bgcolor='#FFFFFF'";}
		temp1=temp1+"<td "+m_bgcolor+">";
	}else if (m_b==2){
		temp1= "</td>";
		temp1=temp1+"<td width='10' background='"+m_border3+"' "+m_bgcolor+"><img src='"+m_sp+"'></td></tr>";
		temp1=temp1+"<tr><td><img src='"+m_img+"_3.gif' width='10' height='10'></td>";
		temp1=temp1+"<td background='"+m_border4+"' "+m_bgcolor+"><img src='"+m_sp+"'></td>";
		temp1=temp1+"<td><img src='"+m_img+"_4.gif' width='10' height='10'></td></tr></table>";
	}else{
		temp1= "</td>";
		temp1=temp1+"<td width='10' background='"+m_border3+"' "+m_bgcolor+"><img src='"+m_sp+"'></td></tr>";
		temp1=temp1+"<tr><td><img src='"+m_img+"_3a.gif' width='10' height='25'></td>";
		temp1=temp1+"<td background='"+m_border4a+"' "+m_bgcolor+"><img src='"+m_sp+"'></td>";
		temp1=temp1+"<td><img src='"+m_img+"_4a.gif' width='10' height='25'></td></tr>";
		temp1=temp1+"<tr><td background='"+m_border2+"' "+m_bgcolor+"><img src='"+m_sp+"'></td>";
		if (m_n==4){m_bgcolor="bgcolor='#FFFFFF'";}
		temp1=temp1+"<td "+m_bgcolor+">";
	}
	document.write (temp1);
}
//m_width宽,m_b=1为开始
//如：开始yjTable("002","80%",1);结束yjTable("002","80%",2);
function yjTableC1(m_width,m_b){
	var temp1
	var m_sp,m_path
	m_path=web_dir+"yjcity_tm/table_img/";
	m_sp=m_path+"spacer.gif";
	if (m_b==1){
		temp1= "<table width='"+m_width+"'  border='0' cellpadding='0' cellspacing='0' align='center'>";
		temp1=temp1+"<tr><td width='14'><img src='"+m_path+"ct001_1.gif' width='14' height='14'></td>";
		temp1=temp1+"<td background='"+m_path+"ct001_1b.gif'><img src='"+m_sp+"'></td>";
		temp1=temp1+"<td width='14'><img src='"+m_path+"ct001_2.gif' width='14' height='14'></td></tr>";
		temp1=temp1+"<tr><td background='"+m_path+"ct001_2b.gif'><img src='"+m_sp+"'></td>";
		temp1=temp1+"<td bgcolor='#FFFFFF'>";
	}else if (m_b==2){
		temp1= "</td>";
		temp1=temp1+"<td background='"+m_path+"ct001_3b.gif'><img src='"+m_sp+"'></td></tr>";
		temp1=temp1+"<tr><td><img src='"+m_path+"ct001_5.gif' width='14' height='14'></td>";
		temp1=temp1+"<td background='"+m_path+"ct001_5b.gif'><img src='"+m_sp+"'></td>";
		temp1=temp1+"<td><img src='"+m_path+"ct001_6.gif' width='14' height='14'></td></tr></table>";
	}else{
		temp1= "</td>";
		temp1=temp1+"<td background='"+m_path+"ct001_3b.gif'><img src='"+m_sp+"'></td></tr>";
		temp1=temp1+"<tr><td><img src='"+m_path+"ct001_3.gif' width='14' height='57'></td>";
		temp1=temp1+"<td background='"+m_path+"ct001_4b.gif'>";
		temp1=temp1+"<table width='100%' border='0' cellpadding='0' cellspacing='0' align='center'><tr>";
		temp1=temp1+"<td width='71'><img src='"+m_path+"ct001_c.gif' width='71' height='57'>";
		temp1=temp1+"<td><img src='"+m_sp+"'></td>";
		temp1=temp1+"<td width='71' align='right'><img src='"+m_path+"ct001_c.gif' width='71' height='57'>";
		temp1=temp1+"</tr></table>";
		temp1=temp1+"</td>";
		temp1=temp1+"<td><img src='"+m_path+"ct001_4.gif' width='14' height='57'></td></tr>";
		temp1=temp1+"<tr><td background='"+m_path+"ct001_2b.gif'><img src='"+m_sp+"'></td>";
		temp1=temp1+"<td bgcolor='#FFFFFF'>";
	}
	document.write (temp1);
}
//m_m样式编号,m_title标题,m_url连接,m_color颜色,m_n字母编号
function SWFtitle(m_m,m_title,m_url,m_color,m_n)
{
	var b_name,b_width,b_p,tTY,r,s,b_height
	b_height=30
	if(m_m==303){
		b_height=40
	}		
	b_name="title"+m_m+".s"
	tTY="yjcity.com"
	if(m_m==0){
		b_width=760
	}else if(m_m==1 || m_m==101 || m_m==102){
		b_width=576
	}else if(m_m==2){
		b_width=287
	}else{
		b_width=181
	};
	r=m_url;
	if(r.indexOf("&")>0)
	{
		s = r.split("&");
		r = "";
		for (key in s)
		{
			r += s[key] + "＆";
		}
	};
	b_p=web_dir+"yjcity_tm/swf/"+b_name+"wf"
	b_p=b_p+"?yjcityTitle="+m_title+"&ty="+tTY+"&yjcityURL="+r+"&c=0x"+m_color+"&m_n="+m_n
	document.write (yjcitySWF(b_p,b_width,b_height,1));
	
}

//图片按比例缩放
var flag=false;
function DrawImage(ImgD,iwidth,iheight){
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
	flag=true;
	if(image.width/image.height>= iwidth/iheight){
		if(image.width>iwidth){  
		ImgD.width=iwidth;
		ImgD.height=(image.height*iwidth)/image.width;
		}else{
		ImgD.width=image.width;  
		ImgD.height=image.height;
		}
		ImgD.alt=image.width+"×"+image.height;
		}
	else{
		if(image.height>iheight){  
		ImgD.height=iheight;
		ImgD.width=(image.width*iheight)/image.height;		
		}else{
		ImgD.width=image.width;  
		ImgD.height=image.height;
		}
		ImgD.alt=image.width+"×"+image.height;
		}
	}
} 
//*************************************************
//Validator v1.0
//cody by 我佛山人
//wfsr@cunite.com
//http://www.cunite.com
//*************************************************
Validator = {	
	Require : /.+/,
	Email : /^\w+([-+.]\w+)*@\w+([-.]\\w+)*\.\w+([-.]\w+)*$/,
	Phone : /^((\(\d{3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}$/,
	Mobile : /^((\(\d{3}\))|(\d{3}\-))?13\d{9}$/,
	Url : /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,
	IdCard : /^\d{15}(\d{2}[A-Za-z0-9])?$/,
	Currency : /^\d+(\.\d+)?$/,
	Number : /^\d+$/,
	Zip : /^[1-9]\d{5}$/,
	QQ : /^[1-9]\d{4,8}$/,
	Integer : /^[-\+]?\d+$/,
	Double : /^[-\+]?\d+(\.\d+)?$/,
	English : /^[A-Za-z]+$/,
	Chinese : /^[\u0391-\uFFE5]+$/,
	UnSafe : /^(([A-Z]*|[a-z]*|\d*|[-_\~!@#\$%\^&\*\.\(\)\[\]\{\}<>\?\\\/\'\"]*)|.{0,5})$|\s/,
	IsSafe : function(str){return !this.UnSafe.test(str);},
	SafeString : "this.IsSafe(value)",
	Limit : "this.limit(value.length,getAttribute('min'), getAttribute('max'))",
	LimitB : "this.limit(this.LenB(value), getAttribute('min'), getAttribute('max'))",
	Date : "this.IsDate(value, getAttribute('min'), getAttribute('format'))",
	Repeat : "value == document.getElementsByName(getAttribute('to'))[0].value",
	Range : "getAttribute('min') < value && value < getAttribute('max')",
	Compare : "this.compare(value,getAttribute('operator'),getAttribute('to'))",
	Custom : "this.Exec(value, getAttribute('regexp'))",
	Group : "this.MustChecked(getAttribute('name'), getAttribute('min'), getAttribute('max'))",
	ErrorItem : [document.forms[0]],
	ErrorMessage : ["以下原因导致提交失败：\t\t\t\t"],
	Validate : function(theForm, mode){
	var obj = theForm || event.srcElement;
	var count = obj.elements.length;
	this.ErrorMessage.length = 1;
	this.ErrorItem.length = 1;
	this.ErrorItem[0] = obj;
	for(var i=0;i<count;i++){
		with(obj.elements[i]){
			var _dataType = getAttribute("dataType");
			if(typeof(_dataType) == "object" || typeof(this[_dataType]) == "undefined") continue;
			this.ClearState(obj.elements[i]);
			if(getAttribute("require") == "false" && value == "") continue;
			switch(_dataType){
				case "Date" :
				case "Repeat" :
				case "Range" :
				case "Compare" :
				case "Custom" :
				case "Group" : 
				case "Limit" :
				case "LimitB" :
				case "SafeString" :
					if(!eval(this[_dataType])) {
						this.AddError(i, getAttribute("msg"));
					}
				break;
				default :
					if(!this[_dataType].test(value)){
						this.AddError(i, getAttribute("msg"));
					}
				break;
			}
		}
	}
	if(this.ErrorMessage.length > 1){
		mode = mode || 1;
		var errCount = this.ErrorItem.length;
		switch(mode){
			case 2 :
				for(var i=1;i<errCount;i++)
				this.ErrorItem[i].style.color = "red";
			case 1 :
				alert(this.ErrorMessage.join("\n"));
				this.ErrorItem[1].focus();
			break;
			case 3 :
				for(var i=1;i<errCount;i++){
					try{
						var span = document.createElement("SPAN");
						span.id = "__ErrorMessagePanel";
						span.style.color = "red";
						this.ErrorItem[i].parentNode.appendChild(span);
						span.innerHTML = this.ErrorMessage[i].replace(/\d+:/,"*");
					 }
					 catch(e){alert(e.description);}
				}
				this.ErrorItem[1].focus();
			break;
			default :
				alert(this.ErrorMessage.join("\n"));
			break;
			}
		return false;
		}
	return true;
	},
	limit : function(len,min, max){
		min = min || 0;
		max = max || Number.MAX_VALUE;
		return min <= len && len <= max;
		},
	LenB : function(str){
		return str.replace(/[^\x00-\xff]/g,"**").length;
		},
	ClearState : function(elem){
		with(elem){
			if(style.color == "red")
				style.color = "";
			var lastNode = parentNode.childNodes[parentNode.childNodes.length-1];
			if(lastNode.id == "__ErrorMessagePanel")
				parentNode.removeChild(lastNode);
			}
		},
	AddError : function(index, str){
		this.ErrorItem[this.ErrorItem.length] = this.ErrorItem[0].elements[index];
		this.ErrorMessage[this.ErrorMessage.length] = this.ErrorMessage.length + ":" + str;
		},
	Exec : function(op, reg){
		return new RegExp(reg,"g").test(op);
		},
	compare : function(op1,operator,op2){
		switch (operator) {
			case "NotEqual":
				return (op1 != op2);
			case "GreaterThan":
				return (op1 > op2);
			case "GreaterThanEqual":
				return (op1 >= op2);
			case "LessThan":
				return (op1 < op2);
			case "LessThanEqual":
				return (op1 <= op2);
			default:
				return (op1 == op2); 
			}
		},
	MustChecked : function(name, min, max){
		var groups = document.getElementsByName(name);
		var hasChecked = 0;
		min = min || 1;
		max = max || groups.length;
		for(var i=groups.length-1;i>=0;i--)
			if(groups[i].checked) hasChecked++;
			return min <= hasChecked && hasChecked <= max;
		},
	IsDate : function(op, formatString){
		formatString = formatString || "ymd";
		var m, year, month, day;
		switch(formatString){
			case "ymd" :
				m = op.match(new RegExp("^\\s*((\\d{4})|(\\d{2}))([-./])(\\d{1,2})\\4(\\d{1,2})\\s*$"));
				if(m == null ) return false;
				day = m[6];
				month = m[5]--;
				year = (m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10));
			break;
			case "dmy" :
				m = op.match(new RegExp("^\\s*(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))\\s*$"));
				if(m == null ) return false;
				day = m[1];
				month = m[3]--;
				year = (m[5].length == 4) ? m[5] : GetFullYear(parseInt(m[6], 10));
			break;
			default :
			break;
		}
	var date = new Date(year, month, day);
	return (typeof(date) == "object" && year == date.getFullYear() && month == date.getMonth() && day == date.getDate());
	function GetFullYear(y){return ((y<30 ? "20" : "19") + y)|0;}
	}
}
function select_time(st_obj)
{
var showx=event.screenX-event.offsetX-14;
var showy=event.screenY-event.offsetY-168;
var retval=window.showModalDialog(web_dir+"html_data.asp?"+st_obj.value,"","dialogWidth:197px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no;");
if( retval!=null ) { st_obj.value=retval; }
//else { }
}

function textarea_resize(textareaname,textareamp)
{
var tt_num=5;
if (textareamp=='-') { tt_num=-5; }
var tt_obj=document.getElementById(textareaname);
if (parseInt(tt_obj.rows)+tt_num>=3) { tt_obj.rows = parseInt(tt_obj.rows) + tt_num; }
if (tt_num>0) { tt_obj.width="90%"; }
}

//function jk_tcolor()
//{
//var arr = showModalDialog(web_dir+"htmledit/selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
//if (arr != null) { document.write_frm.tcolor.value = arr.substring(1,7); }
//}
function title_bar001(m_width,m_c0,m_c1,m_c2,m_title,m_url)
{
  var temp1="<table width='"+m_width+"  border='0' cellpadding='0' cellspacing='0' bgcolor='"+m_c0+"' align='center'><tr>";
  temp1+="<td width='24' bgcolor='"+m_c1+"'><img src='"+web_dir+"yjcity_tm/table_img/t007.gif' width='24' height='24'></td>";
  temp1+="<td width='3'><img src='"+web_dir+"yjcity_tm/spacer.gif' width='3' height='1'></td>";
  temp1+="<td bgcolor='"+m_c2+"' class=fbg>&nbsp;&nbsp;"+m_title+"</td>";
  if (m_url!=""){
  	temp1+="<td bgcolor='"+m_c2+"' align='right'><a href='"+m_url+"'><img src='"+web_dir+"yjcity_tm/table_img/more02.gif' width='41' height='16' border='0'></a>&nbsp;&nbsp;</td>";
  }
  temp1+="</tr></table>";
  document.write (temp1);
}


function all_bn_click()
{
    var cf=window.confirm("执行此操作后可能无法恢复！你确定吗？");
    if (cf)
    { return true; }
    else
    { return false; }
}

function jk_tColor(s,formName)
{
  var arr = showModalDialog(web_dir+"htmledit/selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
  if (arr != null) { eval("document."+formName+"."+s+".value = arr.substring(1,7); "); }
}


function changeart()
{
	
	mytp=document.getElementsByName("c_id");
	//alert(document.add_frm.tp.options[document.add_frm.tp.selectedIndex].value);
	for(i=0;i<mytp.length;i++)
	{ 
		if(document.add_frm.tp.options[document.add_frm.tp.selectedIndex].value==mytp[i].sl)
		{
			mytp[i].style.display = "";
			mytp[i].disabled = false;
		}
		else
		{
			mytp[i].style.display="none";
			mytp[i].disabled=true;
		}
	}
}

function AddKey(i) {
	var strKey=document.add_frm.keyes.value;
	var strNow=i+" "

	if(strKey.indexOf(strNow)==-1){
		strKey=strKey+strNow;
	}
	document.add_frm.keyes.value=strKey;
}

function DelKey(i) {
	var strKey=document.add_frm.keyes.value;
	var strNow="{"+i+"}"
	if(strKey.indexOf(strNow)!=-1){

		strKey=strKey.substring(0,strKey.indexOf(strNow))+strKey.substring(strKey.indexOf(strNow)+strNow.length,strKey.length)

	}
	document.add_frm.keyes.value=strKey;
}