﻿var transObj = {radio:0.0,perhour:0.0,perprice:0.0,hours:0.0,subject_ratio:0.0,words:0};
var dateTime = {date:"",hour:" 12:00:00"};
var transLanguage = {source:"",target:""};
var transLevel ={level:0};
var file_index=1;
var delfile_index=0;
var hasfile=0;
var trans_lang=1;
var trans_type = 0;
var jsonArray= {  
  "languagelist":[{'English_to_Chinese':'english-->chinese','Chinese_to_English':'chinese-->english'},
				  {'English_to_Chinese':'\u82f1\u6587-->\u4e2d\u6587','Chinese_to_English':'\u4e2d\u6587-->\u82f1\u6587'}],
  "fieldlist":[{'unknown':'\u4e00\u822c(\u4e13\u4e1a\u672f\u8bed\u5c11)','zhengshu':' \u8bc1\u4e66/\u6587\u51ed/\u6267\u7167/\u7b80\u5386 ','jinrong':' \u91d1\u878d/\u4fdd\u9669/\u8bc1\u5238 ','shangmao':' \u5916\u8d38/\u5546\u52a1 ','falv':' \u6cd5\u5f8b ',
			    'xinwen':' News ','zongjiao':' \u5b97\u6559 ','shichang':' \u5e02\u573a\u8425\u9500 ','wenxue':' \u6587\u5b66 ','yishu':' \u827a\u672f ','tiyu':' \u4f53\u80b2/\u6587\u5316 ',
				'dianzi':' \u7535\u5b50 ','jiaotong':' \u4ea4\u901a ','it':' IT/\u901a\u4fe1 ','huagong':' \u5316\u5de5 ','jianzhu':' \u5efa\u7b51/\u5efa\u6750 ','nengyuan':' \u80fd\u6e90 ', 
				'huanbao':' \u73af\u4fdd ','yejin':' \u77ff\u4ea7/\u51b6\u91d1 ','cailiao':' \u6750\u6599 ','wuliu':' \u7269\u6d41/\u8fd0\u8f93 ','hangkong':' \u822a\u7a7a/\u822a\u5929 ','guofang':' \u56fd\u9632 ',
				'fangzhi':' \u7eba\u7ec7 ','yinshua':' \u5370\u5237 ','nongmu':' \u519c\u7267 ', 'yixue':' \u533b\u5b66/\u533b\u7597 ','dili':' \u5730\u7406 ','shuxue':' \u6570\u5b66/\u7edf\u8ba1\u5b66 ',
				'shengwu':' \u751f\u7269 ','kaogu':' \u7269\u7406\u5b66 ', 'gongcheng':'\u673a\u68b0\u5de5\u7a0b', 'qita':' \u5176\u4ed6\u7b49 '	
			   },
			   {'unknown':'\u4e00\u822c(\u4e13\u4e1a\u672f\u8bed\u5c11)','zhengshu':' \u8bc1\u4e66/\u6587\u51ed/\u6267\u7167/\u7b80\u5386 ','jinrong':' \u91d1\u878d/\u4fdd\u9669/\u8bc1\u5238 ','shangmao':' \u5916\u8d38/\u5546\u52a1 ','falv':' \u6cd5\u5f8b ',
				'xinwen':' \u65b0\u95fb ','zongjiao':' \u5b97\u6559 ','shichang':' \u5e02\u573a\u8425\u9500 ','wenxue':' \u6587\u5b66 ','yishu':' \u827a\u672f ','tiyu':' \u4f53\u80b2/\u6587\u5316 ',
				'dianzi':' \u7535\u5b50 ','jiaotong':' \u4ea4\u901a ','it':' IT/\u901a\u4fe1 ','huagong':' \u5316\u5de5 ','jianzhu':' \u5efa\u7b51/\u5efa\u6750 ','nengyuan':' \u80fd\u6e90 ', 
				'huanbao':' \u73af\u4fdd ','yejin':' \u77ff\u4ea7/\u51b6\u91d1 ','cailiao':' \u6750\u6599 ','wuliu':' \u7269\u6d41/\u8fd0\u8f93 ','hangkong':' \u822a\u7a7a/\u822a\u5929 ','guofang':' \u56fd\u9632 ',
				'fangzhi':' \u7eba\u7ec7 ','yinshua':' \u5370\u5237 ','nongmu':' \u519c\u7267 ', 'yixue':' \u533b\u5b66/\u533b\u7597 ','dili':' \u5730\u7406 ','shuxue':' \u6570\u5b66/\u7edf\u8ba1\u5b66 ',
				'shengwu':' \u751f\u7269 ','kaogu':' \u7269\u7406\u5b66 ', 'gongcheng':'\u673a\u68b0\u5de5\u7a0b', 'qita':' \u5176\u4ed6\u7b49 '	
			  }],
  "alertObj":[{
			 language:"\u8bf7\u9009\u62e9\u7ffb\u8bd1\u8bed\u8a00!",
			 num:"\u8bf7\u8f93\u5165\u6570\u5b57!",
			 file:"\u8bf7\u9009\u62e9\u6587\u4ef6\u540e,\u518d\u6dfb\u52a0\u5176\u4ed6\u6587\u4ef6!",
			 filetype:"\u8bf7\u9009\u62e9\u6587\u4ef6\u7c7b\u578b!",
			 fieldtype:"\u8bf7\u9009\u62e9\u884c\u4e1a\u7c7b\u578b!",
			 smallContent:"\u8bf7\u8f93\u5165\u7a3f\u4ef6\u7684\u5185\u5bb9!",
			 isfile:"\u8bf7\u9009\u62e9\u4e0a\u4f20\u7684\u6587\u4ef6!",
			 transTime:"\u8bf7\u8f93\u5165\u4ea4\u7a3f\u65f6\u95f4",
			 selectTime:"\u8bf7\u9009\u62e9\u5927\u4e8e\u5f53\u524d\u65e5\u671f\u7684\u65f6\u95f4!",
			 commentNote:"\u60a8\u53ef\u4ee5\u8f93\u5165\u5bf9\u7a3f\u4ef6\u7ffb\u8bd1\u7684\u8981\u6c42\u6216\u8005\u6ce8\u610f\u4e8b\u9879,\u751a\u81f3\u662f\u4e0a\u4f20\u4e00\u6bb5\u53c2\u8003\u6587\u4ef6,\u4ee5\u4fbf\u83b7\u5f97\u66f4\u597d\u7684\u7ffb\u8bd1\u8d28\u91cf.",
			 nothingHappend:"\u8bf7\u5148\u586b\u5199\u5fc5\u586b\u9009\u9879!",	
			 priceWait:"\u7b49\u5f85\u62a5\u4ef7",
			 languageNotice:"\u7a3f\u4ef6\u5185\u5bb9\u8f93\u5165\u6709\u8bef,\u8bf7\u91cd\u65b0\u786e\u8ba4!",
			 contactPhone1:"\u8bf7\u586b\u5199\u8054\u7cfb\u7535\u8bdd\uff0c\u4ee5\u4fbf\u6c9f\u901a\u7a3f\u4ef6\u76f8\u5173\u95ee\u9898\uff01",
			 contactPhone2:"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u624b\u673a\u53f7\u7801\u6216\u7535\u8bdd\u53f7\u7801",
			 contactPhone3:"\u60a8\u63d0\u4f9b\u7684\u7535\u8bdd\u53f7\u7801\u770b\u8d77\u6765\u6709\u70b9\u77ed\uff01",
			 contactPhone4:"\u60a8\u63d0\u4f9b\u7684\u7535\u8bdd\u53f7\u7801\u770b\u8d77\u6765\u6709\u70b9\u957f\uff01",
			 morehour:"\u5728\u968f\u4f60\u8bd1\uff0c3000\u5b57\u7684\u7a3f\u4ef6\u9ed8\u8ba4\u7ffb\u8bd1\u65f6\u95f4\u4e3a24\u5c0f\u65f6\u3002\u5982\u679c\u60a8\u7684\u7a3f\u4ef6\u57283000\u5b57\u4ee5\u4e0a\uff0c\u9700\u8981\u5feb\u4e8e24\u5c0f\u65f6\u4ea4\u7a3f\uff0c\u8bf7\u54a8\u8be2\u7f51\u4e0a\u5ba2\u670d\u3002"							
			 },{
			 language:"\u8bf7\u9009\u62e9\u7ffb\u8bd1\u8bed\u8a00!",
		     num:"\u8bf7\u8f93\u5165\u6570\u5b57!",
			 file:"\u8bf7\u9009\u62e9\u6587\u4ef6\u540e,\u518d\u6dfb\u52a0\u5176\u4ed6\u6587\u4ef6!",
			 filetype:"\u8bf7\u9009\u62e9\u6587\u4ef6\u7c7b\u578b!",
			 fieldtype:"\u8bf7\u9009\u62e9\u884c\u4e1a\u7c7b\u578b!",
			 smallContent:"\u8bf7\u8f93\u5165\u7a3f\u4ef6\u7684\u5185\u5bb9!",
			 isfile:"\u8bf7\u9009\u62e9\u4e0a\u4f20\u7684\u6587\u4ef6!",
			 transTime:"\u8bf7\u8f93\u5165\u4ea4\u7a3f\u65f6\u95f4",
			 selectTime:"\u8bf7\u9009\u62e9\u5927\u4e8e\u5f53\u524d\u65e5\u671f\u7684\u65f6\u95f4!",
			 commentNote:"\u60a8\u53ef\u4ee5\u8f93\u5165\u5bf9\u7a3f\u4ef6\u7ffb\u8bd1\u7684\u8981\u6c42\u6216\u8005\u6ce8\u610f\u4e8b\u9879,\u751a\u81f3\u662f\u4e0a\u4f20\u4e00\u6bb5\u53c2\u8003\u6587\u4ef6,\u4ee5\u4fbf\u83b7\u5f97\u66f4\u597d\u7684\u7ffb\u8bd1\u8d28\u91cf.",
			 nothingHappend:"\u8bf7\u5148\u586b\u5199\u5fc5\u586b\u9009\u9879!",
			 priceWait:"\u7b49\u5f85\u62a5\u4ef7",
			 languageNotice:"\u7a3f\u4ef6\u5185\u5bb9\u8f93\u5165\u6709\u8bef,\u8bf7\u91cd\u65b0\u786e\u8ba4!",	
			 contactPhone1:"\u8bf7\u586b\u5199\u8054\u7cfb\u7535\u8bdd\uff0c\u4ee5\u4fbf\u6c9f\u901a\u7a3f\u4ef6\u76f8\u5173\u95ee\u9898\uff01",
			 contactPhone2:"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u624b\u673a\u53f7\u7801\u6216\u7535\u8bdd\u53f7\u7801",
			 contactPhone3:"\u60a8\u63d0\u4f9b\u7684\u7535\u8bdd\u53f7\u7801\u770b\u8d77\u6765\u6709\u70b9\u77ed\uff01",
			 contactPhone4:"\u60a8\u63d0\u4f9b\u7684\u7535\u8bdd\u53f7\u7801\u770b\u8d77\u6765\u6709\u70b9\u957f\uff01",
			 morehour:"\u5728\u968f\u4f60\u8bd1\uff0c3000\u5b57\u7684\u7a3f\u4ef6\u9ed8\u8ba4\u7ffb\u8bd1\u65f6\u95f4\u4e3a24\u5c0f\u65f6\u3002\u5982\u679c\u60a8\u7684\u7a3f\u4ef6\u57283000\u5b57\u4ee5\u4e0a\uff0c\u9700\u8981\u5feb\u4e8e24\u5c0f\u65f6\u4ea4\u7a3f\uff0c\u8bf7\u54a8\u8be2\u7f51\u4e0a\u5ba2\u670d\u3002"
			 }],
  "transNote":[{smalltrans:"\u6b63\u5728\u63d0\u4ea4\u7a3f\u4ef6\u6570\u636e,\u8bf7\u7a0d\u5019......",
  				bigtrans:"\u6b63\u5728\u63d0\u4ea4\u7a3f\u4ef6\u6570\u636e,\u8bf7\u7a0d\u5019......"},
			   {smalltrans:"\u6b63\u5728\u63d0\u4ea4\u7a3f\u4ef6\u6570\u636e,\u8bf7\u7a0d\u5019......",
			    bigtrans:"\u6b63\u5728\u63d0\u4ea4\u7a3f\u4ef6\u6570\u636e,\u8bf7\u7a0d\u5019......"}],
  "transLevelObj":[{standard:"\u6807\u51c6\u7ea7",
  					expert:"\u4e13\u5bb6\u7ea7"},
  				   {standard:"\u6807\u51c6\u7ea7",
  				    expert:"\u4e13\u5bb6\u7ea7"}],
  "priceNoteObj":[{preNote:"",afterNote:"\u5143"},{preNote:"",afterNote:"\u5143"}],
  "referenceNote":[{note:"\u60a8\u53ef\u4ee5\u8f93\u5165\u5bf9\u7a3f\u4ef6\u7ffb\u8bd1\u7684\u8981\u6c42\u6216\u8005\u6ce8\u610f\u4e8b\u9879,\u751a\u81f3\u662f\u4e0a\u4f20\u4e00\u6bb5\u53c2\u8003\u6587\u4ef6,\u4ee5\u4fbf\u83b7\u5f97\u66f4\u597d\u7684\u7ffb\u8bd1\u8d28\u91cf."},{note:"\u60a8\u53ef\u4ee5\u8f93\u5165\u5bf9\u7a3f\u4ef6\u7ffb\u8bd1\u7684\u8981\u6c42\u6216\u8005\u6ce8\u610f\u4e8b\u9879,\u751a\u81f3\u662f\u4e0a\u4f20\u4e00\u6bb5\u53c2\u8003\u6587\u4ef6,\u4ee5\u4fbf\u83b7\u5f97\u66f4\u597d\u7684\u7ffb\u8bd1\u8d28\u91cf."}]
}	
var wordsFlag=true;
var feeObj=0.0;
var commentFlag = false;
var init_price = 0.00;
var init_itemOfnum = 0;

