﻿



function CheckLogin(){
	_va = document.loginForm
	if (_va.UserName.value.length<2||_va.UserName.value=="请输入您的帐号"){
		document.getElementById("errorText").innerHTML = "请输入账号";
		document.getElementById("errorText").style.display="";
		_va.UserName.focus();
		return false;
		}
	if (_va.Pass.value.length<6||_va.Pass.value=="请输入您的密码"){
		document.getElementById("errorText").innerHTML = "请输入密码";
		document.getElementById("errorText").style.display="";
		_va.Pass.focus();
		return false;
		}

	else{
		return true;
		}
}

function mzCheck(){
	_va = document.comForm
	if (_va.uUser.value.length<2||_va.uUser.value=="请输入您的帐号"){
		document.getElementById("srrot").innerHTML = "请输入您的正确帐号";
		document.getElementById("srrot").style.display="";
		_va.uUser.focus();
		return false;
		}


	else{
		return true;
		}
}
function mztCheck(){
	_va = document.comForm
	if (_va.mmda.value.length<1){
		document.getElementById("srrot").innerHTML = "请输入正确答案";
		document.getElementById("srrot").style.display="";
		_va.mmda.focus();
		return false;
		}


	else{
		return true;
		}
}

function Formedit(){
	_va = document.comForm

	if (_va.uPwd.value.length<6 && _va.uPwd.value.length!="" ){
		alert("--请填写长度大于6位的会员密码--");
		_va.uPwd.focus();
		return false;
		}
	if (_va.uPwd2.value.length<6 && _va.uPwd.value.length!=""){
		alert("--请在输入一次确定密码--");
		_va.uPwd2.focus();
		return false;
		}
	if (_va.uPwd.value!=_va.uPwd2.value && _va.uPwd.value.length!=""){
		alert("--两次输入的密码不一致,请重新输入--");
		_va.uPwd2.value='';
		_va.uPwd.value='';
		_va.uPwd.focus();
		return false;
		}
	

	if (_va.comname.value==""){
		alert("--请填写公司名称--");
		_va.comname.focus();
		return false;
		}
	if (_va.comname.value.length<4){
		alert("--请填写长度大于2位的公司名称--");
		_va.comname.focus();
		return false;
		}
	if (_va.username.value.length<2){
		alert("--请填写联 系 人--");
		_va.username.focus();
		return false;
		}
	if (_va.province.value.length<4){
		alert("--请填写公司地址--");
		_va.province.focus();
		return false;
		}

	if (_va.city.value==""){
		alert("--请正确填写邮政编码--");
		
		return false;
		}

	if (_va.city.value.length<4){
		alert("--请填写邮政编码--");
		_va.city.focus();		
		return false;
		}

	if (_va.umoble.value.length!=11){
		alert("--请正确填写您的手机号码--");
		_va.umoble.focus();
		return false;
		}

}
 
function FormCheck(){
	_va = document.comForm




	if (_va.uUser.value==""){
		alert("--请填写会员帐号--");
		_va.uUser.focus();
		return false;
		}
	if (_va.uUser.value.length<4){
		alert("--请填写长度大于4位的会员帐号--");
		_va.uUser.focus();
		return false;
		}
	if (_va.uPwd.value.length<6){
		alert("--请填写长度大于6位的会员密码--");
		_va.uPwd.focus();
		return false;
		}
	if (_va.uPwd2.value.length<6){
		alert("--请在输入一次确定密码--");
		_va.uPwd2.focus();
		return false;
		}
	if (_va.uPwd.value!=_va.uPwd2.value){
		alert("--两次输入的密码不一致,请重新输入--");
		_va.uPwd2.value='';
		_va.uPwd.value='';
		_va.uPwd.focus();
		return false;
		}

	if (_va.comname.value==""){
		alert("--请填写公司名称--");
		_va.comname.focus();
		return false;
		}
	if (_va.comname.value.length<4){
		alert("--请填写长度大于2位的公司名称--");
		_va.comname.focus();
		return false;
		}
	if (_va.username.value.length<2){
		alert("--请填写联 系 人--");
		_va.username.focus();
		return false;
		}
	if (_va.province.value.length<4){
		alert("--请填写公司地址--");
		_va.province.focus();
		return false;
		}
	if (_va.city.value.length<4){
		alert("--请填写邮政编码--");
		_va.city.focus();		
		return false;
		}
	if (_va.city.value==""){
		alert("--请填写邮政编码--");
		_va.city.focus();
		return false;
		}

	if (_va.Email.value.indexOf("@")==-1||_va.Email.value.indexOf(".")==-1){
		alert("--请正确填写电子信箱--");
		_va.Email.focus();
		return false;
		}

	if (_va.umoble.value.length!=11){
		alert("--请正确填写您的手机号码--");
		_va.umoble.focus();
		return false;
		}
	
	if (_va.userCode.value.length<4){
		alert("--请在输入正确的验证码--");
		_va.userCode.focus();
		return false;
		}

}

