﻿	function showText(fieldID,textID){
		if (document.getElementById(textID) && lrtrim(document.getElementById(fieldID).value.length)==0){
  			document.getElementById(textID).style.display='block';
  	  }
	}
	function isValidatePhotofiletype(fileID,textID){
	 var fileStr=lrtrim(document.getElementById(fileID).value);
		var re = /\.jpg$|\.jpeg$|\.gif$/i;
		if (!fileStr || fileStr==''){
			if ( document.getElementById(textID)){
  			    document.getElementById(textID).style.display='none';
  		  	 }
			return true;
		}
		if (!re.test(fileStr)){		 
  		   //  document.getElementById(fileID).focus();
  		     if (document.getElementById(textID)){
  			        document.getElementById(textID).style.display='block';
				if (document.getElementById("upLoadImg")){
					 document.getElementById("upLoadImg").src="/scv20071110/images/photo_example.gif";
				}
  			      
  			  }else{
  			  	alert("图片后缀格式必需为jpg或gif.");
  		     }
			 return false;
		}else{
		   if (document.getElementById(textID)){
			  document.getElementById(textID).style.display='none';
		   }
		}
		return true;
	}
	function isValidateAddrtype(addrID,textID){
		 var addrStr=lrtrim(document.getElementById(addrID).value);
		if(!addrStr || addrStr == '' || addrStr.length < 5 || addrStr.length>256) {
  		 //   document.getElementById(addrID).focus();
  		    if (document.getElementById(textID)){
  			    document.getElementById(textID).style.display='block';
  		    }else{
  		  		alert("填写大于4个字的详细地址!");
  		    }
			return false;
		}else{
		   if (document.getElementById(textID)){
  			    document.getElementById(textID).style.display='none';
  		    }
		}
			return true;
	}
	function isValidateFilledtype(filledID,textID){
		 var filledStr=lrtrim(document.getElementById(filledID).value);
		if(!filledStr || filledStr == '') return true;
		var isValid=true;
				//	if (filledStr.indexOf(',')!=-1 || filledStr.indexOf(';')!=-1 || 
				//		filledStr.indexOf('.')!=-1 || filledStr.indexOf('!')!=-1){
				//		isValid=false;
				//	};
				//	if (filledStr.indexOf('，')!=-1 || filledStr.indexOf('；')!=-1 || 
				//		filledStr.indexOf('。')!=-1 || filledStr.indexOf('！')!=-1){
				//		isValid=false;
				//	};
 					if (!splitFunc(filledStr,8,2,2)){
	 					 if (document.getElementById(textID)){
	  					    document.getElementById(textID).style.display='block';
	  		 			  }else{
  			 			 	alert("最多可填两个，中间请用空格隔开,每个长度要小于6个字大于２个字.!");
  						  }
 					//	document.getElementById(filledID).focus();
					    return false;
 					}else if (document.getElementById(textID)){
	  					    document.getElementById(textID).style.display='none';
	  		 		 }
					return true;
	}