$(document).ready(function(){
		$.initLanguage();	
		$.initSubjectRatio();
	  var langinput=$("#langinput");
	  var langinputOffset=langinput.offset();
	  var subject=$("#subjectinput");
	  var subjectOffset=subject.offset();
	  
	  var smallcontent = $("#content");
	  
	  smallcontent.click(function(){
		  $.textCounter();
	  }).change(function(){
		  $.textCounter();
	  }).keydown(function(){
		  $.textCounter();
	  }).keyup(function(){
		  $.textCounter();
	  })
	  $("#suiniyi_special_title").html("随你译的优势");
	  $("#suiniyi_special_content").html("<p>作为一家新型的大型专业翻译公司，随你译拥有中国首屈一指的翻译资源。通过3年的积累，已经拥有多达5万名专业注册译者，在全国排名第一。大量的高素质译者保证我们可以给您提供最熟悉您行业的专才译者队伍，并且通过我们卓有成效的管理体系使之高效运转，从而提供一个比同类公司在便捷、高质、价优、可信方面更为出色的翻译服务。因为随你译新型出色的质量管理体系和客户服务流程，我们得到包括新华社在内的大量媒体的报道，并且荣幸地成为中国翻译协会重要的合作伙伴。</p>");
		$("#search").click(function(){
					$("#alitransForm").attr("action","http://service.suiniyi.com/search.jsp")
					return true;
		})
	  langinput.click(function(){
		  $("#FieldDiv").css("visibility","hidden");
		  $("#LanguageDiv").css("visibility","visible").css("top",langinputOffset.top+langinput.height()+"px").css("left",langinputOffset.left+"px").width(langinput.width());
		})
		$("#Other_Language").attr("href","/html/special.html")
												.click(function(){
													 $("#LanguageDiv").css("visibility","hidden");
												});
		$.each(jsonArray["languagelist"][trans_lang],function(key,value){
				$("#"+key).click(function(){
					 langinput.val(value);
					 $("#source").val(key.substring(0,7));
					 $("#target").val(key.substring(11,18));
					 $("#LanguageDiv").css("visibility","hidden");
					 $.ajax({
						   type: "POST",
						   url: "/user/getparams.trans",
						   data: {method: "languageParam",source: key.substring(0,7), target: key.substring(11,18), token:new Date().getTime()},
						   success: function(json){
						    	$("#show_unit1").html(json.perhour);
						    	transObj.radio = json.radio;
						    	transObj.perhour = json.perhour;
						    	transObj.perprice = json.perprice;
						    	var isOk=true;
						    	$.each(transObj,function(obj,value){
						    		 if(value==0){
						    		 	  isOk = false;
						    		 		return false;
						    		 }
						    	})
						     if(isOk){
						     		$.transPrice();
						     	}
						   },
						  dataType:"json"
						}); 
					}).attr("href","javascript:void(0);");
								
		})
		subject.click(function(){
			$("#LanguageDiv").css("visibility","hidden");
			$("#FieldDiv").css("visibility","visible").css("top",subjectOffset.top+subject.height()+"px").css("left",subjectOffset.left+"px").width(subject.width());
		})
		$("#sourceLanguage").change(function(){
				 transLanguage.source=$(this).val();
				 if(transLanguage.source!='Chinese' && transLanguage.source!='PleaseChoose'){
					 $('#targetLanguage')[0].selectedIndex = 1;
					 transLanguage.target = 'Chinese';
					 if(trans_type == 1){
						 $.SmallInitPrice();
						 $.textCounter();
					 }
				 }else{
					 if(transLanguage.source==transLanguage.target){
						 transLanguage.target = '';
						 $('#targetLanguage')[0].selectedIndex = 0;
					 }
				 }
				 var isReady = true;
				 $.each(transLanguage,function(i,v){
					 if($.trim(v)==""||$.trim(v)=="PleaseChoose"){
						 isReady = false;
						 return false;
					 }
				 })
				 if(isReady){
					 $("#source").val(transLanguage.source);
					 $("#target").val(transLanguage.target);
					 $.ajax({
						   type: "POST",
						   url: "/user/getparams.trans",
						   data: {method: "languageParam",source: transLanguage.source, target: transLanguage.target, token:new Date().getTime()},
						   success: function(json){
						    	$("#show_unit1").html(json.perhour);
						    	transObj.radio = json.radio;
						    	transObj.perhour = json.perhour;
						    	transObj.perprice = json.perprice;
						    	var isOk=true;
						    	$.each(transObj,function(obj,value){
						    		 if(value==0){
						    		 	  isOk = false;
						    		 		return false;
						    		 }
						    	})
						    	if(isOk){
						    		$.transPrice();
							    }
						   },
						   dataType:"json"
					 }); 
				}
				 
		})
		$("#targetLanguage").change(function(){
				 transLanguage.target=$(this).val();
				 if(transLanguage.target!='Chinese'&& transLanguage.target!='PleaseChoose'){
				 			transLanguage.source = 'Chinese';
				 			$('#sourceLanguage')[0].selectedIndex = 1;
				 			if(trans_type == 1){
								 $.SmallInitPrice();
								 $.textCounter();
							}
				 }else{
				 		 if(transLanguage.target==transLanguage.source){
				 		 	  transLanguage.source = '';
				 		 		$('#sourceLanguage')[0].selectedIndex = 0;
				 		 }
				 }				 
				 var isReady = true;
				 $.each(transLanguage,function(i,v){
				 			//alert(v);
					 		if($.trim(v)==""||$.trim(v)=="PleaseChoose"){
					 				isReady = false;
					 				return false;	
					 		}
				 })	
				 	if(isReady){
						 $("#source").val(transLanguage.source);
						 $("#target").val(transLanguage.target);
						 $.ajax({
							   type: "POST",
							   url: "/user/getparams.trans",
							   data: {method: "languageParam",source: transLanguage.source, target: transLanguage.target, token:new Date().getTime()},
							   success: function(json){
							    	$("#show_unit1").html(json.perhour);
							    	transObj.radio = json.radio;
							    	transObj.perhour = json.perhour;
							    	transObj.perprice = json.perprice;
							    	var isOk=true;
							    	$.each(transObj,function(obj,value){
							    		 if(value==0){
							    		 	  isOk = false;
							    		 		return false;
							    		 }
							    	})
							     if(isOk){
							     		$.transPrice();
							     	}
							   },
							  dataType:"json"
							}); 
					}				 	
		})
		$.each([0,1],function(key,value){
				$("#tb_close_"+key).click(function(){
				$("#FieldDiv").css("visibility","hidden");
				$("#LanguageDiv").css("visibility","hidden");		
			}).attr("href","javascript:void(0);");
		})		
			
		$.each(jsonArray["fieldlist"][trans_lang],function(key,value){
			$("#"+key).click(function(){
				//alert(value);
		 	  $("#subjectinput").val(value);
		 	  $("#subject").val(key);
				$("#show_contenttype").html(value);
				$("#show_contenttype1").html(value);
		 	  $("#contentType").val(key);
		 	  $("#FieldDiv").css("visibility","hidden");
 	  		$.ajax({
				   type: "POST",
				   url: "/user/getparams.trans",
				   data: {method: "subjectParam",subject:key, token:new Date().getTime()},
				   success: function(json){
				   		$showTranslatorNums();
				   		$showSubjectNums();
				    	transObj.subject_ratio = json.subject;
				    	var isOk = true;
				    	$.each(transObj,function(obj,value){
				    		 if(value==0){
				    		 	  isOk = false;
				    		 		return isOk;
				    		 }
				    	})
				     if(isOk){
				     		$.transPrice();
							}						    	
				   },
				  dataType:"json"
				}); 
			}).attr("href","javascript:void(0);");
		})
		//$.tabs("container");
		$("#filetype0").click(function(){
			
			if($("#source").val()=="" && $("#target").val()==""){
				$.languagePrice();
				if($("#source").val()=="" && $("#target").val()==""){
					alert(jsonArray["alertObj"][trans_lang].language);
					$("#filetype3").checked = true;
					document.getElementById("filetype3").style.checked=true;
				  	return false;	
				}
			}
			if($("#contentType").val()==""&& $("#subject").val()==""){
				alert(jsonArray["alertObj"][trans_lang].fieldtype);
				$("#filetype3").checked = true;
				document.getElementById("filetype3").style.checked=true;
			  	return false;
			}
			
				$("#tr_0").show();
				$("#tr_1").hide();
				$("#tr_2").hide();
				$("#tr_3").hide();	
				$("#tr_4").hide();
				$("#tr_5").hide();
				$("#tr_6").show();		
				$("#p_show_numoffile").hide();	
				$("#p_show_level").hide();	
				$("#p_show_note").hide();	
				
				$.SmallInitPrice();
				trans_type = 1;
				
		})
		$("#filetype1").click(function(){
			
			
			if(transLanguage.source=="" && transLanguage.target==""){
				$.Languageprice();
				if(transLanguage.source=="" && transLanguage.target==""){
					alert(jsonArray["alertObj"][trans_lang].language);
					$("#filetype3").checked = true;
					document.getElementById("filetype3").style.checked=true;
				  	return false;	
				}
			}
			
			if($("#contentType").val()==""&& $("#subject").val()==""){
				alert(jsonArray["alertObj"][trans_lang].fieldtype);
				$("#filetype3").checked = true;
				document.getElementById("filetype3").style.checked=true;
			  	return false;
			}
				$("#p_show_numoffile").show();
				$("#p_show_level").show();		
				$("#tr_0").hide();
				$([1,2,3,4,5,6]).each(function(i){
					  i++;
					  	$("#tr_"+i).show();
				})
			trans_type = 0;

		})
		$("#reference").click(function(){
			//alert($("#filetype3").val());
			if($("#source").val()=="" && $("#target").val()==""){
				alert(jsonArray["alertObj"][trans_lang].nothingHappend);
			  	return false;	
			}
			if($("#contentType").val()==""&& $("#subject").val()==""){
				alert(jsonArray["alertObj"][trans_lang].nothingHappend);
			  	return false;
			}
			 $.each([0,1,2],function(index){
			 		 $("#referenceFile_"+index).toggle();
			 	})	
		})
		$("#filewords").keyup(function(event){
			$("#transsubmit").attr("disabled","true");
			var myEvent = event || window.event;
			var keyCode = myEvent.keyCode;
			//alert(keyCode);
			if(keyCode>=48&&keyCode<=57 ||keyCode==8 || keyCode==46 || keyCode>=37&&keyCode<=40){
				
			if(transObj.perhour==0){
				alert(jsonArray["alertObj"][trans_lang].language);	
				return false;
			}
			$("#show_numofwords").html($(this).val());
			transObj.words=$(this).val();
			var isOk = true;
 	  		
		    if(isOk){
		     	$.transPrice();
			}
			return true;
			}
		}).change(function(){
				$("#transsubmit").attr("disabled","true");
				$("#show_numofwords").html($(this).val());
				transObj.words=$(this).val();
				var isOk = true;
 	  		$.ajax({
				   type: "POST",
				   url: "/user/getparams.trans",
				   data: {method: "systemHoursParam",words:transObj.words,perhour:transObj.perhour, token:new Date().getTime()},
				   success: function(json){
							$("#show_posttime").html(json.date);
							$("#show_hour").html(json.hour);
							$("#dateString").val(json.date);
							$("#timeLimit").val(json.date+" "+json.hour);
							$('#timeLimithour')[0].selectedIndex = (json.hour).substring(0,3);
							transObj.hours = json.hours;
							
				    	dateTime.date = json.date;
				    	dateTime.hour = json.hour;
   	
				    	var isOk = true;
				    	$.each(transObj,function(obj,value){
				    		 if(value==0){
				    		 	  isOk = false;
				    		 		return isOk;
				    		 }
				    	})
				     if(isOk){
				     		$.transPrice();
							}						    	
				   },
				  dataType:"json"
				}); 				
	    	$.each(transObj,function(obj,value){
		    		 if(value==0){
		    		 		isOk = false;
								return false;
		    		 }
		    	})
		     if(isOk){
		     	$.transPrice();
				 	}										
				
		})
		$("#examine").click(function(){
			 if($(this).val()==0){
			 			$(this).val(1);
			 			transLevel.level = 1;
			 		  $("#show_level").html(jsonArray["transLevelObj"][trans_lang].expert);
			 }else{
			 			$(this).val(0);
			 			transLevel.level = 0;
			 			$("#show_level").html(jsonArray["transLevelObj"][trans_lang].standard);
			 }
			 var isOk = true;
		   $.each(transObj,function(obj,value){
	    		 if(value==0){
	    		 		isOk = false;
							return false;
	    		 }
	    	})
	     if(isOk){
	     	$.transPrice();
	     	if(transLevel.level==1){
		   		feeObj=feeObj*2  ;
				}else if(transLevel.level==0){
					feeObj=feeObj/2  ;
				}
				if(wordsFlag){
					$("#show_unit2").html(jsonArray["priceNoteObj"][trans_lang].preNote+feeObj+jsonArray["priceNoteObj"][trans_lang].afterNote); 	
				}else{
					$("#show_unit2").html(jsonArray["alertObj"][trans_lang].priceWait);
				}		
				$("#quoteMoney").val(feeObj); 
				feeObj = feeObj;
			 	}		
		})
		$("#anchordateString").click(function(){
				caldateString.select(document.alitransForm.dateString,'anchordateString','yyyy-MM-dd'); 
				//alert("transObj.hours:"+transObj.hours+"   date:"+$("#dateString").val()+" "+$("#timeLimithour").val()+":00:00");
				return false
		})
		
		
		$("#timeLimithour").change(function(){
			  var timeLimithour=$("select[@name=timeLimithour] option[@selected]").text();
				dateTime.hour = timeLimithour+":00:00";
				$("#show_hour").html(dateTime.hour);
				$.SetupPrice();
				//$.getHours();
				
		})
		
		$("#appendFile").attr("href","javascript:void(0);").click(function(){
			if(file_index>=5) return false;
			
			var isfile=$("#projectFile"+file_index).val();
			if(!isfile){
					alert(jsonArray["alertObj"][trans_lang].file);
					return false;	
			}
			
			$("#show_numoffile").html(file_index);
			$("#show_note").html(file_index);
			file_index++;			
			var fileUpLoadbutton = document.createElement("input"); 
		    fileUpLoadbutton.setAttribute("type","file");
		    fileUpLoadbutton.setAttribute("name","projectFile"+file_index);
		    fileUpLoadbutton.setAttribute("id","projectFile"+file_index);
		    fileUpLoadbutton.setAttribute("onchange","javascript:$.addFileNum();");
			
			$("#hrefchiose").append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='file' id='projectFile"+file_index+"' onchange='javascript:$.addFileNum();' name='projectFile"+file_index+"' /><a id='delFile"+file_index+"' href='javascript:void(0);' onclick='javascript:$.delFile("+file_index+")'>\u5220\u9664</a>").append("<br id='br"+file_index+"'/>");
		   // document.getElementById("hrefchiose").appendChild(fileUpLoadbutton).appendChild("<a id='delFile"+file_index+"' href='javascript:void(0);' onclick='javascript:$.delFile("+file_index+")'>\u5220\u9664</a>").appendChild("<br id='br"+file_index+"'/>");
			//alert($("#hrefchiose").html());
		})
		$("#projectFile1").change(function(){
				if(hasfile==0){
						$("#show_numoffile").html(file_index);
						$("#show_note").html(file_index);
				}
				hasfile = 1;
		})
		
		$("#projectRequire").blur(function(){
			if($(this).val()==""){
				$(this).val($(this).defaultValue);
			}
		}).click(function(){
					return $.Setempty();
			})
		
		
		
		$("#transsubmit").click(function(){
			 var contactPhone = $("#contactPhone").val();
		 		if($("#source").val()=="" && $("#target").val()==""){
				  	alert(jsonArray["alertObj"][trans_lang].language);
				  	return false;	
			  }
			  if($("#contentType").val()==""&& $("#subject").val()==""){
			  	  alert(jsonArray["alertObj"][trans_lang].fieldtype);
			  		return false;
			  }
			  if($("#contactPhone").val()==""){
			  	  alert(jsonArray["alertObj"][trans_lang].contactPhone1);
			  		return false;
			  }
		  	  var item = $('input[@name=filetype][@checked]').val();
					if(item==undefined){
						alert(jsonArray["alertObj"][trans_lang].filetype);
						return false;	
				}
				//alert("item="+item);
				if(item==0){
					  // alert($("#content").val());
					  if($("#content").val()==""){
					  		alert(jsonArray["alertObj"][trans_lang].smallContent);	
					  		return false;
					  }
					 // alert($("#numOfword").val());
					  if($("#numOfword").val()==0){
					  	alert(jsonArray["alertObj"][trans_lang].languageNotice);	
					  	return false;
					  }
						var str =  /^[^*.&@#$%^!~`{}?<>,:+=\/]+$/;
						//alert($("#contactPhone").val());
						if(!str.test($("#contactPhone").val())){
							 alert(jsonArray["alertObj"][trans_lang].contactPhone2); 
			          		return false;
						}
						for(i=0;i<$("#contactPhone").val().length;i++)
						if ($("#contactPhone").val().length < 6)   
						    {   
						        alert(jsonArray["alertObj"][trans_lang].contactPhone3);    
					         	return false;   
						    }   
					    if ($("#contactPhone").val().length > 20 )   
					    {   
					        alert(jsonArray["alertObj"][trans_lang].contactPhone4);    
				         	return false;   
					    }   
					 // if (!$.isMobile(contactPhone)&&!$.isTel(contactPhone))  {  
			          //  contactPhone.value = $.trim(contactPhone); 
			           // alert(jsonArray["alertObj"][trans_lang].contactPhone2); 
			          //  return false;  
				      //  }  
				     // alert($("#comment").val());
					  if(commentFlag){
					  	 $("#comment").val($("#projectRequire").val());
					  }else{
					  	 $("#comment").val("");
					  }
					 // alert("++++++++++++++"+Loading(jsonArray["transNote"][trans_lang].smalltrans));
					 Loading(jsonArray["transNote"][trans_lang].smalltrans);	
						$("#alitransForm").attr("action","/user/smallTrans.trans");
						$("#method").val("save");
						
				}else if(item==1){
						if(wordsFlag){
								if($("#filewords").val()==""){
									 alert(jsonArray["alertObj"][trans_lang].num);
									 return false;	
								}
						}
						
							var str =  /^[^*.&@#$%^!~`{}?<>,:+=\/]+$/;
						
						if(!str.test($("#contactPhone").val())){
							 alert(jsonArray["alertObj"][trans_lang].contactPhone2); 
			          		return false;
						}
						for(i=0;i<$("#contactPhone").val().length;i++)
						if ($("#contactPhone").val().length < 6)   
						    {   
						        alert(jsonArray["alertObj"][trans_lang].contactPhone3);    
					         	return false;   
						    }   
					    if ($("#contactPhone").val().length > 20 )   
					    {   
					         alert(jsonArray["alertObj"][trans_lang].contactPhone4);   
				         	return false;   
					    }   
				      
					  if(!commentFlag){
					  	 $("#projectRequire").val("");
					  }
						if($("#projectFile1").val()==""){
							alert(jsonArray["alertObj"][trans_lang].isfile);
							return false;	
						}
						if($("#dateString").val()=="yyyy/mm/dd"||$("#dateString").val()==""){
							 alert(jsonArray["alertObj"][trans_lang].transTime);
							 return false;	
						}						
						var nowDate= new Date();
						nowDate.setTime(nowDate.getTime()+22*3600*1000);
						var timeLimithour=$("select[@name=timeLimithour] option[@selected]").text();
						var fileDateStr =$("#dateString").val()+" "+timeLimithour+":00:00";
						var fileDate = new Date(fileDateStr.replace(/\-/g,"\/"));
						//alert(nowDate);
						//alert(fileDate);
						//alert(nowDate>fileDate);
						if(nowDate>fileDate){
							 alert(jsonArray["alertObj"][trans_lang].morehour);
								return false;
						}
						
						Loading(jsonArray["transNote"][trans_lang].bigtrans);	
						$("#alitransForm").attr("action","/user/alitrans.trans");
						if(wordsFlag){
							  $("#numOfword").val($("#filewords").val());
								$("#method").val("transPost");
						}else{
								$("#method").val("save");
						}
						
				}else{
					alert(jsonArray["alertObj"][trans_lang].filetype);
					return false;
				}
				
				return true;
		})
		
		
		
})

Date.prototype.format = function(format){
	var o = {
	"M+" : this.getMonth()+1, //month
	"d+" : this.getDate(),    //day
	"h+" : this.getHours(),   //hour
	"m+" : this.getMinutes(), //minute
	"s+" : this.getSeconds(), //second
	"q+" : Math.floor((this.getMonth()+3)/3),  //quarter
	"S" : this.getMilliseconds() //millisecond
}
if(/(y+)/.test(format)) format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));
for(var k in o)
	if(new RegExp("("+ k +")").test(format))
	format = format.replace(RegExp.$1,RegExp.$1.length==1 ? o[k] :
("00"+ o[k]).substr((""+ o[k]).length));
return format;
}

