//if (navigator.appName == 'Netscape')
//var language = navigator.language;
//else
//var language = navigator.browserLanguage;
//if (language.indexOf('zh') > -1) document.location.href = '/404.htm';

function getCookie(Cname) {
var f_str;
var l_str;
 f_str = document.cookie.indexOf(Cname + "=");
if ( f_str != -1) 
{
f_str += Cname.length + 1 ;
l_str = document.cookie.indexOf(";",  f_str) ;
if (l_str == -1)
l_str = document.cookie.length;
return unescape(document.cookie.substring(f_str, l_str));
}
else
return "";
} 


	
function  WriteAddFav()
{
	var nk=getCookie('nk');
	var favinfo = "";
    if (nk != "") 
	{
	favinfo += "<input name=\"imageField2\" type=\"image\" src=\"/images/favorite.gif\" align=\"absmiddle\" width=\"97\" height=\"16\" border=\"0\">";
	}
	document.write(favinfo);
	}
	

var rwindow = null;

function gwindow()
{	
	if (! rwindow || rwindow.closed)
	{
  rwindow = window.open("/customer/recommend.asp?link="+window.location+"&title="+document.title,"xabiz","menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,width=480,height=400");
	}else
	{
		rwindow.focus();
	}
}

 function ShowHide(x)
 {
  if(x==1)
  {
   document.getElementById('makeoffer').style.display = "block"; 
  }
  else
  {
   document.getElementById('makeoffer').style.display = "none";  
  }
 }
 
 function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) 
field.value = field.value.substring(0, maxlimit);
else
cntfield.innerHTML = maxlimit - field.value.length;
}

	var str00="Error info";
	var str01="Your name and email can not be empty";
	var str02="Bad email address or name";
	var str03="Your comment requries to less than 500 characters";
	var intMaxLen="500";
	function VerifyMessage() {
	var strName=document.getElementById("n").value;
	var strEmail=document.getElementById("e").value;
	var strArticle;
	if(document.getElementById("c").value){
		strArticle=document.getElementById("c").value;
	}
	else{
		strArticle=document.getElementById("c").innerText;
	}

	if(strName==""){
		alert(str01);
		return false;
	}
	else{
		re = new RegExp("^[ .A-Za-z0-9\u4e00-\u9fa5]+$");
		if (!re.test(strName)){
			alert(str02);
			return false;
		}
	}

	if(strEmail==""){
		alert(str01);
		return false;
	}
	else{
		re = new RegExp("^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$");
		if (!re.test(strEmail)){
			alert(str02);
			return false;
		}
	}

	if(typeof(strArticle)=="undefined"){
		alert(str03);
		return false;
	}

	if(typeof(strArticle)=="string"){
		if(strArticle==""){
			alert(str03);
			return false;
		}
		if(strArticle.length>intMaxLen)
		{
			alert(str03);
			return false;
		}
	}

	document.x4.submit();
}

function createXMLHttps(){
var ret = null;
try {ret = new ActiveXObject('Msxml2.XMLHTTP')}
catch (e) {
try {ret = new ActiveXObject('Microsoft.XMLHTTP')}
        catch (ee) {ret = null}
}
if (!ret&&typeof XMLHttpRequest !='undefined') ret = new XMLHttpRequest();
return ret;
}


function AjaxGet(URL,ID) {
var xmlhttp = createXMLHttps();
xmlhttp.open("Get",URL,true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status==404) {document.getElementById(ID).innerHTML='';return}
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById(ID).innerHTML=xmlhttp.responseText;
}
}
xmlhttp.send(null);
}

function cmt(url)
  {
//  document.getElementById("getcmt").innerHTML="<img src='/images/indicator.gif'>";
//  AjaxGet("/other/cmtlist.asp?l="+url,"getcmt");
  }
  
  

var xxwindow = null;

function twindow(id,id2)
{	
	if (! xxwindow || xxwindow.closed)
	{
  xxwindow = window.open("/reply.asp?i="+id+"&re="+id2,"xabiz","menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,width=450,height=600");
	}else
	{
		xxwindow.focus();
	}
}

