function translator(pattern) {
	var open_in_same_window = 0;
	var my_location = unescape(document.location.toString());
	var new_location ='';
	var new_pattern = '';
	var islocal = 1;
	if(my_location.indexOf('babelfish/translate_url_content?') != -1){
		var indexof_u = my_location.indexOf('&trurl=');
		if (indexof_u == -1) new_location = document.location;
		else {
			var subs = my_location.substring(indexof_u, my_location.length);
			var ss = subs.split('&');
			new_location = ss[1].substring(6, ss[1].length);
			islocal = 0;
		}
	} else {
		new_location = document.location;
		
	}

	indexof_p = pattern.indexOf('|');
	var isen = '';
	var lg = '';
	if (indexof_p == -1) {
		indexof_p1 = pattern.indexOf('><');
		if (indexof_p1 == -1) {
			new_pattern = pattern;
			if (pattern == 'en') isen = 1;
		}
		else {
			var psplit = pattern.split('><');
			new_pattern = psplit[0] + '_' + psplit[1];
			if (psplit[1] == 'en') isen = 1;
			else lg = psplit[1];
		}
	}
	else {
		var psplit = pattern.split('|');
		new_pattern = psplit[0]+'_'+psplit[1];
		if (psplit[1] == 'en') isen = 1;
		else lg = psplit[1];
	}

	var thisurl = '';
	if (isen == 1) thisurl = new_location;
	else {
		new_location = escape(new_location);
		if (islocal == 1) {
			thisurl = "language.php?to=" + lg + "&url=" + new_location;
		} else {
			open_in_same_window = 1;
			thisurl = "http://66.163.168.225/babelfish/translate_url_content?lp=" + new_pattern + "&trurl=" + new_location;
		}
	}

	if (open_in_same_window == 1) window.location.href = thisurl;
	else {
		msgWindow=window.open('' ,'subwindow','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
		msgWindow.focus();
		msgWindow.location.href = thisurl;
	}
}
window.onload=function()
{
	var href=document.location.href;
	if(href.indexOf("66.163.168.225")!=-1)//translator error
	{
		if(window.event)
		{
			var a=document.getElementsByTagName("html")[0].outerHTML;
			document.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n"+a);
		}
		var form=document.getElementsByTagName("form");
		if(form.length)
		{
			for(var i=0;i<form.length;i++)
			{
				form[i].action=form[i].getElementsByTagName("input")[2].value;
			}
		}
	}
}
var time,time2,banner,cer;

	cer=document.getElementById("cerul");
	banner=document.getElementById("bannerul");
	time=setTimeout("marque()",20);
	if(banner)time2=setTimeout("marque2()",3000);
	cer.onmouseover=function(){clearTimeout(time);}
	cer.onmouseout=function(){marque();}
	
	if(document.getElementById("ctul"))
	{
		var desp=document.getElementById("ctul").getElementsByTagName("span");
		for(var i=0;i<desp.length;i++)
		{
			var desps=desp[i].innerHTML.split("Model");
			if(desps.length>3)
			{
				desp[i].innerHTML=desps[1]+"Model"+desps[2]+"Model"+desps[3]+"...more >>";
			}
		}
	}
	var close=document.getElementById("close");
	if(document.getElementById("home") && close==null)
	{
		var msg=document.createElement("p");
		msg.innerHTML="<strong>Dear Sir/Madam :  </strong><br />Due to internal restructuring, we have changed the Telphone Number and Fax Numeber. If any question please contact us with the new number as follow. Sorry for any inconvenience!<br /><strong>Tel:</strong>+86-757-88767599<br /><strong>Fax:</strong>+86-757-82522733<strong id='close'>X</strong>";
		msg.id="msg";
		document.getElementsByTagName("body")[0].appendChild(msg);
		document.getElementById("close").onmouseover=function(){this.style.cursor="pointer";}
		document.getElementById("close").onclick=function(){msg.style.display="none";msg=null;}
	}
function marque()
{
	var style=cer.currentStyle?cer.currentStyle.left:document.defaultView.getComputedStyle(cer,null).left;
	var left=parseInt(style);
	cer.style.left=(left-1)+"px";
	if((0-left)>cer.offsetWidth)cer.style.left="120px";
	time=setTimeout("marque()",20);
}
function marque2()
{
	var style=banner.currentStyle?banner.currentStyle.left:document.defaultView.getComputedStyle(banner,null).left;
	var left=parseInt(style);
	banner.style.left=(left-380)+"px";
	if((0-left+380)>=banner.offsetWidth)banner.style.left="0px";
	time2=setTimeout("marque2()",3000);
}
function change(list){
	clearTimeout(time2);
	var num=(list-1)*380;
	banner.style.left="-"+num+"px";
	time2=setTimeout("marque2()",3000);
}
function view(){
	var obj=document.getElementById("translator");
	if(obj.className=="translator")
	{
		obj.className="translator2";
	}
	else
	{
		obj.className="translator";
	}
}
function ctlist(){
	var ct=document.getElementById("ctlist");
	if(ct.style.height!="300px")
	{
		ct.style.height="300px";
	}
	else
	{
		ct.style.height="20px";
	}
}
function flowimg(num,num2){
	document.getElementById("flow1").style.display="none";
	document.getElementById("flow2").style.display="none";
	document.getElementById("flow3").style.display="none";
	document.getElementById("flow4").style.display="none";
	document.getElementById("flow5").style.display="none";
	document.getElementById("flow6").style.display="none";
	document.getElementById("flow7").style.display="none";
	document.getElementById("flow8").style.display="none";
	document.getElementById(num).style.display="block";
	document.getElementById("flowa1").style.color="#46466A";
	document.getElementById("flowa2").style.color="#46466A";
	document.getElementById("flowa3").style.color="#46466A";
	document.getElementById("flowa4").style.color="#46466A";
	document.getElementById("flowa5").style.color="#46466A";
	document.getElementById("flowa6").style.color="#46466A";
	document.getElementById("flowa7").style.color="#46466A";
	document.getElementById("flowa8").style.color="#46466A";
	document.getElementById(num2).style.color="#ff0000";
}
document.oncontextmenu=function(){return false;}