$.Setempty = function(){
	//alert(commentFlag);
	if($("#projectRequire").val()==jsonArray["alertObj"][trans_lang].commentNote)
	  $("#projectRequire").val("").focus();
	  commentFlag = true;
}
$.addFileNum = function(){
	$("#show_numoffile").html(file_index);
	$("#show_note").html(file_index);
}

$.delFile = function(index){
	$("#projectFile"+index).remove();
	$("#delFile"+index).remove();
	$("#br"+index).remove();
	file_index--;
	$("#show_numoffile").html(file_index);
	$("#show_note").html(file_index);
}
$.getHours = function(){
		var isTime = true;
		$.each(dateTime,function(i,v){
			//alert(v);
			if($.trim(v)==""){
				isTime = false;
				return false;	
			}
		})	
		if(isTime){
				$("#timeLimit").val(dateTime.date+" "+dateTime.hour);
				//alert($("#timeLimit").val());
				if(transObj.perhour!=0 && transObj.words!=0){
	 	  		$.ajax({
					   type: "POST",
					   url: "/user/getparams.trans",
					   data: {method: "customeHoursParam",datetime:encodeURI(dateTime.date+" "+dateTime.hour),radio:transObj.radio,perhour:transObj.perhour,perprice:transObj.perprice,hours:transObj.hours,subject_ratio:transObj.subject_ratio,words:transObj.words,token:new Date().getTime()},
					   success: function(json){
					   	  //alert(json.hours);
					    	transObj.hours= json.hours;
					    	var isOk = true;
					    	$.each(transObj,function(obj,value){
					    		 if(value==0){
					    		 	  isOk = false;
					    		 		return isOk;
					    		 }
					    	})
					     if(isOk){
							    //\u8ba1\u7b97\u5927\u5355\u7684\u4ef7\u683c
							    $.transPrice();
							 	}						    	
					   },
					  dataType:"json"
					}); 							
				}							
		}
}

