// 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; 
 if(image.width>0 && image.height>0){ 
  flag=true; 
   if(image.width > 230){
	 if((image.height*230)/image.width>365)
	 {
		ImgD.width=(image.width*365)/image.height; 
		ImgD.height=365; 
	 }
	 else
	 {
		ImgD.width=230; 
		ImgD.height=(image.height*230)/image.width; 
	 }
   }
   else
   { 
   	if(image.height > 365)
	 {
		ImgD.width=(image.width*365)/image.height; 
		ImgD.height=365; 
	 }else{
		ImgD.width=image.width;
		ImgD.height=image.height; 
	 }
   } 
  }
}

function show_pics(picurl)
{
	document.getElementById('pics').src =getDrawImageNameM(picurl);
	document.getElementById('pics1').href =picurl;
}
function getDrawImageNameM(path)
{
	return path.substring(0, path.lastIndexOf(".")) + '_m' + path.substring(path.lastIndexOf("."), path.length)
}
