// JavaScript Document

function f(n){return document.getElementById(n);}
document.write("<form method=\"post\" action=\"/mycart.asp\" name=\"AI_Buy\" style=\"display:none\"><input type=\"hidden\" name=\"ID\" id=\"AI_Buy_ID\"></form>")
function AI_Buy_sub(Id)
{
	f("AI_Buy_ID").value=Id;
	var myhidden = document.createElement("input");
	myhidden.type="hidden";
	myhidden.name="AI_Buy_number";
	try
	{
		if(f("buy_number"))
		{
			var re = /^[1-9]+.?[1-9]*$/;   //判断字符串是否为数字     //判断正整数 /^[1-9]+[0-9]*]*$/  
			var nubmer = f("buy_number").value;
			if(!re.test(nubmer))
			{
				alert("您输入的数量不合格.");
				f("buy_number").focus();
			}
			else
			{
				myhidden.value=nubmer;
				document.AI_Buy.appendChild(myhidden);
				document.AI_Buy.submit();
			}
		}
		else
		{
			myhidden.value=1;
			document.AI_Buy.appendChild(myhidden);
			document.AI_Buy.submit();
		}
		
	}
	catch(err)
	{
		myhidden.value=1;
		document.AI_Buy.appendChild(myhidden);
		document.AI_Buy.submit();
	}
}

function OnMenu(c)
{
	for(var i=1;i<11;i++)
	{
	 f("menu_"+i).className="";	
	 if(i!=1 && i!=9)f("menul_list_"+i).style.display='none';
	}
	   
	f("menu_"+c).className="current";	
	if(c!=1 && c!=9)f("menul_list_"+c).style.display='block';
}


var flag=false; 

function DrawImage(ImgD,w,h){ 

var image=new Image(); 

var iwidth = w;  //定义允许图片宽度 

var iheight = h;  //定义允许图片高度 

image.src=ImgD.src; 

if(image.width>0 && image.height>0){ 

flag=true; 

if(image.width/image.height>= iwidth/iheight){ 

  if(image.width>iwidth){   

   ImgD.style.width=iwidth+"px";

   ImgD.style.height=(image.height*iwidth)/image.width+"px";

   var pgh=iheight - (image.height*iwidth)/image.width; 
   setHeight(ImgD,pgh);
   }else{ 

   ImgD.style.width=image.width+"px";

   ImgD.style.height=image.height+"px";
   
   var pgw=iwidth - image.width;
   var pgh=iheight - image.height;
   setWidth(ImgD,pgw);
   setHeight(ImgD,pgh);
   } 

  // ImgD.alt=image.width+"×"+image.height; 

   } 

else{ 

  if(image.height>iheight){   

   ImgD.style.height=iheight+"px";

   ImgD.style.width=(image.width*iheight)/image.height+"px";

   var pgw=iwidth - (image.width*iheight)/image.height;
   setWidth(ImgD,pgw);
   }else{ 

   ImgD.style.width=image.width+"px";
   ImgD.style.height=image.height+"px";
   var pgw=iwidth - image.width;
   var pgh=iheight - image.height;
   setWidth(ImgD,pgw);
   setHeight(ImgD,pgh);
   } 

   //ImgD.alt=image.width+"×"+image.height; 

   } 

} 

} 

function setWidth(ts,w)
{
	   // if(w.toString().indexOf(".")!=-1){
		//  var items=w.toString().split(".");
		//  var item_1=parseInt(items[1]);
		 // if(item_1 > 50 || item_1 > 5)w=parseInt(w.toFixed(0)) + 2;
		 // else if(item_1 <= 50 || item_1 <= 5)w=parseInt(w.toFixed(0)) + 1;
		// w=parseInt(w.toFixed(0));// + 1;
		//}
		if(w.toString().indexOf(".")!=-1)w=parseInt(w.toFixed(0)) + 1;
		w=parseInt(w.toFixed(0));
		var iw=parseInt(w)/2;
		var w_1;
		if(iw.toString().indexOf(".")!=-1)w_1=parseInt(iw) + 1;
		else w_1=parseInt(iw);
		
		var w_2=parseInt(iw);
	    ts.style.paddingLeft=w_1+"px";
	    ts.style.paddingRight=w_2+"px";
}

function setHeight(ts,h)
{
	    if(h.toString().indexOf(".")!=-1)h=parseInt(h.toFixed(0)) + 1;
		h=parseInt(h.toFixed(0));
		var ih=parseInt(h)/2;
		var h_1;
		if(ih.toString().indexOf(".")!=-1)h_1=parseInt(ih) + 1;
		else h_1=parseInt(ih);
		var h_1=ih;
		var h_2=parseInt(ih);
		ts.style.paddingTop=h_1+"px";
		ts.style.paddingBottom=h_2+"px";
}

function OnlineService(){window.open("http://www7.53kf.com/webCompany.php?arg=ai9999&style=1&language=cn&lytype=0&charset=gbk&kflist=off&kf=&zdkf_type=1&referer=http%3A%2F%2Fwww.ai9999.com%2F&keyword=&tpl=crystal_blue",'','');}


//流量统计
//document.write(unescape("%3Cscript src='http://s87.cnzz.com/stat.php?id=1959392&web_id=1959392' language='JavaScript' charset='gb2312'%3E%3C/script%3E"));

window.onload=function(){
var mydiv = document.createElement("div");
mydiv.innerHTML=unescape("%3Cscript src='http://s87.cnzz.com/stat.php?id=1959392&web_id=1959392' language='JavaScript' charset='gb2312'%3E%3C/script%3E");
mydiv.style.display="none";
document.body.appendChild(mydiv);
}

//ai9999.com流量统计
//document.write(unescape("%3Cscript id='scriptjs' src='' language='JavaScript' charset='gb2312'%3E%3C/script%3E"));
//scriptjs.src="http://www.zsjcxsh.com/Ai9ZhuiZhong/index.asp?path="+escape(location.href)+"&Referr="+escape(document.referrer)+"";
//document.write("<div style=\"display:none\">");
//document.write("dsfds");
//document.write("<script src='http://s87.cnzz.com/stat.php?id=1959392&web_id=1959392'>");
//document.write("</scr"+"ipt>")
//document.write("</div>");
//document.write("<div style=\"display:none\">fsdfs</scr"+"ipt></div>")