$.SetupPrice = function(){

	if(!wordsFlag){
		return;
	}
	//alert($("#dateString").val()+","+$("#timeLimithour").val());
	$.ajax({
	   type: "POST",
	   url: "/user/getparams.trans",
	   data: {method: "SetupTimeParam",datetime:encodeURI($("#dateString").val()+" "+$("#timeLimithour").val()+":00:00"),radio:transObj.radio,perhour:transObj.perhour,perprice:transObj.perprice,hours:transObj.hours,subject_ratio:transObj.subject_ratio,words:transObj.words,examine:transLevel.level,token:new Date().getTime()},
	   success: function(json){
	   		//alert(json.date+","+json.hour);
				$("#show_posttime").html(json.date);
				$("#show_hour").html(json.hour+":00:00");
				$("#dateString").val(json.date);
				$("#timeLimit").val(json.date+" "+json.hour);
				$('#timeLimithour')[0].selectedIndex = (json.hour).substring(0,3);
				$("#quoteMoney").val(json.money); 
				$("#show_unit2").html(jsonArray["priceNoteObj"][trans_lang].preNote+json.money+jsonArray["priceNoteObj"][trans_lang].afterNote); 
				//transObj.hours = json.hour;
				$("#transsubmit").attr("disabled","");
				feeObj = json.money;
	    	//dateTime.date = $("#dateString").val();
	    	//dateTime.hour = $("#timeLimithour").val()+":00:00";				
	    	dateTime.date = json.date;
	    	dateTime.hour = json.hour;
				    	
	   },
	  dataType:"json"
	});
	return;
}
$.initSubjectRatio = function(){
			$.getJSON("http://order.suiniyi.com/user/getparams2.trans?callback=?",
 	  		
				   {method: "subjectParam",subject:$("#contentType").val(), token:new Date().getTime()},
				    function(json){
				    	transObj.subject_ratio = json.subject;				    	
				   }); 
	
}
$.SmallInitPrice = function () {
	transLanguage.source=$("#sourceLanguage").val();
	transLanguage.target=$("#targetLanguage").val();
	$.ajax({
		   type: "POST",
		   url: "/user/getparams.trans",
		   data: {method: "SmallInitParam",source:transLanguage.source, target:transLanguage.target, C:"0", M:"getInitvar", U:$("#subject").val()},
		   success: function(json){
			   init_price = json.Price;
			   init_itemOfnum = json.itemNum;
		   },
		   dataType:"json"
	});
	return;
}