function tsCheck(){
	_va = document.comForm
	if (_va.username.value==""){
		alert("--请填写联系人--");
		_va.username.focus();
		return false;
		}
	if (_va.comtel.value==""){
		alert("--请填写联系电话--");
		_va.comtel.focus();
		return false;
		}
	if (_va.comEmail.value.indexOf("@")==-1||_va.comEmail.value.indexOf(".")==-1){
		alert("--请正确填写电子信箱--");
		_va.comEmail.focus();
		return false;
		}
	if (_va.title.value==""){
		alert("--请填写投诉标题--");
		_va.title.focus();
		return false;
		}
	if (_va.title.value.length<2){
		alert("--请填写长度大于2位的标题--");
		_va.title.focus();
		return false;
		}
	if (_va.content.value.length<10){
		alert("--投诉内容不能少于10个文字--");
		_va.content.focus();
		return false;
		}

	if (_va.content.value.length>500){
		alert("--投诉内容请勿超出500字--");
		_va.content.focus();
		return false;
		}
	if (_va.userCode.value.length<2){
		alert("--请在输入正确的验证码--");
		_va.userCode.focus();
		return false;
		}
}
function khCheck(){
	_va = document.comForm
	if (_va.comname.value==""){
		alert("--请填写公司名称--");
		_va.comname.focus();
		return false;
		}
	if ((_va.comEmail.value!="") && (_va.comEmail.value.indexOf("@")==-1||_va.comEmail.value.indexOf(".")==-1)){
		alert("--请正确填写电子信箱--");
		_va.comEmail.focus();
		return false;
		}
	if (_va.content.value!="" && _va.content.value.length>500){
		alert("--备注内容请勿超出500字--");
		_va.content.focus();
		return false;
		}
	if (_va.userCode.value.length<2){
		alert("--请在输入正确的验证码--");
		_va.userCode.focus();
		return false;
		}
}
function xxCheck(){
	_va = document.comForm
	if (_va.comname.value==""){
		alert("--请填写公司名称--");
		_va.comname.focus();
		return false;
		}
	if (_va.comname.value.length<2){
		alert("--请填写长度大于2位的公司名称--");
		_va.comname.focus();
		return false;
		}
	if (_va.username.value.length<2){
		alert("--请填写联 系 人--");
		_va.username.focus();
		return false;
		}
	if (_va.province.value.length<4){
		alert("--请填写公司地址--");
		_va.province.focus();
		return false;
		}
	if (_va.city.value.length<4){
		alert("--请填写邮政编码--");
		_va.city.focus();		
		return false;
		}
	if (_va.city.value==""){
		alert("--请填写邮政编码--");
		
		return false;
		}


	if (_va.Email.value.indexOf("@")==-1||_va.Email.value.indexOf(".")==-1){
		alert("--请正确填写电子信箱--");
		_va.Email.focus();
		return false;
		}

	if (_va.umoble.value.length!=11){
		alert("--请正确填写您的手机号码--");
		_va.umoble.focus();
		return false;
		}
	if (_va.shul.value.length==""){
		alert("--请在填写购买数量--");
		_va.shul.focus();
		return false;
		}
	if (_va.uqq.value.length==""){
		alert("--请在填写产品单价--");
		_va.uqq.focus();
		return false;
		}
	if (_va.zjg.value.length==""){
		alert("--请在填写产品总价--");
		_va.zjg.focus();
		return false;
		}


for(i=0;i<_va.fpny.length;i++){
  if(_va.fpny[i].checked == true){
   var zhi= _va.fpny[i].value;

 }
 }

	if (_va.fptt.value=="" && zhi=="true"){


		alert("--请正确填写发票抬头--");
		_va.fptt.focus();
		return false;
		}
}