function addtoshare()
{
document.write("<a href=\"http://myweb2.search.yahoo.com/myresults/bookmarklet?u=");
document.write(encodeURIComponent(window.location.href));
document.write("&t=");
document.write(encodeURIComponent(document.title));
document.write("\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/yahoo.gif\" alt=\"Yahoo\" border=\"0\" /> Yahoo</a>");

document.write(" <a href=\"http://www.google.com/bookmarks/mark?op=add&bkmk=");
document.write(encodeURIComponent(window.location.href));
document.write("&title=");
document.write(encodeURIComponent(document.title));
document.write("\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/google.gif\" alt=\"Google\" border=\"0\" /> Google</a><br />");

document.write(" <a href=\"http://del.icio.us/post?url=");
document.write(encodeURIComponent(window.location.href));
document.write("&title=");
document.write(encodeURIComponent(document.title));
document.write("&notes=\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/delicious.png\" alt=\"delicious\" border=\"0\" /> Delicious</a>");

document.write(" <a href=\"http://www.facebook.com/sharer.php?u=");
document.write(encodeURIComponent(window.location.href));
document.write("&t=");
document.write(encodeURIComponent(document.title));
document.write("&notes=\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/facebook.png\" alt=\"facebook\" border=\"0\" /> Facebook</a><br />");

document.write(" <a href=\"http://twitter.com/home?status=");
document.write(encodeURIComponent(window.location.href));
document.write(" ");
document.write(encodeURIComponent(document.title));
document.write("&notes=\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/twitter.gif\" alt=\"twitter\" border=\"0\" /> Twitter</a>");

document.write(" <a href=\"http://www.myspace.com/index.cfm?fuseaction=postto&t=&u=");
document.write(encodeURIComponent(window.location.href));
document.write("&c=");
document.write(encodeURIComponent(document.title));
document.write("&notes=\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/myspace.png\" alt=\"Myspace\" border=\"0\" /> Myspace</a>");
}
function addtoshare2()
{
document.write("<a href=\"http://myweb2.search.yahoo.com/myresults/bookmarklet?u=");
document.write(encodeURIComponent(window.location.href));
document.write("&t=");
document.write(encodeURIComponent(document.title));
document.write("\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/yahoo.gif\" alt=\"Yahoo\" border=\"0\" /> Yahoo</a> | ");

document.write("<a href=\"http://www.google.com/bookmarks/mark?op=add&bkmk=");
document.write(encodeURIComponent(window.location.href));
document.write("&title=");
document.write(encodeURIComponent(document.title));
document.write("\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/google.gif\" alt=\"Google\" border=\"0\" /> Google</a> | ");

document.write("<a href=\"http://del.icio.us/post?url=");
document.write(encodeURIComponent(window.location.href));
document.write("&title=");
document.write(encodeURIComponent(document.title));
document.write("&notes=\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/delicious.png\" alt=\"delicious\" border=\"0\" /> Delicious</a> | ");

document.write("<a href=\"http://www.facebook.com/sharer.php?u=");
document.write(encodeURIComponent(window.location.href));
document.write("&t=");
document.write(encodeURIComponent(document.title));
document.write("&notes=\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/facebook.png\" alt=\"facebook\" border=\"0\" /> Facebook</a> | ");

document.write("<a href=\"http://twitter.com/home?status=");
document.write(encodeURIComponent(window.location.href));
document.write(" ");
document.write(encodeURIComponent(document.title));
document.write("&notes=\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/twitter.gif\" alt=\"twitter\" border=\"0\" /> Twitter</a> | ");

document.write("<a href=\"http://www.myspace.com/index.cfm?fuseaction=postto&t=&u=");
document.write(encodeURIComponent(window.location.href));
document.write("&c=");
document.write(encodeURIComponent(document.title));
document.write("&notes=\" target=\"_blank\" rel=\"nofollow\"><img src=\"/images/share/myspace.png\" alt=\"Myspace\" border=\"0\" /> Myspace</a>");
}


function  WriteLog()
{
//	var nick=getCookie('nk');
//	var logininfo = "";
//	logininfo += "<li>"
// if (nick != "") 
//	{
//	logininfo += "<"+"a href=\"https://www.xabusiness.com/customer/account.asp\">";
//	logininfo += "My Acount [" + nick + "]";
//  logininfo += "<"+"/a></li>";
//  } 
//	else
//	{
//	logininfo += "<"+"a href=\"https://www.xabusiness.com/customer/login.asp\">";
//	logininfo += "Sign In";
//  logininfo += "<"+"/a> | <"+"a href=\"https://www.xabusiness.com/customer/register.asp\">Sign Up</a></li>";
//	}
//	logininfo += ""
var timestamp = (new Date()).valueOf().toString(); 
var s=document.createElement('SCRIPT');
document.getElementById("signin").innerHTML="<img src=\"/images/indicator.gif\" />";
s.src="/other/getnick.asp?" + timestamp;
s.type = "text/javascript";   
s.language = "javascript";  
////////document.body.appendChild(s);
document.getElementsByTagName("head")[0].appendChild(s);
///AjaxGet("/other/getnick.asp","signin");
	}
///WriteLog();

function irsold(x)
{
var timestamp = (new Date()).valueOf().toString(); 
var s=document.createElement('SCRIPT');
document.getElementById("sold"+x).innerHTML="<img src=\"/images/indicator.gif\" />";
s.src="/soldqty/"+(Math.floor(x/300)+1)+"/" +x+ ".js?" + timestamp;
s.type = "text/javascript";   
s.language = "javascript";  
////////document.body.appendChild(s);
document.getElementsByTagName("head")[0].appendChild(s);
	}

function irsoldlist(x)
{
var timestamp = (new Date()).valueOf().toString(); 
var s=document.createElement('SCRIPT');
document.getElementById("soldlist"+x).style.display = "block"; 
document.getElementById("soldlist"+x).innerHTML="<img src=\"/images/indicator.gif\" />";
s.src="/other/getsoldqty.asp?i=" +x+ "&t=" + timestamp;
s.type = "text/javascript";   
s.language = "javascript";  
////////document.body.appendChild(s);
document.getElementsByTagName("head")[0].appendChild(s);
	}