$.CheckSmallInitPrice = function () {
	transLanguage.source=$("#source").val();
	transLanguage.target=$("#target").val();
	$.ajax({
		   type: "POST",
		   url: "/user/getparams.trans",
		   data: {method: "SmallInitParam",source:transLanguage.source, target:transLanguage.target, C:"0", M:"getInitvar", U:$("#contentType").val()},
		   success: function(json){
		   	//alert(json.Price+','+json.itemNum);
			   init_price = json.Price;
			   init_itemOfnum = json.itemNum;
		   },
		   dataType:"json"
	});
	return;
}

$.textCounter = function () {
	
	trans_type = 1;
	var strTemp = "";
	var reg = "";
	var osel1 = $("#sourceLanguage").val();
	ajax_type =1;
	if(osel1=='Chinese'){
		reg=/[\u4e00-\u9fa5]/g;
	}else if(osel1!='Japanese'&& osel1!='Korea' && osel1!='Chinese'){
		reg=/[\S　]+/g;
	}else if(osel1=='Japanese'){
		//reg=/[\u0800-\u4e00]/g;
		reg=/[\u4e00-\u9fa5 | \u3041-\u312f]/g
	}else if(osel1=='Korea'){
		//reg=/[\u0800-\u4e00]/g;
		reg=/[\uac00-\ud7a3]/g
	}//else{
		//reg=/[(.|,|"|?|!|:)]/;
		//reg = "~!@#$%^&*()_+|`-=\{}[]:\";\<>?,./";
	//}
	
	var strCharCounter0 = 0;
	if($("#content").val().length>0){
		var str=$("#content").val();
		strCharCounter0=$.getlength(str.match(reg));
	}else{
		strCharCounter0=0;
	}
	
	var strCharCounter1 = 0;
	var increase = parseInt(strCharCounter0*0.02);
	strCharCounter1 = strCharCounter0 + increase;
	//alert("strCharCounter0="+strCharCounter0+"    strCharCounter1="+strCharCounter1);
	
	if(init_itemOfnum==0 || init_price==0.00){
		$.SmallInitPrice();
	}
	
	//alert("strCharCounter0="+strCharCounter0+"   init_itemOfnum="+init_itemOfnum+"   init_price="+init_price);
	$("#numOfword").val(strCharCounter1);
	
	var numitem = 0;
	
	if(strCharCounter1!=0 && init_itemOfnum!=0 && strCharCounter1%init_itemOfnum == 0){
		try{
			numitem = strCharCounter1/init_itemOfnum;
		}catch(e){
			numitem = 0;
		}
		//alert("1"+numitem);
	} else {
		try{
			if(strCharCounter1!=0 && init_itemOfnum!=0){
				numitem = strCharCounter1/init_itemOfnum + 1;
				numitem = numitem.toString().split(".")[0];
			}else{
				numitem = 0;
			}
		}catch(e){
			numitem = 0;
		}
		//alert("2"+numitem);
	}
	
	if(strCharCounter1 >= 800){
		ratio = 0.9;
	}else{
		ratio = 1;
	}
	
	
	//$("#numofitem").val(numitem);
	//alert(numitem*init_price*ratio);
	var allPrice = numitem*init_price*ratio*transObj.subject_ratio;
	//alert("allPrice:"+allPrice);
	$("#allPrice").html(allPrice.toFixed(2));
	$("#money").val(allPrice.toFixed(2));
	
	var dd = new Date();
	var bb;
	bb = $.isWork(dd);
	//alert(bb);
	if(numitem<=0) numitem=1;
  	var dd1 = bb.dateAfterDays(numitem*60);
	//var dd2 = DateUtil.dateAfterMins(numitem*30);
  	var dd3 = DateUtil.Format("yyyy/MM/dd hh:mm:00",dd1);
  	
  	$("#quoteTime").html(dd3);
	//document.getElementById("show_posttime").innerHTML= dd3;
  	return;
}
$.checkTextCounter = function () {
	if(transObj.subject_ratio==0){
		$.initSubjectRatio();
	}else{
   	if(init_itemOfnum==0 || init_price==0.00){
  		$.CheckSmallInitPrice();
    }else{
		 	trans_type = 1;
			var strTemp = "";
			var reg = "";
			var osel1 = $("#source").val();
			ajax_type =1;
			if(osel1=='Chinese'){
				reg=/[\u4e00-\u9fa5]/g;
			}else if(osel1!='Japanese'&& osel1!='Korea' && osel1!='Chinese'){
				reg=/[\S　]+/g;
			}else if(osel1=='Japanese'){
				//reg=/[\u0800-\u4e00]/g;
				reg=/[\u4e00-\u9fa5 | \u3041-\u312f]/g
			}else if(osel1=='Korea'){
				//reg=/[\u0800-\u4e00]/g;
				reg=/[\uac00-\ud7a3]/g
			}//else{
				//reg=/[(.|,|"|?|!|:)]/;
				//reg = "~!@#$%^&*()_+|`-=\{}[]:\";\<>?,./";
			//}
			
			var strCharCounter0 = 0;
			if($("#content1").val().length>0){
				var str=$("#content1").val();
				strCharCounter0=$.getlength(str.match(reg));
			}else{
				strCharCounter0=0;
			}
			var strCharCounter1 = 0;
			var increase = parseInt(strCharCounter0);
			strCharCounter1 = strCharCounter0 + increase;
			alert("strCharCounter0="+strCharCounter0+"    strCharCounter1="+strCharCounter1);
			//alert(strCharCounter0);
		//	if(init_itemOfnum==0 || init_price==0.00){
		//		$.CheckSmallInitPrice();
		// }
			
			//alert("strCharCounter0="+strCharCounter0+"   init_itemOfnum="+init_itemOfnum+"   init_price="+init_price);
			$("#numOfword").val(strCharCounter0);
			
			var numitem = 0;
			
			if(strCharCounter0!=0 && init_itemOfnum!=0 && strCharCounter0%init_itemOfnum == 0){
				try{
					numitem = strCharCounter0/init_itemOfnum;
				}catch(e){
					numitem = 0;
				}
				//alert("1"+numitem);
			} else {
				try{
					if(strCharCounter0!=0 && init_itemOfnum!=0){
						numitem = strCharCounter0/init_itemOfnum + 1;
						numitem = numitem.toString().split(".")[0];
					}else{
						numitem = 0;
					}
				}catch(e){
					numitem = 0;
				}
				//alert("2"+numitem);
			}
			
			if(strCharCounter0 >= 800){
				ratio = 0.9;
			}else{
				ratio = 1;
			}
			
			
			$("#numofitem").val(numitem);
			//alert(numitem*init_price*ratio);
			//alert(numitem);
			//alert(init_price);
			//alert(ratio);
			//alert(transObj.subject_ratio);
			var allPrice = numitem*init_price*ratio*transObj.subject_ratio;
			//alert("allPrice:"+allPrice);
			$("#allPrice").html(allPrice.toFixed(2));
			$("#money").val(allPrice.toFixed(2));
			
			var dd = new Date();
			var bb;
			bb = $.isWork(dd);
			//alert(bb);
			if(numitem<=0) numitem=1;
		  	var dd1 = bb.dateAfterDays(numitem*60);
			//var dd2 = DateUtil.dateAfterMins(numitem*30);
		  	var dd3 = DateUtil.Format("yyyy/MM/dd hh:mm:00",dd1);
		  	
		  //$("#quoteTime").html(dd3);
			//document.getElementById("show_posttime").innerHTML= dd3;
		  	return;   		
    }
	}
}
$.languagePrice = function(){
	transLanguage.source=$("#sourceLanguage").val();
	transLanguage.target=$("#targetLanguage").val();
	//alert("source:"+transLanguage.source+" target:"+ transLanguage.target);
	if(transLanguage.source=='' || transLanguage.target=='' || transLanguage.source=='PleaseChoose' || transLanguage.target=='PleaseChoose' ){
		$('#sourceLanguage')[0].selectedIndex = 0;
		$('#targetLanguage')[0].selectedIndex = 0;
		//alert(jsonArray["alertObj"][trans_lang].language);
		return false;
	}else if(transLanguage.target==transLanguage.source){
		$('#sourceLanguage')[0].selectedIndex = 0;
		$('#targetLanguage')[0].selectedIndex = 0;
		//alert(language["translate"][lang][0]);
		return false;
	}else if(transLanguage.source=='Chinese' || transLanguage.target=='Chinese'){
		var isReady = true;
		/*
		$.each(transLanguage,function(i,v){
			if($.trim(v)==""||$.trim(v)=="PleaseChoose"){
				isReady = false;
				return false;
			}
		})	
		*/
		if(isReady){
			$("#source").val(transLanguage.source);
			$("#target").val(transLanguage.target);
			$.ajax({
				type: "POST",
				url: "/user/getparams.trans",
				data: {method: "languageParam",source: transLanguage.source, target: transLanguage.target, token:new Date().getTime()},
				success: function(json){
					$("#show_unit1").html(json.perhour);
					transObj.radio = json.radio;
					transObj.perhour = json.perhour;
					transObj.perprice = json.perprice;
					/*
					var isOk=true;
					$.each(transObj,function(obj,value){
						if(value==0){
							isOk = false;
							return false;
						}
					})
					*/
					return true;
					//if(isOk){
					//	$.transPrice();
					//}
				},
				dataType:"json"
			}); 
		}
	}else{
		$('#sourceLanguage')[0].selectedIndex = 0;
		$('#targetLanguage')[0].selectedIndex = 0;
		//alert(language["translate"][lang][1]);
		return false;
	}	
}

