// JavaScript Document
function auto()
{
}
function killErrors() {
  return true;
}
window.onerror = killErrors;

function tab (mod,cursor,n){
	for(i=1;i<=n;i++){
		var nav=document.getElementById(mod+i);
		var cont=document.getElementById(mod+"_"+"cont"+i);
		nav.className=(i==cursor)?"current":"";
		cont.style.display=(i==cursor)?"block":"none";
	}
}
//mod:对像;cursor:当前ID数;n:总数;css:样式
function tabs (mod,cursor,n,css){
	for(i=1;i<=n;i++){
		var nav=document.getElementById(mod+"_"+i);
		var cont=document.getElementById(mod+"_"+"cont"+i);
		nav.className=(i==cursor)?css:"";
		cont.style.display=(i==cursor)?"block":"none";
	}
}
function doZoom(size){
	document.getElementById('content').style.fontSize=size+'px'
}



function copyToClipBoard(content) {
    if (typeof(window.clipboardData) != "undefined") {
        window.clipboardData.setData("Text", content);
        return true
    } else {
        return false
    }
}
function share_to_qq_friends_for_deal(deal_string) {
    if (copyToClipBoard(deal_string)) {
        alert("复制网址成功,请粘贴到你的QQ/MSN上推荐给你的好友！");
    } else {
        alert("目前只支持IE，请复制地址栏URL,推荐给你的QQ/MSN好友！");
    }
}


function SetHome(obj,url){
	try{
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage(url);
	}catch(e){
		if(window.netscape){
			try{
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
			}catch(e){
				alert("抱歉，此操作被浏览器拒绝！\n\n请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'");
			}
		}else{
			alert("抱歉，您所使用的浏览器无法完成此操作。\n\n您需要手动将 "+url+" 设置为首页。");
		}
	}
}

function AddFavorite(url,title){
    if (document.all){
		window.external.addFavorite(url,title);
	}else if (window.sidebar){
		window.sidebar.addPanel(title, url, "");
    }
}

//倒计时
function show_date_time(){
	var showdate="";
	window.setTimeout("show_date_time()", 1000);
	BirthDay=new Date("Feb 28 2011 00:00:00");//改成你的计时日期
	today=new Date();
	timeold=(BirthDay.getTime()-today.getTime());
	sectimeold=timeold/1000
	secondsold=Math.floor(sectimeold);
	msPerDay=24*60*60*1000
	e_daysold=timeold/msPerDay
	daysold=Math.floor(e_daysold);
	e_hrsold=(e_daysold-daysold)*24;
	hrsold=Math.floor(e_hrsold);
	e_minsold=(e_hrsold-hrsold)*60;
	minsold=Math.floor((e_hrsold-hrsold)*60);
	seconds=Math.floor((e_minsold-minsold)*60);
	showdate=daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒" ;
	return showdate;
}
//返馈数据提交
function CheckSava() {
	var _company = document.getElementById("_company");
	var _name = document.getElementById("_name");
	var _email = document.getElementById("_email");
	var _tel = document.getElementById("_tel");
	var _content = document.getElementById("_content");
	if(_company.value.length=="0"){
	   alert("请输入的你的公司名称！");_company.focus();return false;
	}
	if(_name.value.length=="0"){
	   alert("请输入您的姓名！");_name.focus();return false;
	}
	if(_email.value.length=="0"){
	   alert("请输入您的电子邮箱！");_email.focus();return false;
	}else{
		var re = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
		if (!re.test(_email.value)) {
			alert("输入的邮箱地址不正确！");
			_email.focus();
			return false;
		}
	}
	if(_tel.value.length=="0"){
	   alert("请输入您的联系电话！");_tel.focus();return false;
	}
	if(_content.value.length=="0"){
	   alert("请输入留言内容！");_content.focus();return false;
	}

	 $.post('ashx/OnlineConsult.ashx',{company:$("#_company").val(),name:$("#_name").val(),email:$("#_email").val(),tel:$("#_tel").val(),content:$("#_content").val()},
	 function(data){
		 if(data==1)
		 {
			 alert("留言已成功提交!");
			 window.location.reload();
		 }else if(data==0){
			alert("留言提交失败,请和网站管理员联系!");
		 }else{
			alert("输入的数据没完整,请把信息填写完整再提交!");
		 }
	});  
	
}

function CheckSavaEN() {
	var _company = document.getElementById("_company");
	var _name = document.getElementById("_name");
	var _email = document.getElementById("_email");
	var _tel = document.getElementById("_tel");
	var _content = document.getElementById("_content");
	if(_company.value.length=="0"){
	   alert("Please enter your company name.");_company.focus();return false;
	}
	if(_name.value.length=="0"){
	   alert("Please enter your Name.");_name.focus();return false;
	}
	if(_email.value.length=="0"){
	   alert("Please enter your e-mail.");_email.focus();return false;
	}else{
		var re = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
		if (!re.test(_email.value)) {
			alert("Enter the e-mail address is not correct！");
			_email.focus();
			return false;
		}
	}
	if(_tel.value.length=="0"){
	   alert("Please enter your contact Phone！");_tel.focus();return false;
	}
	if(_content.value.length=="0"){
	   alert("Please enter a Message！");_content.focus();return false;
	}

	 $.post('ashx/OnlineConsult.ashx',{company:$("#_company").val(),name:$("#_name").val(),email:$("#_email").val(),tel:$("#_tel").val(),content:$("#_content").val()},
	 function(data){
		 if(data==1)
		 {
			 alert("Message has been successfully submitted!");
			 window.location.reload();
		 }else if(data==0){
			alert("Failure to submit a message, please contact the site administrator!");
		 }else{
			alert("Did not complete the data input, please complete and submit the information to fill !");
		 }
	});  
	
}
//==End ==========
//追加样式类addClass(document.getElementById('test'), 'b'); 
function addClass(element,value) {
  if (!element.className) {
    element.className = value;
  } else {
    element.className+= " ";
    element.className+= value;
  }
}
