function CopyUrl()
{
	
	$('C_Url').value=$('spnurl').innerHTML;
}

function ShowFieldName()
{
	if($('itemtable').className=="")
		$('itemtable').className="showfield";
	else
		$('itemtable').className="";
}

function BuildTitleUrlByName(s_name)
{
	var s_url=$('spnurl').innerHTML;
	var s_con=s_url.split('/');
	var s_ret="/";
	for(i=1;i<s_con.length-2;i++)
	{
		s_ret+=s_con[i]+"/";
	}
	var s_path=$(s_name).value;
	s_path= s_path.replace(/\s+/g,"-");
	s_path=s_path.replace(/[^a-z0-9-]/ig,"-");
	
	s_path= s_path.replace(/-{2,}/g,"-");
	
	//去掉头尾的内容
	if(s_path.substr(0,1)=="-")
	{
		s_path=s_path.substr(1);
	}
	
	if(s_path.substr(s_path.length-1,1)=="-")
	{
		s_path=s_path.substr(0,s_path.length-1);
	}
	
	s_ret+=s_path+"/";
	
	$('C_Url').value=s_ret.toLowerCase();
	
}

function StartTranslate(s_name)
{
	//Translate('{"sentences":[{"trans":"Commercial Buildings","orig":"商业建筑","translit":""}],"src":"zh-CN"}');
	//alert(s_name);
	if($(s_name).value!="")
	{
		
		ExecuteScript("/admin/dynamic.aspx?sel=9&value="+escape($(s_name).value)+"&rnd="+Math.random());
	}	
}

var s_spnurl="";
// 调用Google 开始翻译
function Translate(s_value)
{
	//debugger;
	var re = new RegExp("\"([^\"]*?)\"","ig");
  var arr; 
  var i_index=0;
  while(true)
	{
		arr=re.exec(s_value); 
		
		break ;
		
		if(i_index>1)
			break;
		
		i_index++;	
	}

	$('txteng').value=arr[1];
	if(s_spnurl=="")
		s_spnurl=$('spnurl').innerHTML;
		
	$('spnurl').innerHTML=s_spnurl.replace("@c_id@",arr[1]).replace(/ /ig,"-").toLowerCase();
}

function CopyTitle(s_source,s_target)
{
	$(s_target).value=$(s_source).value;
}

//自动进行标题换算 
var s_target="",s_source="";
function StartTransTitle(s_source,s_target)
{
	if($(s_source).value!="")
	{
		this.s_target=s_target;
		this.s_source=s_source;
		ExecuteScript("/admin/dynamic.aspx?sel=10&title="+escape($(s_source).value)+"&rnd="+Math.random());
	}	
}

function TransTitle(s_value)
{
	if(s_value!="")
	{
		
		var s_con=s_value.split('|');
		
		if(s_spnurl=="")
			s_spnurl=$('spnurl').innerHTML;
		
		$(s_target).value=s_con[1];
		$('C_Number').value="CN-"+s_con[0];//货号
		
		//复制路径
		$('spnurl').innerHTML=s_spnurl.replace("@c_id@",s_con[0]).replace(/ /ig,"-").toLowerCase();
		$('C_Url').value=$('spnurl').innerHTML;
	}
	else
	{
		$(s_target).value=$(s_source).value;
	}	
}