$.transPrice = function(){
	//$.each(transObj,function(i,v){
	//	alert(v);
	//})
	if(transObj.words < 800){
		if(init_itemOfnum==0 || init_price==0.00){
			$.SmallInitPrice();
		}
	}
	
	try{  
	 	$.ajax({
		type: "POST",
		url: "/user/getparams.trans",
		data: {method: "priceParam",radio:transObj.radio,perhour:transObj.perhour,perprice:transObj.perprice,hours:transObj.hours,subject_ratio:transObj.subject_ratio,words:transObj.words,token:new Date().getTime(),init_itemOfnum:init_itemOfnum, init_price:init_price,examine:transLevel.level, M:"getInitvar",source:transLanguage.source, target:transLanguage.target, U:$("#subject").val()},
		success: function(json){
		  		var money = json.money;
				if(transLevel.level==1){
					money=money*2  ;
				}
				$("#show_unit2").html(jsonArray["priceNoteObj"][trans_lang].preNote+money+jsonArray["priceNoteObj"][trans_lang].afterNote); 	
				$("#quoteMoney").val(money); 
				//alert($("#quoteMoney").val());
				$("#transsubmit").attr("disabled","");
				feeObj = money;
						
				$("#show_posttime").html(json.date);
				$("#show_hour").html(json.hour);
				$("#dateString").val(json.date);
				$("#timeLimit").val(json.date+" "+json.hour);
				$('#timeLimithour')[0].selectedIndex = (json.hour).substring(0,3);
				transObj.hours = json.hours;
							
				dateTime.date = json.date;
				dateTime.hour = json.hour;
		},
		dataType:"json"
		}); 					
	}catch(err){  
	  alert(err.description);
	  money=0;  
	}  
}

