<!--
	
function createXHR() 
{
    var request = false;
        try {
            request = new ActiveXObject('Msxml2.XMLHTTP');
        }
        catch (err2) {
            try {
                request = new ActiveXObject('Microsoft.XMLHTTP');
            }
            catch (err3) {
		try {
			request = new XMLHttpRequest();
		}
		catch (err1) 
		{
			request = false;
		}
            }
        }
    return request;
}

	function submitForm(url, url1)
	{ 
	xhr=createXHR();
	//document.getElementById("zone").innerHTML="Started...";
 
	xhr.open("HEAD", url, true);
	xhr.onreadystatechange=function() 
	{
	//	document.getElementById("zone").innerHTML="Wait server...";
		if(xhr.readyState == 4) 
		{
			var value;
			if (xhr.status == 200)
			{ 
				 document.location.href = newloc;
				 //value = url + " exists...";
			}
			else 
			{
				if(xhr.status==404) 
					alert("沒有其他版本！");
					//document.location.href = 'http://www.yahoo.com';
    	 			else 
					value = "Error, status is " + xhr.status;
			}
			//document.getElementById("zone").innerHTML=value;			

		}
	}

	xhr.send(null); 
	} 

   function changelang(lang)
   {

	lang = lang + "_"

	if (parent.location.href.lastIndexOf("#")+1 == parent.location.href.length ){
		len = parent.location.href.length -1
		temp = parent.location.href.substring(parent.location.href.lastIndexOf("/")+1)
		docname =temp.substring(0, temp.length -1)

	}else{
		docname = parent.location.href.substring(parent.location.href.lastIndexOf("/")+1)
	}
	
	 if (docname == ""){
          docname = "en_index.html";
   }
	 
    dir = parent.location.href.substring(0, parent.location.href.lastIndexOf("/")+1)

		newloc =  dir + lang + docname.substring(docname.indexOf("_")+1)
		submitForm(lang + docname.substring(docname.indexOf("_")+1), newloc)
	
		//document.location.href = newloc

   }

//-->

