// JavaScript Document
function modpicture(url){
	op=document.createElement("div");
	op.style.cssText="position:absolute; height:100%;width:100%;left:0px;top:0;text-align:center;background:#fff;"
	op.style.filter="progid:DXImageTransform.Microsoft.Alpha	(style=3,opacity=30,finishOpacity=70)";
	op.style.opacity="0.3";
	document.body.appendChild(op)
	
	box=document.createElement("div");
	box.style.cssText="position:absolute; height:100px;width:360px;left:400px;top:200px; background:#fff;";
	getframe=document.createElement("iframe")
	getframe.setAttribute("width",360)
	getframe.setAttribute("height",120)
	getframe.setAttribute("scrolling","no")
	getframe.setAttribute("frameBorder","0")
	getframe.setAttribute("src",url)
	box.appendChild(getframe)
	document.body.appendChild(box)
	}
	
function admore(maxs){
		myparams=document.getElementById("myparam");
		bodytable=myparams.getElementsByTagName("tbody")[0]
		trs=myparams.getElementsByTagName("tr");
		if(trs.length<maxs){
			newtr=document.createElement("tr"); newtd=document.createElement("td");
			newtd.innerHTML="<input type=\"text\"  name=\"param[]\"  class=\"input1\" />: <input type=\"text\" name=\"value[]\" value=\"\" class=\"input\" />";
			newtr.appendChild(newtd);bodytable.appendChild(newtr);
		}else{
			alert("最多只能添加10个自定义属性...")	
		}
	}
function addmorepic(){
		picture=document.getElementById("pictures");
		bodytable=picture.getElementsByTagName("tbody")[0];
		newtr=document.createElement("tr"); newtd=document.createElement("td");
		trs=picture.getElementsByTagName("tr");
		if(trs.length<5){
			newtr=document.createElement("tr"); newtd=document.createElement("td");
			newtd.innerHTML="<input type=\"file\" name=\"picture[]\" value=\"\" class=\"input\" />";
			newtr.appendChild(newtd);bodytable.appendChild(newtr);
		}else{
			alert("最多只能添加5张图片...")		
		}
	}
function addshowpic(num){
		picture=document.getElementById("pictures");
		bodytable=picture.getElementsByTagName("tbody")[0];
		newtr=document.createElement("tr"); newtd=document.createElement("td");
		trs=picture.getElementsByTagName("tr");
		if(trs.length<num){
			newtr=document.createElement("tr"); newtd=document.createElement("td");
			newtd.innerHTML="<input type=\"text\" name=\"picturename[]\" class=\"input\" > &nbsp; <input type=\"file\" name=\"picture[]\" value=\"\" class=\"input\" />";
			newtr.appendChild(newtd);bodytable.appendChild(newtr);
		}else{
			alert("最多只能添加"+num+"张图片...")		
		}
	}
function goaddproduct(){
		websites=document.getElementById("website");
		if(websites!=null){if(websites.value==""){alert('Sorry!没有英文站体无法添加贸易信息'); return false;}}
		pronames=document.getElementById("proname");err_1=document.getElementById("err_p");
		if(pronames.value==""){
			err_1.innerHTML="产品名称不能为";err_1.className="red";pronames.focus();return false;}
		key_a=document.getElementById("key1");key_b=document.getElementById("key2");key_c=document.getElementById("key3");err_2=document.getElementById("err_k");
		if(key_a.value=="" && key_b.value=="" && key_c.value==""){err_2.innerHTML="至少一个准确的产品名";err_2.className="red";key_c.focus();return false;}
		descriptions=document.getElementById("description");err_3=document.getElementById("err_des");
		if(descriptions.value==""){err_3.innerHTML="请填写简要描述";err_3.className="red";descriptions.focus();return false;}
		return true;
		
}
function wordnum(obj){
		//box=document.getElementById("details");
		//box=obj;
		info=document.getElementById("wordnums");
		values=obj.value;
		var reg =    /\s+/g;    
 		values=values.replace(reg," "); 
		//arr=values.match(/ /g);   
		arr=values.split(" ");   
		long=arr.length;
		num=100-long;
		if(num>=0){
			info.innerHTML="你还可以输入<font color=red>"+num+"</font>个单词";
			box.style.cssText="border:solid 1px #ccc; width:85%; height:120px;color:#000";
		}else{
			a="";
			for(i=0;i<100;i++){ a=a+arr[i]+" ";}
			box.style.cssText="border:solid 1px #ccc; width:85%; height:120px;color:#ccc";
			box.value=a;info.innerHTML="<font color=red>最多只能输入100个单词,不能在输入字符</font>";
		}

	}