// JavaScript Document
function show_s(id)
{

	if (document.getElementById('u'+id).style.display == 'none')
		{
			document.getElementById('u'+id).style.display="block";
		}
		else
		{
			document.getElementById('u'+id).style.display="none";
		}
}
function searchAth()
{
  var ath = document.getElementById("words").value;
  if(ath!=null&&ath!=""&&ath!="产品搜索")
  {
					 
		document.searchBox.action='/searchResults.asp';  
		document.searchBox.submit();


  }

}
function searchAth_e()
{
  var ath = document.getElementById("words").value;
  if(ath!=null&&ath!=""&&ath!="Search")
  {
					 
		document.searchBox.action='/searchResults-e.asp';  
		document.searchBox.submit();


  }

}
function checkmyform()
{
   if(checkspace(document.myform.linkname.value)) {
	document.myform.linkname.focus();
    alert("对不起，网站名称不能为空！");
	return false;
  }

     if(checkspace(document.myform.linkurl.value)) {
	document.myform.linkurl.focus();
    alert("对不起，网站地址不能为空！");
	return false;
  }
  if(document.myform.linkurl.value=='http://') {
	document.myform.linkurl.focus();
    alert("对不起，网站地址不能为空！");
	return false;
  }
   if(checkspace(document.myform.linkdesc.value)) {
	document.myform.linkdesc.focus();
    alert("对不起，网站简介不能为空！");
	return false;
  }

}
function checkmyform1()
{
   if(checkspace(document.myform.linkname.value)) {
	document.myform.linkname.focus();
    alert("Sorry,the website name can not be empty!");
	return false;
  }

     if(checkspace(document.myform.linkurl.value)) {
	document.myform.linkurl.focus();
    alert("Sorry,the website can not be empty!");
	return false;
  }
  if(document.myform.linkurl.value=='http://') {
	document.myform.linkurl.focus();
    alert("Sorry,the website can not be empty!");
	return false;
  }
   if(checkspace(document.myform.linkdesc.value)) {
	document.myform.linkdesc.focus();
    alert("Sorry,the website profile can not be empty!");
	return false;
  }

}

function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

var flag=false; 
function DrawImage(ImgD){ 
 	var image=new Image(); 
 	image.src=ImgD.src;
	var w = 300;
	if(image.width>w){ 
		flag=true;
		ImgD.width=w;
	}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function addbookmark()
{
    var nome_sito = "唐人十字绣";
    var url_sito = "http://www.trszx.com";
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt
        (navigator.appVersion) >= 4))
        window.external.AddFavorite(url_sito, nome_sito);
    else if (navigator.appName == "Netscape")
        window.sidebar.addPanel(nome_sito, url_sito, '');
    else
        alert("Sorry!Cann't Add this site to your favorite!.");
}
function $(element){
	if(document.getElementById && document.getElementById(element)) { 
	return document.getElementById(element); 
	} 
	else if (document.all && document.all(element)) { 
	return document.all(element); 
	} 
	else if (document.layers && document.layers[element]) { 
	return document.layers[element]; 
	} 
	else { 
	return false; 
	} 
}
var lock = false;
function $D(id,counts){
	var d=$(id);
	var w=d.offsetHeight;
	var maxw=28*Number(counts);
	function dmove(){
		w+=30; //设置层展开的速度
		if(w>=maxw){
			lock = false;
			//d.style.height='30px';
			clearInterval(IntervalId);
			d.style.overflow='';
			//window.status = "b"+G_ID;
		}else{
			lock=true;
			d.style.display='block';
			d.style.height=w+'px';
			IntervalId=window.setTimeout(dmove,2);
		}
	}
	IntervalId=window.setTimeout(dmove,2);
}

function $D2(id){
	var d=$(id);
	var w=d.offsetHeight;
	var maxw=80;
	function dmove1(){
		w-=60;//设置层收缩的速度
		if(w<=0){
			lock = false;
			d.style.display='none';
			clearInterval(iIntervalId);
			//window.status = "c"+G_ID;
		}else{
			lock = true;
			d.style.height=w+'px';
			d.style.overflow='hidden';
			setTimeout(dmove1,2);
		}
	}
	iIntervalId=setTimeout(dmove1,2);
}


function $use(id,counts,count1){
	var d=$('u' + id);
	var nh=$('nh' + id);
	if(lock)return;
	//window.status = "a"+G_ID;
	if(d.style.display=='none'){
		for(i = 1; i < counts + 1; i++) {
			if (id !=i){
				$D2('u' + i);
			}
		}
		$D('u' + id,count1);
	}else{
		for(i = 1; i < counts + 1; i++) {
			$D2('u' + i);
		}
	}
}