function etCheck(){
	_va = document.comForm
	if (_va.comname.value==""){
		alert("--请填写公司名称--");
		_va.comname.focus();
		return false;
		}
	if (_va.comname.value.length<2){
		alert("--请填写长度大于2位的公司名称--");
		_va.comname.focus();
		return false;
		}
	if (_va.username.value.length<2){
		alert("--请填写联 系 人--");
		_va.username.focus();
		return false;
		}
	if (_va.province.value.length<4){
		alert("--请填写公司地址--");
		_va.province.focus();
		return false;
		}
	if (_va.city.value.length<4){
		alert("--请填写邮政编码--");
		_va.city.focus();		
		return false;
		}
	if (_va.city.value==""){
		alert("--请填写邮政编码--");
		
		return false;
		}


	if (_va.Email.value.indexOf("@")==-1||_va.Email.value.indexOf(".")==-1){
		alert("--请正确填写电子信箱--");
		_va.Email.focus();
		return false;
		}

	if (_va.umoble.value.length!=11){
		alert("--请正确填写您的手机号码--");
		_va.umoble.focus();
		return false;
		}
	if (_va.userCode.value.length<4){
		alert("--请在输入正确的验证码--");
		_va.userCode.focus();
		return false;
		}
}


function CheckAll(form){
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll"&&e.disabled==false)
       e.checked = form.chkAll.checked;
    }
  }
function unselectall(){
    if(document.form.chkAll.checked){
	document.form.chkAll.checked = document.form.chkAll.checked&0;
    } 	
}



function createAjax() {			
	var _xmlhttp;
	try {	
		_xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	
	}
	catch (e) {
		try {
			_xmlhttp=new XMLHttpRequest();	
		}
		catch (e) {
			_xmlhttp=false;		
		}
	}
	return _xmlhttp;	
}
function askchk(str){
	if (str==""){
		document.getElementById("srrot").innerHTML = "<font color=red>请输入正确的公司名称</font>";
	
		return false;
		}
	var xmlhttp=createAjax();	

	if (xmlhttp) {		
		var content=document.getElementById('tu');	
		xmlhttp.open('get','server.asp?type=b&nam='+escape(str)+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				document.getElementById("srrot").innerHTML = "请输入销售商完整名称";
				content.innerHTML=unescape(xmlhttp.responseText)

			}
			else {
				content.innerHTML='<img src="images/loading.gif" border="0"/>';	
			}
		}
		xmlhttp.send(null);	
	}
}