$showTranslatorNums = function() {
	try{  
		//alert($("#subject").val());
	 	$.ajax({
		type: "POST",
		url: "/user/getparams.trans",
		data: {method: "showTranslatorNums",source: transLanguage.source, target: transLanguage.target, U:$("#subject").val()},
		success: function(json){
			//alert(json.translatorNums);
			if(json.translatorNums > 0){
				$("#transLatorNums_div").show();
				$("#transLatorNums_div").css("visibility","visible")
				$("#transLatorNums").html(json.translatorNums);
			}else{
				$("#transLatorNums_div").hide();
				$("#transLatorNums_div").css("visibility","visible")
				$("#transLatorNums").html(0);
			}
		},
		dataType:"json"
		}); 					
	}catch(err){  
	  alert(err.description);
	  money=0;  
	}
}

$showSubjectNums = function() {
	try{  
		
	 	$.ajax({
		type: "POST",
		url: "/user/getparams.trans",
		data: {method: "showSubjectNums", U:$("#subject").val()},
		success: function(json){
			//alert(json.subjectNums);
			if(json.subjectNums > 0){
				$("#subjectNums_div").show();
				$("#subjectNums_div").css("visibility","visible")
				$("#subjectNums").html(json.subjectNums);
			}else{
		
				$("#subjectNums_div").hide();
				$("#subjectNums_div").css("visibility","visible")
				$("#subjectNums").html(0);
			}
		},
		dataType:"json"
		}); 					
	}catch(err){  
	  alert(err.description);
	  money=0;  
	}
}