//begin trim 
	function  lrtrim(str){
		return(lTrim(rTrim(str)));
 	}
	
	//remove null on word at start.
 	function  lTrim(str) {
    	var rtnStr;
   		rtnStr="";
    	for (var i=0;i<str.length;i++){
			if (str.charAt(i)!=' '　&& str.charAt(i)!='　'){
				rtnStr=str.substr(i,str.length);
				break;
			}
			
		};
    	return rtnStr;
 	};
 	
 	//remove null on word at end.
 	function  rTrim(str){
    	var rtnStr;
		rtnStr="";
		for (var i=str.length-1;i>=0;i--){
			if (str.charAt(i)!=' ' && str.charAt(i)!='　'){
				rtnStr=str.substring(0,i+1);
				break;
			}
		}
		return rtnStr;
	};
			//end trim
		//begin splitFunc
		function splitFunc(fieldValue,maxlen,count,minlen){
		   var arrValue;
			  // 在每个空格字符处进行分解。
		   arrValue = fieldValue.split(" ");
		   var j=0,isLong=false;
		   for (var i=0;i<arrValue.length;i++){
			   if (lrtrim(arrValue[i])!=""){
					if (lrtrim(arrValue[i]).length>maxlen || lrtrim(arrValue[i]).length<minlen){
						isLong=true;
					}
					j=j+1;
			   }
		   }
		   	 if (isLong || j>count){
			 	return false;
			 }
			 return true;
		}
		//end splitFunc
		function isValidateCatag(catagID,textID){
		 var value=lrtrim(document.getElementById(catagID).value);
			if(!value || value == '') { 
  			   //     document.getElementById(catagID).focus();
  			        if (document.getElementById(textID)){
  			        	document.getElementById(textID).style.display='block';
  			        }else{
  			  			alert("请填写1到3个分类标签（用空格分隔,每个标签长度不能超过8个字小于2个字!)");
  					}
					return false;
				}
			if (!splitFunc(value,8,3,2)){
			//	document.getElementById(catagID).focus();
				if (document.getElementById(textID)){
  			        	document.getElementById(textID).style.display='block';
  			        }else{
  			  		    alert("请填写1到3个分类标签（用空格分隔,每个标签长度不能超过8个字小于2个字!)");
  				 }
  			    return false
  			 }else{
  			 	if (document.getElementById(textID)){
  			        	document.getElementById(textID).style.display='none';
  			    }
			}
			return true ;
		}
			function isValidateLinktype(linkID,textID){
				 var linkStr=lrtrim(document.getElementById(linkID).value);
				if(!linkStr || linkStr.length < 7 || linkStr == '' || linkStr.length>256) {
  			     //    document.getElementById(linkID).focus();
  			         if (document.getElementById(textID)){
  			            document.getElementById(textID).style.display='block';
  			         }else{
  			 			 alert("请填写您正确的联系方式，如电话、Ｅmail、QQ等!");
  			 	 	}
					return false
				}else{
					 if (document.getElementById(textID)){
  			            document.getElementById(textID).style.display='none';
  			         }
				}
				return true;
			}
			function isValidateAuthtype(authID,textID){
				 var authStr=lrtrim(document.getElementById(authID).value);
				if(!authStr || authStr.length != 4 || authStr == '' ||authStr==null) {
  			      //   document.getElementById(authID).focus();
  			         if (document.getElementById(textID)){
  			         	document.getElementById(textID).style.display='block';
  			         }else{
  			 	 		alert("请输入验证码框右边图片上的字母!");
  					 }
					return false;
				}else  if (document.getElementById(textID)){
  			         	document.getElementById(textID).style.display='none';
  			         }
					return true;
			}
			function isValidateTitleType(titleID,textID){
			
				 var titleStr=lrtrim(document.getElementById(titleID).value);

				if(!titleStr || titleStr == '' || titleStr.length>25) {    //   document.getElementById(titleID).focus();
  			         if (document.getElementById(textID)){
  			         	 document.getElementById(textID).style.display='block';
  			         }else{
  			  			alert("标题不能为空,且长度不能超过25个字!");
  				 	}
					return false;
				}else if (document.getElementById(textID)){
  			         document.getElementById(textID).style.display='none';
				}
			
				return true;
			}
			function isValidateAuthorType(authorID,textID){
				var authorStr=lrtrim(document.getElementById(authorID).value);
				if(!authorStr || authorStr.length >32 || authorStr == '' || authorStr.length>32) {
  			     //   document.getElementById(authorID).focus();
  			      	if (document.getElementById(textID)){
  			        	document.getElementById(textID).style.display='block';
  			        }else{
  			  			alert("联系人姓名不能为空,不能多于32个字.");
  			     	}
					return false;
				}else{
					if (document.getElementById(textID)){
  			        	document.getElementById(textID).style.display='none';
  			   		}
				}
			    return true;
			}
			function isValidateUseridType(userID){
				var userIdStr=lrtrim(document.getElementById(userID).value);
				if(!userIdStr || userIdStr.length >32 || userIdStr == '' || userIdStr.length>32) {
  			     //  document.getElementById(userID).focus();
					return false;
				}
				return true;
			}
			function isvalidateContent(contentID,textID){
				var content=lrtrim(document.getElementById(contentID).value);
				if (content==null || content=='' || content.length>6000){
  			     //	document.getElementById(contentID).focus();
					if (document.getElementById(textID)){
						document.getElementById(textID).style.display='block';
					}else{
  					  	alert("内容不能为空,长度不能少于15个字且不能多于6000个字!");
  					 }
					 return false;
				} else{
					if (document.getElementById(textID)){
						document.getElementById(textID).style.display='none';
					}
				}
				return true;
			}
			function isValidateMainProduct(id,textID){
				var value=lrtrim(document.getElementById(id).value);
				  if (value==null || value==""){
				  	return true;
				  }else{
				  	if (!splitFunc(value,8,5,2)){
				  	//	document.getElementById(id).focus();
				  		if (document.getElementById(textID)){
							document.getElementById(textID).style.display='block';
						}else{
  			  				alert("主营产品可填写0到5个,中间用空格隔开,且每个长度不超过8个字小于２个字!");
  						 }
				  		return false;
				  	}else if (document.getElementById(textID)){
						document.getElementById(textID).style.display='none';
					}
				  }
				  return true;
			}

			function check4Comp(formname,formtitle){
			// var product=document.getElementById("compinfo_product").value;
			var proto = document.getElementById("compinfo_proto");
  			 if(document.getElementById("infoName").value==''){alert("请选择分类!");return false;}
			 if (!isValidateTitleType('compinfo_title','cp_title')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
			 if (!isvalidateContent('compinfo_content','cp_content')) { alert("请把信息填写完整，详情请看红字提示！"); return false;}
			 if (!isValidateAuthorType('compinfo_linkman','cp_author')) { alert("请把信息填写完整，详情请看红字提示！"); return false;}
			 if (!isValidateAddrtype('compinfo_addr','cp_addr'))  { alert("请把信息填写完整，详情请看红字提示！"); return false;}
			 if (!isValidateLinktype('compinfo_link','cp_link')) { alert("请把信息填写完整，详情请看红字提示！"); return false;}
			 if (!isValidatePhotofiletype('compinfo_photo','cp_photo')) { alert("请把信息填写完整，详情请看红字提示！"); return false;}
			 if (!isValidateAuthtype('compinfo_auth','cp_auth')) { alert("请把信息填写完整，详情请看红字提示！"); return false;}
			 if (!isValidateCatag('comp_catag','cp_catag')){ alert("请把信息填写完整，详情请看红字提示！");return false;}
			 if (!isValidateMainProduct('compinfo_product','cp_mproduct')){ alert("请把信息填写完整，详情请看红字提示！");return false;}
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
			//设置上传按钮为不可用状态，避免多次提交
	 // 		  $('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
			if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}                  
		}
		function check4Live(formname,formtitle){
		 if(document.getElementById("infoName").value==''){alert("请选择分类!");return false;}
		var proto = document.getElementById("pubinfo_proto");
		 if (!isValidateTitleType('pubinfo_title','lv_title')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isvalidateContent('pubinfo_content','lv_content')) { alert("请把信息填写完整，详情请看红字提示！"); return false;}
		 if (!isValidateAuthorType('pubinfo_promulgator','lv_author')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateAddrtype('pubinfo_addr','lv_addr'))  {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateLinktype('pubinfo_link','lv_link')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidatePhotofiletype('pubinfo_photo','lv_photo')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateAuthtype('pubinfo_auth','lv_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		  if (!isValidateCatag('live_catag','lv_catag')){alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
		}
	//	$('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}
		function check4Product(formname,formtitle){
		 if(document.getElementById("infoName").value==''){alert("请选择分类!");return false;}
			var proto = document.getElementById("productProto");
			if (!isValidateTitleType('prodinfo_name','pr_title')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isvalidateContent('prodinfo_describe','pr_content')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidateAuthorType('prodinfo_promulgator','pr_author')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidateAddrtype('prodinfo_address','pr_addr'))  {alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidateLinktype('prodinfo_promlink','pr_link')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidatePhotofiletype('prodinfo_photo','pr_photo')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidateAuthtype('product_auth','pr_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidateFilledtype('prodinfo_replaceprod','pr_fill')){alert("请把信息填写完整，详情请看红字提示！");return false;}
	        if (!isValidateCatag('product_catag','pr_catag')){alert("请把信息填写完整，详情请看红字提示！");return false;}
	
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
		//	$('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}
		function check4Trade(formname,formtitle){
		 if(document.getElementById("infoName").value==''){alert("请选择分类!");return false;}
		 var proto = document.getElementById("salesinfo_proto");
		 if (!isValidateTitleType('salesinfo_title','tr_title')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isvalidateContent('salesinfo_content','tr_content')) {alert("请把信息填写完整，详情请看红字提示！"); return false;}
		 if (!isValidateAuthorType('salesinfo_promulgator','tr_author')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateAddrtype('salesinfo_addr','tr_addr'))  {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateLinktype('salesinfo_link','tr_link')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidatePhotofiletype('salesinfo_photo','tr_photo')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateAuthtype('salesinfo_auth','tr_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateCatag('trade_catag','tr_catag')){alert("请把信息填写完整，详情请看红字提示！");return false;}
			var proto = document.getElementById("salesinfo_proto");
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
			//  $('fb_button').disabled = true; // firefox支持此属性，ＩＥ不支持
			var pars ="";
	  	 new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: pars, onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}
		function check4UserComp(formname,formtitle){
			// var product=document.getElementById("compinfo_product").value;
			var proto = document.getElementById("compinfo_proto");
			 if (!isvalidateContent('compinfo_content','cp_content')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
			 if (!isValidatePhotofiletype('compinfo_photo','cp_photo')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
			 if (!isValidateAuthtype('compinfo_auth','cp_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
			 if (!isValidateCatag('comp_catag','cp_catag')){alert("请把信息填写完整，详情请看红字提示！");return false;}
			 if (!isValidateMainProduct('compinfo_product','cp_mproduct')){alert("请把信息填写完整，详情请看红字提示！");return false;}
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
			if (document.getElementById("compinfo_user_type")){
				var userType=document.getElementById("user_type").value;
				var infoType=document.getElementById("info_type").value;
				document.getElementById("compinfo_user_type").value=userType;
				document.getElementById("compinfo_info_type").value=infoType;
			}
			//设置上传按钮为不可用状态，避免多次提交
	 // 		  $('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
			if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}                  
		}
		function check4UserLive(formname,formtitle){
	 	 var proto = document.getElementById("pubinfo_proto");
		 if (!isValidateTitleType('pubinfo_title','lv_title')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isvalidateContent('pubinfo_content','lv_content')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidatePhotofiletype('pubinfo_photo','lv_photo')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateAuthtype('pubinfo_auth','lv_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		  if (!isValidateCatag('live_catag','lv_catag')){alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
		}
			if (document.getElementById("live_user_type")){
				var userType=document.getElementById("user_type").value;
				var infoType=document.getElementById("info_type").value;
				document.getElementById("live_user_type").value=userType;
				document.getElementById("live_info_type").value=infoType;
			 }
	//	$('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}
		function check4UserProduct(formname,formtitle){
			var proto = document.getElementById("productProto");
			if (!isValidateTitleType('prodinfo_name','pr_title')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isvalidateContent('prodinfo_describe','pr_content')) {alert("请把信息填写完整，详情请看红字提示！"); return false;}
		    if (!isValidatePhotofiletype('prodinfo_photo','pr_photo')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidateAuthtype('product_auth','pr_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidateFilledtype('prodinfo_replaceprod','pr_fill')){alert("请把信息填写完整，详情请看红字提示！");return false;}
	           if (!isValidateCatag('product_catag','pr_catag')){alert("请把信息填写完整，详情请看红字提示！");return false;}
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
			if (document.getElementById("product_user_type")){
				var userType=document.getElementById("user_type").value;
				var infoType=document.getElementById("info_type").value;
				document.getElementById("product_user_type").value=userType;
				document.getElementById("product_info_type").value=infoType;
			 }
		//	$('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}

		function check4UserTrade(formname,formtitle){
		 var proto = document.getElementById("salesinfo_proto");
		 if (!isValidateTitleType('salesinfo_title','tr_title')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isvalidateContent('salesinfo_content','tr_content')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidatePhotofiletype('salesinfo_photo','tr_photo')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateAuthtype('salesinfo_auth','tr_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateCatag('trade_catag','tr_catag')){alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (document.getElementById("trade_user_type")){
			var userType=document.getElementById("user_type").value;
			var infoType=document.getElementById("info_type").value;
			document.getElementById("trade_user_type").value=userType;
			document.getElementById("trade_info_type").value=infoType;
		 }
			var proto = document.getElementById("salesinfo_proto");
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
			//  $('fb_button').disabled = true; // firefox支持此属性，ＩＥ不支持
			var pars ="";
	 	    new Ajax.Updater('status',
                    'fileupload',
                    {asynchronous:true, method: 'post', parameters: pars, onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}
				function check4UserEditComp(formname,formtitle){
			// var product=document.getElementById("compinfo_product").value;
			var proto = document.getElementById("compinfo_proto");
			 if (!isvalidateContent('compinfo_content','cp_content')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
			 if (!isValidatePhotofiletype('compinfo_photo','cp_photo')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
			 if (!isValidateAuthtype('compinfo_auth','cp_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
			 if (!isValidateCatag('comp_catag','cp_catag')){alert("请把信息填写完整，详情请看红字提示！");return false;}
			 if (!isValidateMainProduct('compinfo_product','cp_mproduct')){alert("请把信息填写完整，详情请看红字提示！");return false;}
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
			
			//设置上传按钮为不可用状态，避免多次提交
	 // 		  $('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
			if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}                  
		}
		function check4UserEditLive(formname,formtitle){
	 	 var proto = document.getElementById("pubinfo_proto");
		 if (!isValidateTitleType('pubinfo_title','lv_title')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isvalidateContent('pubinfo_content','lv_content')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidatePhotofiletype('pubinfo_photo','lv_photo')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateAuthtype('pubinfo_auth','lv_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		  if (!isValidateCatag('live_catag','lv_catag')){alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
		}
	//	$('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}
		function check4UserEditProduct(formname,formtitle){
			var proto = document.getElementById("productProto");
			if (!isValidateTitleType('prodinfo_name','pr_title')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isvalidateContent('prodinfo_describe','pr_content')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidatePhotofiletype('prodinfo_photo','pr_photo')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidateAuthtype('product_auth','pr_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		    if (!isValidateFilledtype('prodinfo_replaceprod','pr_fill')){alert("请把信息填写完整，详情请看红字提示！");return false;}
	           if (!isValidateCatag('product_catag','pr_catag')){alert("请把信息填写完整，详情请看红字提示！");return false;}
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
			
		//	$('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}

		function check4UserEditTrade(formname,formtitle){
		 var proto = document.getElementById("salesinfo_proto");
		 if (!isValidateTitleType('salesinfo_title','tr_title')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isvalidateContent('salesinfo_content','tr_content')) { alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidatePhotofiletype('salesinfo_photo','tr_photo')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateAuthtype('salesinfo_auth','tr_auth')) {alert("请把信息填写完整，详情请看红字提示！");return false;}
		 if (!isValidateCatag('trade_catag','tr_catag')){return false;}
			var proto = document.getElementById("salesinfo_proto");
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
			//  $('fb_button').disabled = true; // firefox支持此属性，ＩＥ不支持
			var pars ="";
	 	    new Ajax.Updater('status',
                    'fileupload',
                    {asynchronous:true, method: 'post', parameters: pars, onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}
		function check4QQComp(formname,formtitle){
			// var product=document.getElementById("compinfo_product").value;
			var proto = document.getElementById("compinfo_proto");
			 if (!isValidateTitleType('compinfo_title','')) { return false;}
			 if (!isvalidateContent('compinfo_content','')) { return false;}
			 if (!isValidateAuthorType('compinfo_linkman','')) {return false;}
			 if (!isValidateAddrtype('compinfo_addr',''))  {return false;}
			 if (!isValidateLinktype('compinfo_link','')) {return false;}
			 if (!isValidatePhotofiletype('compinfo_photo','')) {return false;}
			 if (!isValidateAuthtype('compinfo_auth','')) {return false;}
			 if (!isValidateCatag('comp_catag','')){return false;}
			 if (!isValidateMainProduct('compinfo_product','')){return false;}
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
			//设置上传按钮为不可用状态，避免多次提交
	 // 		  $('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
			if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}                  
		}
		function check4QQLive(formname,formtitle){
		var proto = document.getElementById("pubinfo_proto");
		 if (!isValidateTitleType('pubinfo_title','')) { return false;}
		 if (!isvalidateContent('pubinfo_content','')) { return false;}
		 if (!isValidateAuthorType('pubinfo_promulgator','')) {return false;}
		 if (!isValidateAddrtype('pubinfo_addr',''))  {return false;}
		 if (!isValidateLinktype('pubinfo_link','')) {return false;}
		 if (!isValidatePhotofiletype('pubinfo_photo','')) {return false;}
		 if (!isValidateAuthtype('pubinfo_auth','')) {return false;}
		  if (!isValidateCatag('live_catag','')){return false;}
		 if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
		}
	//	$('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}
		function check4QQProduct(formname,formtitle){
			var proto = document.getElementById("productProto");
			if (!isValidateTitleType('prodinfo_name','')) { return false;}
		    if (!isvalidateContent('prodinfo_describe','')) { return false;}
		    if (!isValidateAuthorType('prodinfo_promulgator','')) {return false;}
		    if (!isValidateAddrtype('prodinfo_address',''))  {return false;}
		    if (!isValidateLinktype('prodinfo_promlink','')) {return false;}
		    if (!isValidatePhotofiletype('prodinfo_photo','')) {return false;}
		    if (!isValidateAuthtype('product_auth','')) {return false;}
		    if (!isValidateFilledtype('prodinfo_replaceprod','')){return false;}
	        if (!isValidateCatag('product_catag','')){return false;}
	
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
		//	$('fb_button').disabled = true;
			new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: '', onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}
		function check4QQTrade(formname,formtitle){
		 var proto = document.getElementById("salesinfo_proto");
		 if (!isValidateTitleType('salesinfo_title','')) { return false;}
		 if (!isvalidateContent('salesinfo_content','')) { return false;}
		 if (!isValidateAuthorType('salesinfo_promulgator','')) {return false;}
		 if (!isValidateAddrtype('salesinfo_addr',''))  {return false;}
		 if (!isValidateLinktype('salesinfo_link','')) {return false;}
		 if (!isValidatePhotofiletype('salesinfo_photo','')) {return false;}
		 if (!isValidateAuthtype('salesinfo_auth','')) {return false;}
		 if (!isValidateCatag('trade_catag','')){return false;}
			var proto = document.getElementById("salesinfo_proto");
			if (!proto.checked){
			  alert("发布失败!在趣得"+formtitle+"时，必须确认：您已经阅读并且同意《趣得协议》");
			  return false;
			}
			//  $('fb_button').disabled = true; // firefox支持此属性，ＩＥ不支持
			var pars ="";
	  	 new Ajax.Updater('status',
                     'fileupload',
                     {asynchronous:true, method: 'post', parameters: pars, onFailure: reportError});
        	if (window.navigator.userAgent.indexOf("MSIE")>=1)	{	//如果浏览器为IE
			}else if (window.navigator.userAgent.indexOf("Firefox")>=1)	{	//如果浏览器为Firefox
				   return true;
			}    
		}
	// beginning ajax upload	
	  function reportError(request) {	//出错时处理方法
	 //	  $('fb_button').disabled = false;
	  }

	  function killUpdate(rsStr,message,type,ut,editeUrl,shareUrl,newUrl) {	//上传完毕后,取消周期性获取进度状态，将最终的状态显示在客户端
	   //	$('fb_button').disabled = false;
	   	 	 var img_id="biz_codeImg";
	   		 switch(type)
				{
					case 'INFO':
						img_id="biz_codeImg";						
						break;
					case 'COMP':
						img_id="comp_codeImg";
						break;
					case 'PRODUCT':
						img_id="product_codeImg";						
						break;
					case 'LIVE':
						img_id="live_codeImg";
						break;
				}
			document.getElementById(img_id).src ="/authImg?r="+Math.random();
	    if(rsStr == 'false') { //如果有错误信息，则显示出来
	      	var msg = message.toLowerCase();
				switch(msg)
				{
					case 'err_auth':
						alert("趣得提示,发布失败!请输入正确的验证码。");							
						break;
					case 'err_picfile':
						alert("趣得提示,发布失败!只能上传小于 200Kb 的 .jpg .gif 图片。");
						break;
					case 'toobig':
						alert("趣得提示,发布失败!文件太大。只能上传小于 200Kb 的 .jpg .gif 图片。");
						break;
					case 'duplicate':
						alert("趣得提示,发布失败!请不要提交重复的数据!"); 
						break;
					case 'mendacions':
						alert("趣得提示,发布失败!该信息无效，请重新整理一下发布的内容!"); 
						break;
					case 'reactive':
						alert("趣得提示,发布失败!内容中包含敏感词汇,请重新整理一下发布的内容!"); 
						break;
					case 'seo':
						alert("趣得提示,发布失败!使用了过多的重复词句，请重新整理一下发布的内容!"); 
						break;
					case 'sexy':
						alert("趣得提示,发布失败!内容中包含敏感词汇,请重新整理一下发布的内容!"); 
						break;
					case 'addr':
						alert("趣得提示,发布失败!请填写更详细的联系地址!");
						break;
					case 'script':
						alert("趣得提示,发布失败!发布的信息中请不要包含脚本!");
						break;
					case 'outcount':
						alert("趣得提示，发布失败，本站空间有限，每个用户只能发布３０条信息，如有更多需求，请与我们客服联系．");
					case 'valid':
					    alert("趣得提示，发布失败！请填写正确的数据格式！");
						break;
					case 'black':
					    alert("趣得提示，发布失败！信息中含有很敏感内容,请整理后重新发布！");
						break;
					case 'error':
						alert("趣得提示,发布失败!在数据传输过程中出现错误."); 
						break;
					case 'exception':
						alert("趣得提示,发布失败!在存储过程中出现错误."); 
						break;
					default:
						alert("趣得提示,发布失败!在发布过程中出现错误！"); 
				}
				
	    } else {//如果没有错误信息,获取上传文件的完成状态，显示到客户端
	     	this.openSucc(ut,editeUrl,shareUrl,newUrl);
	    }
	  }
			// end ajax upload
	function openSucc(ut,editeUrl,shareUrl,newUrl){
		if (ut!='REG'){
			document.getElementById("edit_url").value=editeUrl;
			document.getElementById("share_url").value=shareUrl;
			document.getElementById("see_id").href=shareUrl;
			document.getElementById("new_more_id").href=newUrl;
			document.getElementById("qudee_succeed").style.display='block';
		}else{
			alert("保存成功!您的信息正在审核中，请稍后查看。");
		}

	}	
	function onKeydownPub(evt,form,title){
		evt = evt?evt:window.event;
		var keynum=0;
		if(window.event) // IE
		{
			keynum = evt.keyCode;
		}
		else if(evt.which) // Netscape/Firefox/Opera
		{
			keynum = evt.which;
		}

		if(keynum==13){
			if (form=="liveInfoForm"){
				check4Live(form,title);
			}
			if (form=="compInfoForm"){
				check4Comp(form,title);
			}
			if (form=="productInfoForm"){
				check4Product(form,title);
			}	
			if (form=="tradeInfoForm"){
				check4Trade(form,title);
			}
		}
	}
		
		function refresh(name){
		   var codeImg = document.getElementById(name);
		   codeImg.src ="/authImg?r="+Math.random();
		}
		function viewImg(id){
			document.getElementById("upLoadImg").src=document.getElementById(id).value;
		}
		function userViewImg(urlId,viewId){
			document.getElementById(viewId).src=document.getElementById(urlId).value;
		}
		
		function reset4Comp(){
			document.getElementById("compinfo_title").value="";
			document.getElementById("compinfo_content").value="";
			 linkman=document.getElementById("compinfo_linkman").value="";
			 document.getElementById("compinfo_addr").value="";
			 document.getElementById("compinfo_link").value="";
			document.getElementById("compinfo_photo").value="";
			document.getElementById("compinfo_auth").value="";
			document.getElementById("compinfo_proto").checked='checked';
			document.getElementById("compinfo_product").value="";
			document.getElementById("comp_catag").value="";
			var codeImg = document.getElementById('comp_codeImg');
		   	codeImg.src ="/authImg?r="+Math.random();
			
		}
		function reset4Live(formname,formtitle){
		    document.getElementById("pubinfo_title").value="";
		    document.getElementById("pubinfo_content").value="";
		    document.getElementById("pubinfo_promulgator").value="";
		    document.getElementById("pubinfo_addr").value="";
		    document.getElementById("pubinfo_link").value="";
		    document.getElementById("pubinfo_photo").value="";
		    document.getElementById("pubinfo_auth").value="";
		    document.getElementById("pubinfo_proto").checked='checked';
		    var codeImg = document.getElementById('live_codeImg');
		    codeImg.src ="/authImg?r="+Math.random();
		   document.getElementById("live_catag").value="";
		}
		function reset4Product(formname,formtitle){
			document.getElementById("prodinfo_name").value="";
			document.getElementById("prodinfo_describe").value="";
			document.getElementById("prodinfo_promulgator").value="";
		 	document.getElementById("prodinfo_address").value="";
			document.getElementById("prodinfo_promlink").value="";
			document.getElementById("prodinfo_photo").value="";
			document.getElementById("product_auth").value="";
			document.getElementById("prodinfo_replaceprod").value="";
			document.getElementById("productProto").checked='checked';
			document.getElementById("product_catag").value="";
		 var codeImg = document.getElementById('product_codeImg');
		   codeImg.src ="/authImg?r="+Math.random();
			
		}
		function reset4Trade(formname,formtitle){
		 document.getElementById("salesinfo_title").value="";
		 document.getElementById("salesinfo_content").value="";
		 document.getElementById("salesinfo_promulgator").value="";
		 document.getElementById("salesinfo_addr").value="";
		 document.getElementById("salesinfo_link").value="";
		 document.getElementById("salesinfo_photo").value="";
		 document.getElementById("salesinfo_auth").value="";
		 document.getElementById("salesinfo_proto").checked='checked';
		 document.getElementById("trade_catag").value="";
		 
		 var codeImg = document.getElementById('biz_codeImg');
		   codeImg.src ="/authImg?r="+Math.random();
		}
		
		function reset4UserComp(){
			document.getElementById("compinfo_title").value="";
			document.getElementById("compinfo_content").value="";
			// linkman=document.getElementById("compinfo_linkman").value="";
			// document.getElementById("compinfo_addr").value="";
			// document.getElementById("compinfo_link").value="";
			document.getElementById("compinfo_photo").value="";
			document.getElementById("compinfo_auth").value="";
			document.getElementById("compinfo_proto").checked='checked';
			document.getElementById("compinfo_product").value="";
			document.getElementById("comp_catag").value="";
			var codeImg = document.getElementById('comp_codeImg');
		   	codeImg.src ="/authImg?r="+Math.random();
			
		}
		function reset4UserLive(formname,formtitle){
		    document.getElementById("pubinfo_title").value="";
		    document.getElementById("pubinfo_content").value="";
		  //  document.getElementById("pubinfo_promulgator").value="";
		  //  document.getElementById("pubinfo_addr").value="";
		  //  document.getElementById("pubinfo_link").value="";
		    document.getElementById("pubinfo_photo").value="";
		    document.getElementById("pubinfo_auth").value="";
		    document.getElementById("pubinfo_proto").checked='checked';
		    var codeImg = document.getElementById('live_codeImg');
		    codeImg.src ="/authImg?r="+Math.random();
		   document.getElementById("live_catag").value="";
		}
		function reset4UserProduct(formname,formtitle){
			document.getElementById("prodinfo_name").value="";
			document.getElementById("prodinfo_describe").value="";
		//	document.getElementById("prodinfo_promulgator").value="";
		 //	document.getElementById("prodinfo_address").value="";
		//	document.getElementById("prodinfo_promlink").value="";
			document.getElementById("prodinfo_photo").value="";
			document.getElementById("product_auth").value="";
			document.getElementById("prodinfo_replaceprod").value="";
			document.getElementById("productProto").checked='checked';
			document.getElementById("product_catag").value="";
		 var codeImg = document.getElementById('product_codeImg');
		   codeImg.src ="/authImg?r="+Math.random();
			
		}
		function reset4UserTrade(formname,formtitle){
		 document.getElementById("salesinfo_title").value="";
		 document.getElementById("salesinfo_content").value="";
		// document.getElementById("salesinfo_promulgator").value="";
		// document.getElementById("salesinfo_addr").value="";
		// document.getElementById("salesinfo_link").value="";
		 document.getElementById("salesinfo_photo").value="";
		 document.getElementById("salesinfo_auth").value="";
		 document.getElementById("salesinfo_proto").checked='checked';
		 document.getElementById("trade_catag").value="";
		 
		 var codeImg = document.getElementById('biz_codeImg');
		   codeImg.src ="/authImg?r="+Math.random();
		}

		function CopyText(id)
              {
                      //copyToClipboard(document.getElementById(id).value);
                      copy(document.getElementById(id).value);
              }
               function copy(text2copy) {
              if (window.clipboardData) {   
                window.clipboardData.setData("Text",text2copy);   
              } else {   
                var flashcopier = 'flashcopier';
                   if(!document.getElementById(flashcopier)) {
             var divholder = document.createElement('div');
               divholder.id = flashcopier;
              document.body.appendChild(divholder);
            }
           document.getElementById(flashcopier).innerHTML = '';
             var divinfo = '<embed src="/scv20071110/flash/_clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';//这里是关键
         document.getElementById(flashcopier).innerHTML = divinfo;
         alert('复制成功!');
         }
         }
              function copyToClipboard(meintext)
          {
           if (window.clipboardData)
             {
             alert("ie");
             // the IE-manier
             window.clipboardData.setData("Text", meintext);
             // waarschijnlijk niet de beste manier om Moz/NS te detecteren;
             // het is mij echter onbekend vanaf welke versie dit precies werkt:
             }
             else if (window.netscape)
             {

             // dit is belangrijk maar staat nergens duidelijk vermeld:
             // you have to sign the code to enable this, or see notes below
             netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
             
             // maak een interface naar het clipboard
             var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
             if (!clip) return;
             alert("mozilla");
             // maak een transferable
             var trans = Components.classes['@mozilla.org/widget/transferable;1']
                            .createInstance(Components.interfaces.nsITransferable);
             if (!trans) return;
             
             // specificeer wat voor soort data we op willen halen; text in dit geval
             trans.addDataFlavor('text/unicode');
          
             // om de data uit de transferable te halen hebben we 2 nieuwe objecten
             // nodig om het in op te slaan
             var str = new Object();
             var len = new Object();
             var str = Components.classes["@mozilla.org/supports-string;1"]
                     .createInstance(Components.interfaces.nsISupportsString);
             var copytext=meintext;
             str.data=copytext;
             trans.setTransferData("text/unicode",str,copytext.length*2);
             var clipid=Components.interfaces.nsIClipboard;
              if (!clip) return false;
             clip.setData(trans,null,clipid.kGlobalClipboard);
             }
        alert("Following info was copied to your clipboard:\n\n" + meintext);
             return false;
          } 