function ddchk(str){
	if (str==""){
		document.getElementById("srrot").innerHTML = "<font color=red>请输入正确的订单号码</font>";
	
		return false;
		}
	var xmlhttp=createAjax();	

	if (xmlhttp) {		
		var content=document.getElementById('ddstr');	
		xmlhttp.open('get','server.asp?type=c&did='+escape(str)+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				document.getElementById("srrot").innerHTML = "请输入您的订单号码";
				content.innerHTML=unescape(xmlhttp.responseText)

			}
			else {
				content.innerHTML='<img src="images/loading.gif" border="0"/>';	
			}
		}
		xmlhttp.send(null);	
	}
}
function jhchk(str,stc){
	if (str==""){
		document.getElementById("srrot").innerHTML = "<font color=red>请输入正确的软件编号</font>";	
		return false;
		}
	if (stc==""){
		document.getElementById("srrot").innerHTML = "<font color=red>请输入正确的加密狗ID</font>";	
		return false;
		}
	var xmlhttp=createAjax();	

	if (xmlhttp) {		
		var content=document.getElementById('jhstr');	
		xmlhttp.open('get','server.asp?type=d&pid='+escape(str)+'&jid='+escape(stc)+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				document.getElementById("srrot").innerHTML = "请输入软件信息";
				content.innerHTML=unescape(xmlhttp.responseText)

			}
			else {
				content.innerHTML='<img src="images/loading.gif" border="0"/>';	
			}
		}
		xmlhttp.send(null);	
	}
}
function dljhchk(str,stc){
	if (str==""){
		document.getElementById('dlck').innerHTML = "<font color=red>请选择软件编号</font>";	
		return false;
		}
	if (stc==""){
		document.getElementById('dlck').innerHTML = "<font color=red>请选择加密狗ID</font>";	
		return false;
		}
	var xmlhttp=createAjax();	

	if (xmlhttp) {	
		document.getElementById('dlck').style.display='block';	
		var content=document.getElementById('dlck');	
		xmlhttp.open('get','server.asp?type=d&pid='+escape(str)+'&jid='+escape(stc)+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	

				content.innerHTML=unescape(xmlhttp.responseText)

			}
			else {
				
				content.innerHTML='<img src="images/loading.gif" border="0"/>';	
			}
		}
		xmlhttp.send(null);	
	}
}
function yzchk(str,stc){
	if (str==""){
		document.getElementById("srrot").innerHTML = "<font color=red>请输入正确的软件编号</font>";
	
		return false;
		}
	if (stc==""){
		document.getElementById("srrot").innerHTML = "<font color=red>请输入正确的加密狗ID</font>";
	
		return false;
		}
	var xmlhttp=createAjax();	

	if (xmlhttp) {		
		var content=document.getElementById('yzstr');	
		xmlhttp.open('get','server.asp?type=e&pid='+escape(str)+'&jid='+escape(stc)+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				document.getElementById("srrot").innerHTML = "请输入软件信息";
				content.innerHTML=unescape(xmlhttp.responseText)

			}
			else {
				content.innerHTML='<img src="images/loading.gif" border="0"/>';	
			}
		}
		xmlhttp.send(null);	
	}
}

function dlkhchk(str,stc){
	if (str==""){
		document.getElementById('khck').innerHTML = "<font color=red>请选择您要产看的客户</font>";	
		return false;
		}
	if (stc==""){
		document.getElementById('khck').innerHTML = "<font color=red>您无权查看该客户信息</font>";	
		return false;
		}
	var xmlhttp=createAjax();	

	if (xmlhttp) {	
		document.getElementById('khck').style.display='block';	
		var content=document.getElementById('khck');	
		xmlhttp.open('get','server.asp?type=f&kid='+escape(str)+'&uid='+escape(stc)+'&n='+Math.random(),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	

				content.innerHTML=unescape(xmlhttp.responseText)

			}
			else {
				
				content.innerHTML='<img src="images/loading.gif" border="0"/>';	
			}
		}
		xmlhttp.send(null);	
	}
}




function sum(){
		var txtA=document.getElementById("uqq").value;
		var txtB=document.getElementById("shul").value;

		document.getElementById("zjg").value=parseInt(txtA)*parseInt(txtB);
}




var HKEY_Root,HKEY_Path,HKEY_Key;
HKEY_Root="HKEY_CURRENT_USER";
HKEY_Path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
function pagesetup_null()
{
try
{
var Wsh=new ActiveXObject("WScript.Shell");
HKEY_Key="header";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
HKEY_Key="footer";
Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,"");
}
catch(e){}
}



function preview()
{
 bdhtml=window.document.body.innerHTML;
 sprnstr="<!--startprint-->";
 eprnstr="<!--endprint-->";
 prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
 prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
 window.document.body.innerHTML=prnhtml;

 window.print();

 //prnform.htext.value=prnhtml;
 //prnform.submit();
 //alert(prnhtml);
}