$xiaoyuzhong_submit = function() {
			 var contactPhone = $("#contactPhone").val();
		 		if($("#source").val()=="" && $("#target").val()==""){
				  	alert(jsonArray["alertObj"][trans_lang].language);
				  	return false;	
			  }
			  if($("#contentType").val()==""&& $("#subject").val()==""){
			  	  alert(jsonArray["alertObj"][trans_lang].fieldtype);
			  		return false;
			  }
			  if($("#contactPhone").val()==""){
			  	  alert(jsonArray["alertObj"][trans_lang].contactPhone1);
			  		return false;
			  }
		  	  
			if(wordsFlag){
				if($("#filewords").val()==""){
				 	alert(jsonArray["alertObj"][trans_lang].num);
					return false;	
				}
			}
						
			var str =  /^[^*.&@#$%^!~`{}?<>,:+=\/]+$/;
						
			if(!str.test($("#contactPhone").val())){
				 alert(jsonArray["alertObj"][trans_lang].contactPhone2); 
			 	return false;
			}
						for(i=0;i<$("#contactPhone").val().length;i++)
						if ($("#contactPhone").val().length < 6)   
						    {   
						        alert(jsonArray["alertObj"][trans_lang].contactPhone3);    
					         	return false;   
						    }   
					    if ($("#contactPhone").val().length > 20 )   
					    {   
					         alert(jsonArray["alertObj"][trans_lang].contactPhone4);   
				         	return false;   
					    }   
				      
					  if(!commentFlag){
					  	 $("#projectRequire").val("");
					  }
						if($("#projectFile1").val()==""){
							alert(jsonArray["alertObj"][trans_lang].isfile);
							return false;	
						}
						if($("#dateString").val()=="yyyy/mm/dd"||$("#dateString").val()==""){
							 alert(jsonArray["alertObj"][trans_lang].transTime);
							 return false;	
						}						
						var nowDate= new Date();
						nowDate.setTime(nowDate.getTime()+22*3600*1000);
						var timeLimithour=$("select[@name=timeLimithour] option[@selected]").text();
						var fileDateStr =$("#dateString").val()+" "+timeLimithour+":00:00";
						var fileDate = new Date(fileDateStr.replace(/\-/g,"\/"));

						if(nowDate>fileDate){
							 alert(jsonArray["alertObj"][trans_lang].morehour);
							return false;
						}
						
						Loading(jsonArray["transNote"][trans_lang].bigtrans);	
						
				return true;
}
$.initLanguage = function(){
	 transLanguage.source = $("#source").val();
	 transLanguage.target = $("#target").val();
	// alert(transLanguage.source+""+transLanguage.target);
	 //alert(transLanguage.source+","+transLanguage.target);
	 $.getJSON("http://order.suiniyi.com/user/getparams2.trans?callback=?",
	
		    {method: "languageParam",source: transLanguage.source, target: transLanguage.target, token:new Date().getTime()},
		    function(json){
		    	//alert(json.radio);
		    	transObj.radio = json.radio;
		    	transObj.perhour = json.perhour;
		    	transObj.perprice = json.perprice;
		    	var isOk=true;
		    	$.each(transObj,function(obj,value){
		    		 if(value==0){
		    		 	  isOk = false;
		    		 		return false;
		    		 }
		    	})
		    	//alert(isOk);
		    	if(isOk){
		    		$.transPrice();
			    }
		   }); 
}
$.Yetii= function() {

	this.defaults = {
		id: null,
		active: 1,
		timeout: null,
		interval: null,
		tabclass: 'tab_1',
		activeclass: 'active'
	};
	
	for (var n in arguments[0]) { this.defaults[n]=arguments[0][n]; };	

	this.getTabs = function() {
        var retnode = [];
        var elem = document.getElementById(this.defaults.id).getElementsByTagName('*');
				var regexp = new RegExp("(^|\\s)" + this.defaults.tabclass.replace(/\-/g, "\\-") + "(\\s|$)");
        for (var i = 0; i < elem.length; i++) {
        	 //alert(elem[i].value);
     		   if (regexp.test(elem[i].className)) retnode.push(elem[i]);
        }
        return retnode;
    };
	this.links = document.getElementById(this.defaults.id + '-nav').getElementsByTagName('a');
	this.show = function(number){
				wordsFlag = number == 1?true:false;
        for (var i = 0; i < this.tabs.length; i++) {
	        this.tabs[i].style.display = ((i+1)==number) ? 'block' : 'none';
	        this.links[i].className = ((i+1)==number) ? this.defaults.activeclass : '';
        }
    
    };
	this.rotate = function(interval){

        this.show(this.defaults.active);
        this.defaults.active++;
        if(this.defaults.active > this.tabs.length) this.defaults.active = 1;
        var self = this;
        this.defaults.timeout = setTimeout(function(){self.rotate(interval);}, interval*1000);
    
    };
	this.tabs = this.getTabs();
	this.show(this.defaults.active);
	var self = this;
	for (var i = 0; i < this.links.length; i++) {
		this.links[i].customindex = i+1;
		this.links[i].onclick = function(){ if (self.defaults.timeout) clearTimeout(self.defaults.timeout); self.show(this.customindex); return false; };
  }
	if (this.defaults.interval) this.rotate(this.defaults.interval);
	
}
$.isWork = function(datatime)  {

	  var   year=datatime.getFullYear();  
	  var   month=datatime.getMonth();  
	  var   date=datatime.getDate();  
	  var   hour=datatime.getHours();  
	  var new_hour = 0;
	  var new_date = 0;
	  var new_year = 2008;
	  var new_month= 0;
	  var new_min = 0;
	  
	  /*
	  if(datatime.getDay()==6)  
	  {  
		var uom = new Date(new Date()-0+86400000*2); 
	  	new_date = uom.getDate();
	  	new_hour = 9;
	  	new_year = uom.getFullYear();
	  	new_month = uom.getMonth();
	  	new_min = 0;
	  	var xc = new Date(new_year,new_month,new_date,new_hour,new_min,0,0);
	  	return xc;
  	  }  
	  if(datatime.getDay()==0)  
	  {  
	  	var uom = new Date(new Date()-0+86400000); 
	  	new_date = uom.getDate();
	  	new_hour = 9;
	  	new_year = uom.getFullYear();
	  	new_month = uom.getMonth();
	  	new_min = 0;
	  	var xc = new Date(new_year,new_month,new_date,new_hour,new_min,0,0);
	  	return xc;
	  }  
	  */
	  
	  if(hour <= 7 && hour >0 ){
	  	new_hour = 7;
	  	new_date = datatime.getDate();
	  	new_year = datatime.getFullYear();
	  	new_month = datatime.getMonth();
	  	new_month = datatime.getMonth();
	  	new_min = 0;
	  }else{
	  	new_hour = hour;
		new_year = year;
		new_month = month;
		new_date = date;
		new_min = datatime.getMinutes();
	  }
	  //alert(new_year+"-"+new_month+"-"+new_date);
	  var xc = new Date(new_year,new_month,new_date,new_hour,new_min,0,0);
	  return xc;
}  
$.getlength = function(message){
	return (message?message.length:0);
}
$.isMobile = function(str) {  
	//var filter=/^(?:13\d|15[890])-?\d{5}(\d{3}|\*{3})$/; 
	var filter= "~!@%^&*;'\"?><[]{}\\|,:/=+—“”‘"; 
	return (filter.test(str));  
} 
				
$.isTel = function(str){
	var filter=/^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/;  
	return (filter.test(str));
}
;

$.checkSmallForm = function(){
	//alert(1);
	document.getElementById('content1').readOnly=true;
	$('#content').val($('#content1').val());	
	//alert($('#content').val());
	//alert($("#numOfword").val());
	return true;
}

$.modifySmallContent = function(){
	$('#content1').css("background-color","white");
	document.getElementById('content1').readOnly=false;
							 
}
