﻿// JavaScript Document=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
//=*=*=*=*=*=USERNAME: 新界=*=*=*=*=*==*=*=*=*=*==*=*=*=*=*==*=*=*=*=*==*=*=*=*=*==*=*=*
//=*=*=*=*=*=QQ: 759999262=*=*=*=*=*==*=*=*=*=*==*=*=*=*=*==*=*=*=*=*==*=*=*=*=*==*=*=*
//=*=*=*=*=*=E-mail: dzl2005328@163.com=*=*=*=*==*=*=*=*=*==*=*=*=*=*==*=*=*=*=*==*=*=*
//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
//=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
//声明提示信息=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*==*=*=*=*=*
var nhvMsg = [];
nhvMsg[0] = '';
nhvMsg[1] = '不能为空';
nhvMsg[2] = '太长';

nhvMsg['username']		= '用户名长度只能在2~18位之间';
nhvMsg['username2']		= '用户名长度只能字母开头或结尾';
nhvMsg['username3']		= '用户名只能由英文字母、数字和下划线 <_> 组成';
nhvMsg['username4'] 	= '恭喜，该用户名可以使用!';

nhvMsg['password'] = '<BR />密码不能为空';
nhvMsg['password2'] = '<BR />密码长度6～16位，字母区分大小写';
nhvMsg['ppassword'] = '<br />两次密码输入不一致';
nhvMsg['ppassword2'] = '<br />重复密码不能为空';

nhvMsg[3] = '太短';
nhvMsg[4] = '不符合要求';
nhvMsg['question'] = '<br />请选择密码保护问题'
nhvMsg['question1'] = '<br />请填写自定义密码保护问题'
nhvMsg['question2'] = '<br />自定义问题太长，长度6～30位，字母区分大小写，一个汉字占两个字符';
nhvMsg['question3'] = '<br />问题答案太短，长度为6～30位，字母区分大小写，一个汉字占两个字符';
nhvMsg['answer1'] = '<br />问题答案太长，长度6～30位，字母区分大小写，一个汉字占两个字符';
nhvMsg['answer2'] = '<br/>请输入正确的问题答案，长度6～30位。区分字母大小写，一个汉字占两个字符';

nhvMsg['nhvmail'] = '<br />邮箱地址无效';
nhvMsg['year'] = '<br />请您输入正确的年份';
nhvMsg['nhvcode'] = '&nbsp;&nbsp;请看清图片输入';
nhvMsg['nhvagree'] = '您必须同意新视听服务条款';
//end
var _myQuestion = '我的自定义问题';
//TypeEdit
if (!window.Element) {
  var Element = new Object();
}
var nhvHttp;
var nhvi		= 1;
var nhvpdi		= 1;
var MinLen		= 2;
var MinLen2		= 6;
var isReg		= true;
var navNow		= new Date();
var jsmenu		= new Array();
jsmenu['active']= new Array();
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);

if(window.XMLHttpRequest){
	var nhvHttp = new XMLHttpRequest();
}
else if(window.ActiveXObject){
	var nhvHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
	
String.prototype.trim = function(){
    return this.replace(/(^[\s]*)|([\s]*$)/g, "");
}

var menus = new Array('home','users','newzixun','productpc','download','company','XJBBS','QuAnswer','system');
function showLeftMenu(id){
	if(parent.menu){
		for(k in menus){
			if(parent.menu.document.getElementById(menus[k])){
				parent.menu.document.getElementById(menus[k]).style.display = menus[k] == id ? '' : 'none';
			}
		}
	}
}
function popnew(){window.open('check.php','baidu',"width=1000,height=550,left=100,top=100,scrollbars=no,resizable=no,status=no");}
function popnew2(Args){window.open(Args,'bbs');}

function submitThisform(formadmin,TypeEdit,page){
	var form = document.formadmin;
	//var form = document.fomrs[0];
	form.action = "?action="+TypeEdit+"&pagenum="+page;
	form.submit();
}

function submitDelform(formadmin,TypeDelete,page){
	var form = document.formadmin;
	//var form = document.fomrs[0];
	form.action = "?action="+TypeDelete+"&pagenum="+page;
	form.submit();
}

function setCookie(name,value,path,domain,secure){
	var date = new Date();
	datetime = 108000*24;
	date.setTime(date.getTime() + 60000*datetime);
	document.cookie = name + "=" + escape(value) +
	"; expires=" + date.toGMTString() +
	((path) ? "; path=" + path : + "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");	
}

function getCookie(cookiename){
	var allcookies = document.cookie;
	var cookiepos = allcookies.indexOf(cookiename);
	
	if(cookiepos != -1){
		cookiepos += cookiename.length + 1;
		var cookieend = allcookies.indexOf(";",cookiepos);
		
		if(cookieend == -1){
			cookieend = allcookies.length;
		}
		var value = unescape(allcookies.substring(cookiepos,cookieend));
	}	
	return value;	
}
function showPageSize(num,action,page){
	if(num == ""){
		return false;
	}else{
		setCookie("Page_Size",num);
		var pageSize = getCookie("Page_Size");
		if(action != ""){
			window.location.href='?action='+ action + '&page='+ page +'&defaultPageSize='+pageSize;
		}else{
			window.location.href='?page='+ page +'&defaultPageSize='+pageSize;
		}
	}
}

function $(id){return document.getElementById(id);}function $v(obj){return document.getElementById(obj).value;}
var newhivicoll = getCookie('newhivi_coll');
function newhivicoll_change(menucount){
	if($('menu_' + menucount).style.display == 'none'){
		$('menu_' + menucount).style.display = '';
		newhivicoll = newhivicoll.replace('[' + menucount + ']','');
		$('menuimg_' + menucount).src = '../images/menu_reduce.gif';
	}else{
		$('menu_' + menucount).style.display = 'none';
		newhivicoll += '[' + menucount + ']';
		$('menuimg_' + menucount).src = '../images/menu_add.gif';
	}
	setCookie('newhivi_coll',newhivicoll);
}

function newhiviChange(menucount){if($('nhvmenu_' + menucount).style.display == 'none'){('nhvmenu_' + menucount).style.display = '';}else{$('nhvmenu_' + menucount).style.display = 'none';}}
function showdiv(divnum,divbefor){
	var x;
	var newarray = divnum.split("-");
	for(x in newarray){
		if(divbefor==newarray[x]){
			document.getElementById("List_"+newarray[x]).className ="NavOn";
			document.getElementById("Nav_"+newarray[x]).className ="NavYs1";
		}else{
			document.getElementById("List_"+newarray[x]).className ="NavOFF";
			document.getElementById("Nav_"+newarray[x]).className ="NavYs2";
			document.getElementById("newsshowAll").className = "NavYs2";
		}
	}
}

function showcolor(divname,string){
	var x;
	var newarray = string.split("-");
	for(x in newarray){
		document.getElementById("Nav_"+newarray[x]).className = "NavYs2";
		document.getElementById("List_"+newarray[x]).className ="NavOFF";
	}
	document.getElementById(divname).className = "NavYs1";
}

function _ClickAll(form){for (var i=0;i < form.elements.length;i++){var e=form.elements[i];e.checked=true;}}
function _CheckOthers(form){for (var i=0;i < form.elements.length;i++){var e=form.elements[i];if (e.checked==false){e.checked=true;}else{e.checked=false;}}}
function nhvEvent(type,oInput){
	switch(type){
		case "focus":
			oInput.isFocus = true;
		break;
		case "mouseover":
			oInput.style.borderColor='#336699';
		break;
		case "blur":
			oInput.isFocus = false;
		break;
		case "mouseout":
			if(!oInput.isFocus){
				oInput.style.borderColor='#B4B4B4';
			}
		break;
	}
}

function CheckUserName(UserName){
	if(UserName == null || UserName == ''){
		$("LoginShow").innerHTML = "请填写用户名!";
		changeisReg('true');
	}else if(UserName.length < MinLen || UserName.length > 18){
		$("LoginShow").innerHTML = "用户名长度只能在"+ MinLen +"～18之间!";
		changeisReg('true');
	}else{
		//nhvCheck("ckLogin.php?username="+UserName);
		changeisReg('false');
		$("LoginShow").innerHTML = "";
		$("saveValue").value = UserName;
	}	
}

function $T(obj){return $(obj).parentNode.getElementsByTagName('span')[1];}

function CheckRegName(UserName,getID){
	if(UserName == null || UserName == ''){
		try{$(getID).style.display="block"}catch(e){};
		$(getID).innerHTML = nhvMsg[1];
		return false;
	}else if(UserName.length < MinLen || UserName.length > 18){
		$(getID).innerHTML = nhvMsg['username'];
		return false;
	}else if(!/^[a-zA-Z\d]+([\w\.\-]*[a-zA-Z\d]+)?$/.test(UserName)){
		$(getID).innerHTML = nhvMsg['username2'];
		return false;
	}else if(!/^[\w]+$/.test(UserName)){
		$(getID).innerHTML = nhvMsg['username3'];
		return false;
	}else{
		nhvCheck("ckReg.php?username="+UserName);
	}
	return true;	
}

//CheckRegFun('nhvPassWord',this.value);

function checkReg(){
	CheckRegFun('nhvUsername',$v("nhvUsername"));
	CheckRegFun('nhvPassWord',$v("nhvPassWord"));
	CheckRegFun('nhvRPassWord',$v("nhvRPassWord"));
	CheckRegFun('nhvQuestion',$v("nhvQuestion"));
	CheckRegFun('nhvAnswer',$v("nhvAnswer"));	
	CheckRegFun('year',$v('year'));	
	CheckRegFun('nhvChkCode',$v("nhvChkCode"));
	if($v('nhvEmail') != ""){
		CheckRegFun('nhvEmail',$v("nhvEmail"));
	}
	if(!$('nhvAgree').checked){
		CheckRegFun('nhvAgree',$v("nhvAgree"));
	}
	if(isReg){
		return false;
	}
	return true;
}

function CheckRegFun(Args,getValue){
	getValue = getValue.trim();
	switch(Args){
		case "nhvUsername":
			if(getValue == null || getValue == ''){
				$T(Args).innerHTML = nhvMsg[1];
			}else if(getValue.length < MinLen || getValue.length > 18){
				$T(Args).innerHTML = nhvMsg['username'];
			}else{
				nhvCheck2("ckReg.php?username="+getValue,Args);
			}
		break;
		case "nhvPassWord":
			if(getValue == null || getValue == ''){
				$T(Args).innerHTML = nhvMsg['password'];
				changeisReg('true');
			}else if(getValue.length < MinLen2 || getValue.length > 16){
				$T(Args).innerHTML = nhvMsg['password2'];
				changeisReg('true');
			}else{
				$T(Args).innerHTML = '';
				changeisReg('false');
			}
		break;
		case 'nhvRPassWord':
			if(getValue == null || getValue == ''){
				$T(Args).innerHTML = nhvMsg['ppassword2'];
				changeisReg('true');
			}else if(getValue != $('nhvPassWord').value){
				$T(Args).innerHTML = nhvMsg['ppassword'];
				changeisReg('true');
			}else{
				$T(Args).innerHTML = '';
				changeisReg('false');
			}
		break;
		case 'nhvQuestion':
			if(getValue == 0){
				$T('nhvAnswer').innerHTML = "";
				changeisReg('false');
			}else if(getValue == null || getValue == ''){
				$T(Args).innerHTML = nhvMsg['question'];
				$('myQuestion').className = 'nhvZhuce_4_3';
				changeisReg('true');
			}else if($(Args).value == _myQuestion){
				$('myQuestion').className = 'show';
				if(window.attachEvent){
					$('myQuestion').attachEvent('onblur',checkMyQues);
				}else{
					$('myQuestion').addEventListener('onblur',checkMyQues);
				}
			}else{
				$T(Args).innerHTML = '';
				$('myQuestion').className = 'nhvZhuce_4_3';
				changeisReg('false');
			}
			
		break;
		case 'myQuestion':
			if(getValue == null || getValue == ''){
				$T(Args).innerHTML = nhvMsg['question1'];
				changeisReg('true');
			}else if(strLen(getValue) < 6){
				$T(Args).innerHTML = nhvMsg['question3'];
				changeisReg('true');
			}else if(strLen(getValue) > 18){
				$T(Args).innerHTML = nhvMsg['question2']
				changeisReg('true');
			}else{
				$T(Args).innerHTML = '';
				changeisReg('false');
			}
		break;
		case "nhvAnswer":
			if($v('nhvQuestion') != "" && $v('nhvQuestion')!= '0'){
				if(getValue == null || getValue == ''){
					$T(Args).innerHTML = nhvMsg['answer2'];
					changeisReg('true');
				}else if(strLen(getValue) < 6 || strLen(getValue) > 18){
					$T(Args).innerHTML = nhvMsg['answer2'];
					changeisReg('true');
				}else{
					$T(Args).innerHTML = "";
					changeisReg('false');
				}
			}else{
				$T(Args).innerHTML = "";
				changeisReg('false');
			}
		break;
		case "year":
		///var nowMonth	= navNow.getMonth();
		//var nowDate		= navNow.getDate();
		if(getValue == null || getValue == ''){
			$T(Args).innerHTML = nhvMsg['year'];
			changeisReg('true');
		}else if(strLen(getValue) != 4){
			$T(Args).innerHTML = nhvMsg['year'];
			changeisReg('true');
		}else if(!/^\d+$/.test(getValue)){
			$T(Args).innerHTML = nhvMsg['year'];
			changeisReg('true');
		}else if(parseInt(getValue) > (parseInt(navNow.getFullYear()) - 5)){
			$T(Args).innerHTML = nhvMsg['year'];
			changeisReg('true');
		}else if(parseInt(getValue) < 1902){
			$T(Args).innerHTML = nhvMsg['year'];
			changeisReg('true');	
		}else{
			$T(Args).innerHTML = "";
			changeisReg('false');
		}
		break;
		case "nhvEmail":
			if(!nhvCkMail(getValue) && getValue != ""){
				$T(Args).innerHTML = nhvMsg['nhvmail'];
				changeisReg('true');	
			}else {
				$T(Args).innerHTML = "";
				changeisReg('false');
			}
		break;
		case "nhvChkCode":
			if(getValue == null || getValue == ''){
				$T(Args+'0').innerHTML = nhvMsg['nhvcode'];
				changeisReg('true');
			}else if(strLen(getValue) != 4){
				$T(Args+'0').innerHTML = nhvMsg['nhvcode'];
				changeisReg('true');
			}else{
				nhvCheck2("ckReg.php?verify="+getValue,Args+'0');
			}
		break;
		case "nhvAgree":
			if(!$('nhvAgree').checked){
				$T(Args).innerHTML = nhvMsg['nhvagree'];
				changeisReg('true');	
			}else{
				$T(Args).innerHTML = "";
				changeisReg('false');
			}
		break;
	}
}

function nhvCheck2(strURL,Args){
	nhvHttp.open('GET', strURL, true);
	nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	nhvHttp.onreadystatechange = function(){
		if (nhvHttp.readyState == 4){
			if(200 == nhvHttp.status){
				if(nhvHttp.responseText != ""){
					changeisReg('true');
					$T(Args).innerHTML = nhvHttp.responseText;
				}else{
					if(Args.substr(Args.length-1) == '0'){
						$T(Args).innerHTML = "";
					}else{
						$T(Args).innerHTML = nhvMsg['username4'];
					}
					changeisReg('false');
				}
			}else{
				$(Args).innerHTML = "验证用户名服务暂时不可用，不过您可继续申请。";	
			}
		}
	}
	nhvHttp.send(strURL);
}

function CheckUserPass(PassWord){
	if(PassWord == null || PassWord == ''){
		$("LoginShow").innerHTML = "请填写密码!";
		changeisReg('true');
	}else if(PassWord.length < 5 || PassWord.length > 20){
		$("LoginShow").innerHTML = "密码长度只能在5到20之间!";
		changeisReg('true');
	}else if(!/^[a-zA-Z0-9]+$/.test(PassWord)){
		$("LoginShow").innerHTML = "密码只能由英文字母和数字组成!";
		changeisReg('true');
	}else{
		changeisReg('false');
		$("LoginShow").innerHTML = "";
		userName = $("saveValue").value;
		//nhvCheck("ckLogin.php?hiddenName="+userName+"&password="+PassWord);
	}
}

function CheckUserVeri(Verify){
	if(Verify == null || Verify == ''){
		$("LoginShow").innerHTML = "请填写验证码!";
		changeisReg('true');
		return false;
	}
	if(!/^\w{4}$/.test(Verify)){
		$("LoginShow").innerHTML = "请填写正确的验证!";
		changeisReg('true');
		return false;
	}
	nhvCheck("/ckLogin.php?verify="+Verify);
}

function nhvCheck(strURL){
	nhvHttp.open('GET', strURL, true);
	nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	nhvHttp.onreadystatechange = function(){
		if (nhvHttp.readyState == 4){
			if(200 == nhvHttp.status){
				if(nhvHttp.responseText != ""){
					changeisReg('true');
					$("LoginShow").innerHTML = nhvHttp.responseText;
				}else{
					$("LoginShow").innerHTML = "";
					changeisReg('false');
					if($("okSubmit")){
						$("okSubmit").disabled = false;
					}
				}
			}else{
				$("LoginShow").innerHTML = "异常错误!";	
				changeisReg('true');
			}
		}
	}
	nhvHttp.send(strURL);
}

function checkMyQues()
{
   CheckRegFun('myQuestion',$('myQuestion').value);
}

/*
function checkReg(){
	CheckRegFun('nhvUsername',$v("nhvUsername"));
	CheckRegFun('nhvPassWord',$v("nhvPassWord"));
	CheckRegFun('nhvRPassWord',$v("nhvRPassWord"));
	CheckRegFun('nhvQuestion',$v("nhvQuestion"));
	CheckRegFun('nhvAnswer',$v("nhvAnswer"));	
	CheckRegFun('year',$v('year'));	
	CheckRegFun('nhvChkCode',$v("nhvChkCode"));
	if($v('nhvEmail') != ""){
		CheckRegFun('nhvEmail',$v("nhvEmail"));
	}
	if(!$('nhvAgree').checked){
		CheckRegFun('nhvAgree',$v("nhvAgree"));
	}
	if(isReg){
		return false;
	}
	return true;
}
*/

function ntValue(Args){
	var brand = $('nhvptype2');
	while(brand.length > 0){
		brand.remove(brand.options[0]);
	}
	getArray = "011";
	chkModel("nhv.model.php?getnum="+Args);
	alert(getArray);
	for(var o = 0;o < 10;o++){
		var brand2 = document.createElement("OPTION");
		brand2.text = o;
		brand2.value = o+1;
		
		if (document.all){
  			brand.add(brand2);
  		}else{
   			brand.appendChild(brand2);
 		}
 		brand2 = null;
	}
}

function Newhivi_Login2(){	
	var username	= window.document.nhvLoginForm.nhvUsername.value.trim();
	var password	= window.document.nhvLoginForm.nhvPassword.value.trim();
	
	CheckUserName(username);
	CheckUserPass(password);
	if($('verify')){
		var verify = window.document.nhvLoginForm.verify.value.trim();
		CheckUserVeri(verify);
	}
	if(isReg){
		return false;
	}
	return true;
}
/*
function Newhivi_Login(){
	var flag		= false;
	var username	= window.document.nhvLoginForm.nhvUsername.value.trim();
	var password	= window.document.nhvLoginForm.nhvPassword.value.trim();
	var verify		= window.document.nhvLoginForm.verify.value.trim();
	var flag1		= CheckUserName(username);
	var flag2		= CheckUserPass(password);
	var flag3		= CheckUserVeri(verify);
	var flag		= flag1 && flag2 && flag3;
	return flag;
}
*/
function nhvRequest2(strURL,strID,strPOST){
	var nhvHttp;
	if(window.XMLHttpRequest){
		var nhvHttp = new XMLHttpRequest();
	}
	else if(window.ActiveXObject){
		var nhvHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	nhvHttp.open(strPOST, strURL, true);
	nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	nhvHttp.onreadystatechange = function(){
		if (nhvHttp.readyState == 4){
			if(nhvHttp.responseText == ""){
				document.getElementById('nhvxinxiDiv2').style.display = 'block';
				document.getElementById('nhvxinxiDiv2').innerHTML = '无此文件!'+"<div style=display:none>"+setTimeout('hiddenMsg2()',3000)+"</div>";
				//document.getElementById(strID).innerHTML = nhvHttp.responseText +"<div style=display:none>"+ setTimeout('hiddenMsg()',3000)+"</div>";
			}else{
				document.getElementById(strID).innerHTML = nhvHttp.responseText +"<div style=display:none>"+ setTimeout('hiddenMsg()',3000)+"</div>";
			}
		}
	}
	nhvHttp.send(strURL);
}
function hiddenMsg2(){document.getElementById('nhvxinxiDiv2').style.display = 'none';}
function hiddenMsg(){document.getElementById('nhvxinxiDiv').style.display='none';}
function itcssQBrand(tid){var URL="/inc/probrand.php?t="+tid;nhvHttp.open('GET', URL, true);nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');nhvHttp.onreadystatechange=function(){if(nhvHttp.readyState==4){if(200==nhvHttp.status){document.getElementById("itcssBSpan").innerHTML=nhvHttp.responseText;}}};nhvHttp.send(URL);};
function itcssQuest(tid,mid){if(!$('meodelSpan')) return false;var URL="/promodel.php?t="+tid+"&b="+mid;nhvHttp.open('GET', URL, true);nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');nhvHttp.onreadystatechange=function(){if(nhvHttp.readyState==4){if(200==nhvHttp.status){document.getElementById("meodelSpan").innerHTML=nhvHttp.responseText;}}};nhvHttp.send(URL);};



function XJQBrand(TID){
	var URL="/inc/XJ_PBRAND.PHP?T="+TID;nhvHttp.open('GET', URL, true);
	nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	nhvHttp.onreadystatechange=function(){
		if(nhvHttp.readyState==4 && nhvHttp.status == 200){
			document.getElementById("itcssBSpan").innerHTML=nhvHttp.responseText;
		}
	};
	nhvHttp.send(URL);
};

function XJQMODEL(TID,BID){
	if(!$('meodelSpan')) return false;
	var URL="/inc/XJ_PMODEL.PHP?T="+TID+"&B="+BID;
	nhvHttp.open('GET', URL, true);
	nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	nhvHttp.onreadystatechange=function(){
		if(nhvHttp.readyState==4 && nhvHttp.status == 200){
			document.getElementById("meodelSpan").innerHTML=nhvHttp.responseText;
		}
	};
	nhvHttp.send(URL);
};

function xjInit(tid){
	var URL="/inc/xjpro/itcss.php?tp="+tid;
	nhvHttp.open('GET', URL, true);
	nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	nhvHttp.onreadystatechange=function(){
		if(nhvHttp.readyState==4 && nhvHttp.status==200){
			document.getElementById("xjcntxt").innerHTML=nhvHttp.responseText;
		}
	};
	nhvHttp.send(URL);
}

function itcssPFjs(cname,cid,itcsstype){
	var URL="/include/ckpf.php?cname="+cname+"&itcsstype="+itcsstype;
	nhvHttp.open('GET', URL, true);
	nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	nhvHttp.onreadystatechange=function(){
		if(nhvHttp.readyState==4){
			if(200==nhvHttp.status){
			document.getElementById("itcssShowPF").innerHTML=nhvHttp.responseText;
			itcssInIt(cid,itcsstype);
			}
		}
	};
	nhvHttp.send(URL);
};

function itcssInIt2(cid){
	var total = parseInt(document.getElementById("itcssTotalPF").innerHTML);
	var tota2 = parseInt(document.getElementById("itcssTnum").innerHTML);
	var num = getCookie(cookname);
	
	if(typeof num == 'undefined'){
		if(tota2 == 0) tota2 = 1;
		var tatals = Math.round(total/tota2);
		document.getElementById("itcssTotalPF").innerHTML = tatals+"分";
		document.getElementById("itcssTnum").innerHTML=tota2;
	}else{
		var len = num.indexOf("|");
		var str = num.substring(0,len)
		var pum = tota2 + 1;
		var totals = Math.round((total+parseInt(str))/pum);
		document.getElementById("itcssTotalPF").innerHTML = totals+"分";
		document.getElementById("itcssTnum").innerHTML=pum;	
	}
}

function itcssInIt(cid,itcsstype){
	var URL="/include/ckzpf.php?cid="+cid+"&itcsstype="+itcsstype;
	nhvHttp.open('GET', URL, true);
	nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	nhvHttp.onreadystatechange=function(){
		if(nhvHttp.readyState==4){
			if(200==nhvHttp.status){
			if(nhvHttp.responseText != ""){
				var thiv = nhvHttp.responseText;
				var len = thiv.indexOf("[");
				if(len != -1){
				var total = parseInt(thiv.substring(0,len));
				var pnumt = thiv.substring(len+1,thiv.length);
				if(pnumt == 0 || !isNaN){
					pnumt = 0;
					var totals = 0;
				}else{
					pnumt = parseInt(pnumt);
					var totals = Math.round(total/pnumt);
				}
				document.getElementById("itcssTotalPF").innerHTML=totals+"分";
				document.getElementById("itcssTnum").innerHTML=pnumt;
				}
			}
			}
		}
	};
	nhvHttp.send(URL);
};

function Newhivi_Delimg($arg1,$arg2,$arg3){
	var tmp = "";
	tmp = ($arg3.trim() == "yes")?"xj":"pro";
	var url = "del"+tmp+"img.php?action=delimg&id="+$arg2+"&imgname="+$arg1;
	nhvRequest2(url,'nhvShow_imgdiv','GET');
}


function getvalue() {
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);
    if (arguments.length == 1)
      return element;
    elements.push(element);
  }
  return elements;
}

function checkAddUser(){
		var nhvUserName 	= document.AddUserForm.nhvUserName.value;
		var nhvPassWord		= document.AddUserForm.nhvPassWord.value;
		var nhvPassWord2	= document.AddUserForm.nhvPassWord2.value;
		if(nhvUserName == ""){
			alert('请填写用户名!');
			document.AddUserForm.nhvUserName.focus();
			return false;
		}else if(nhvUserName.length < 3 || nhvUserName.length > 20){
			alert('用户名长度在 3-20 之间!');
			document.AddUserForm.nhvUserName.focus();
			return false;
		}else if(nhvPassWord == ""){
			alert('密码长度在 3-20 之间!');
			document.AddUserForm.nhvPassWord.focus();
			return false
		}else if(nhvPassWord.length < 3 || nhvPassWord.length > 20){
			alert('密码长度在 3-20 之间!');
			document.AddUserForm.nhvPassWord.focus();
			return false
		}else if(nhvPassWord != nhvPassWord2){
			alert('两次密码输入不一致!');
			document.AddUserForm.nhvPassWord2.focus();
			return false
		}
		return true;
}

function checkAddPro(){
	var nhvpForm = document.nhvpForm;
	var reg = /^\d*$/g;
	if(nhvpForm.nhvpname.value.trim() == ""){
		alert('请输入产品名称!');
		nhvpForm.nhvpname.focus();
		return false;
	}else if(nhvpForm.nhvpname.value.trim().length < 2 || nhvpForm.nhvpname.value.trim().length > 300){
		alert('请输入正确的产品名称!');
		nhvpForm.nhvpname.focus();
		return false;
	}else if(nhvpForm.nhvpnetprice.value.trim() == ""){
		alert('请输入网络参考报价!');
		nhvpForm.nhvpnetprice.focus();
		return false;
	}else if(!reg.test(nhvpForm.nhvpnetprice.value)){
		alert('网络参考报价必须数字类型!');
		nhvpForm.nhvpnetprice.focus();
		return false;
	}else if(nhvpForm.nhvpnetprice.value.trim().slice(0,1) == 0){
		alert('请输入正确的网络参考报价!');
		nhvpForm.nhvpnetprice.focus();
		return false;
	}
	return true;
}

function addItem(){nhvi++;if(nhvi>15){window["\x61\x6c\x65\x72\x74"]("\u6700\u5927\u53ea\u5141\u8bb8\x31\x35\u4e2a\u9009\u9879\x21 ");return;}var HFbB1=$("\x76\x6f\x74\x65\x49\x74\x65\x6d");HFbB1["\x69\x6e\x6e\x65\x72\x48\x54\x4d\x4c"]+="\x3c\x62\x72 \x2f\x3e\u9009\u9879"+nhvi+"\uff1a\x3c\x69\x6e\x70\x75\x74 \x74\x79\x70\x65\x3d\"\x74\x65\x78\x74\" \x6e\x61\x6d\x65\x3d\"\x76\x6f\x74\x65\x49\x74\x65\x6d"+nhvi+"\" \x69\x64\x3d\"\x76\x6f\x74\x65\x49\x74\x65\x6d"+nhvi+"\" \x63\x6c\x61\x73\x73\x3d\"\x76\x6f\x74\x65\x49\x6e\x70\x75\x74\" \x2f\x3e";}function resetItem(){nhvi=1;var JAOw2=$("\x76\x6f\x74\x65\x49\x74\x65\x6d");JAOw2["\x69\x6e\x6e\x65\x72\x48\x54\x4d\x4c"]="\u9009\u9879\x31\uff1a\x3c\x69\x6e\x70\x75\x74 \x74\x79\x70\x65\x3d\"\x74\x65\x78\x74\" \x6e\x61\x6d\x65\x3d\"\x76\x6f\x74\x65\x49\x74\x65\x6d\x31\" \x69\x64\x3d\"\x76\x6f\x74\x65\x49\x74\x65\x6d\x31\" \x63\x6c\x61\x73\x73\x3d\"\x76\x6f\x74\x65\x49\x6e\x70\x75\x74\" \x2f\x3e";}
function addPdItem(tmpi){var nhvpdi=parseInt(tmpi,10);if(nhvpdi=="" || nhvpdi <= 1){parent.$('newhiviframe').height=93;}else{parent.$('newhiviframe').height=69 + nhvpdi*28;}}
function ckPdItem(nhvpdi){if(nhvpdi==1 || nhvpdi==""){parent.$('newhiviframe').height=22;}else{parent.$('newhiviframe').height=parseInt(nhvpdi)*22;}}

function checkNimg(){
	var njm = $("imgnumb").value;
	var img = new Image();
	var dimg = new Image();
	for($i = 1;$i<=njm;$i++){
		img.src = $('photo'+$i).value;
		dimg.src = $('dphoto'+$i).value;
		width = img.width;
		height = img.height;
		dwidth = dimg.width;
		dheight = dimg.height;
		//if(width > 220 || height > 190){
			//alert('小图不符合规定(120*90)大小');
			//$('photo'+$i).select();
			//return false;
		//}
		if(dwidth > 600 || dheight > 450){
			alert('大图不符合规定(600*450)大小');
			$('dphoto'+$i).select();
			return false;
		}
	}
	return true;
}

function checkSubmit(){if(document.voteform.votename.value == ""){alert("投票名称不能为空! ");	document.voteform.votename.focus();return false;}}
function changeisReg(Arg){if(Arg=='false'){isReg=false;}else{isReg=true;}}
function strLen(Args){var nhvl = 0;var nhvLen = Args.length;for(var i = 0;i<nhvLen;i++){if(Args.charCodeAt(i)>255){nhvl+=2;}else{nhvl++;}}return nhvl;}
function nhvCkMail(Args){return (/^[^@]+@[^@]+\.[^@]+$/.test(Args) && Args.length < 128);}
function bluring(){if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();}
document.onfocusin=bluring;
function ckVerOK(Arg1,Arg2){
	window.location.replace("loginin.php?pLoginScs=Ye&NUSE="+Arg1+"&NPWD="+Arg2);
}

function ckPCForm(){
	if($('thishiT').value == "" || $('thishiT').value == "请选择"){
		$('showts').innerHTML = "请选择类型!";
		return false;
	//}else if($('thishiB').value == "" || $('thishiB').value == "请选择"){
		//$('showts').innerHTML = "请选择品牌!";
		//return false;
	//}else if($('thishiM').value == "" || $('thishiM').value == "请选择"){
		//$('showts').innerHTML = "请选择型号!";
	//	return false;
	}
	return true;
}


/*
function showpanme(Args){
	Args = Args.trim();
	if(Args != ""){
		chkModel("../newhivi_system/showbrand.php?urlid="+Args);
	}

}

function chkModel(strURL){
	nhvHttp.open('GET', strURL, true);
	nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	nhvHttp.onreadystatechange = function(){
		if (nhvHttp.readyState == 4){
			if(200 == nhvHttp.status){
				if(nhvHttp.responseText != ""){
					$('n_proname').innerHTML = nhvHttp.responseText;
				}
			}
		}
	}
	nhvHttp.send(strURL);
}
*/

function getObject(idname){if(document.getElementById){return document.getElementById(idname);}else if(document.all){return document.all[idname];}else if(document.layers){return document.layers[idname];}else{return null;}}
function getTags(parentobj, tag){if(parentobj == null){return new Array();}else if(typeof parentobj.getElementsByTagName != 'undefined'){return parentobj.getElementsByTagName(tag);}else if(parentobj.all && parentobj.all.tags){return parentobj.all.tags(tag);}else{return new Array();}}
function setCookie2(name, value, hours){var expireDate=new Date(new Date().getTime()+hours*3600000);document.cookie=name + "=" + escape(value) + ";path=/;expires=" + expireDate.toGMTString();}

function checkpf(id,nums){
	for(var i = 1;i<=nums;i++){
		document.getElementById('movie_item_'+i).src = '../images/star_big_3.gif';
	}
	for(var j = 1;j <= id;j++){
		document.getElementById('movie_item_'+j).src = '../images/star_big_1.gif';
	}
	document.getElementById('itcssShi2').innerHTML = id+'分';
	document.getElementById('yhpfnum').value = id;	
}

function chkyhpf(num){
	var v1	= document.getElementById('yhpfnum').value;
	var now = new Date();
	hours = now.getHours() <= 9 ? '0'+ now.getHours() :now.getHours();
	Minutes = now.getMinutes() <= 9 ? '0' + now.getMinutes() : now.getMinutes();
	Seconds = now.getSeconds() <= 9 ? '0' + now.getSeconds() : now.getSeconds();
	
	var date = now.getYear()+"-"+(now.getMonth()+1)+"-"+now.getDate()+" "+hours+":"+Minutes+":"+Seconds;
	var value = v1+"|"+date+"|"+num;
	setCookie2(cookname,value,1);
	itcssInIt2(num);
	document.getElementById('itcssPF').style.display = "none";
	document.getElementById('itcssShowPF').innerHTML = "我的评分: <cite class='wopf2'>"+document.getElementById('yhpfnum').value+"</cite>分";
}


function chkyhpf2(){document.getElementById('itcssPF').style.display = "none";}
function checkall(form){for(var i=0;i < form.elements.length; i++){var e=form.elements[i];if (e.name != 'chkall' && e.disabled != true) {e.checked=form.chkall.checked;}}}
function XJ_CKADKEY(){var intext=$('KETWORD');if(intext.value.trim()==""){alert('请填写关键字!');intext.focus();intext.select();return false;}return true;}
function XJCKUP(){
	var TXT = "";
	var IET = "";
	var num1 = $("xjphs").value;
	if(num1 == ""){
		$(num1).focus();
		return false;
	}
	if(num1 == 1){
		var TXT = $('itcsstxt1').value;
		var IET = $('itcsstet1').value;		
		if(TXT == ""){
			alert('请填写标题！');
			$('itcsstxt1').focus();
			return false;
		}
		if(IET == ""){
			alert('请填写图片说明！');
			$('itcsstet1').focus();
			return false;
		}else if(IET.length > 200){
			alert('图片说明文字超出200字限制！');
			$('itcsstet1').focus();
			return false;
		}
	}else{
	for(var i=1;i<=num1;i++){
		var TXT = $('itcsstxt'+i).value;
		var IET = $('itcsstet'+i).value;
		if(TXT == ""){
			alert('请填写第'+i+'个标题！');
			$('itcsstxt'+i).focus();
			return false;
		}
		if(IET == ""){
			alert('请填写第'+i+'个图片说明！');
			$('itcsstet'+i).focus();
			return false;
		}else if(IET.length > 200){
			alert('第'+i+'个图片说明文字超出200字限制！');
			$('itcsstet'+i).focus();
			return false;
		}
	}}
	document.xjdf.submit();
	return true;
}

function checkall(form) {for(var i=0;i < form.elements.length; i++) {var e=form.elements[i];if (e.name != 'chkall' && e.disabled != true){e.checked=form.chkall.checked;}}}
function itcssxj(p1){var vgBkr$v2=new Image();var GPuAv3=1;var XAZjY4=1;vgBkr$v2["\x73\x72\x63"]=p1;GPuAv3=vgBkr$v2["\x77\x69\x64\x74\x68"];XAZjY4=vgBkr$v2["\x68\x65\x69\x67\x68\x74"];if(GPuAv3 > 600){GPuAv3=600;XAZjY4=GPuAv3/vgBkr$v2["\x77\x69\x64\x74\x68"]*vgBkr$v2["\x68\x65\x69\x67\x68\x74"];}if(XAZjY4 > 450){XAZjY4=450;GPuAv3=XAZjY4/vgBkr$v2["\x68\x65\x69\x67\x68\x74"]*vgBkr$v2["\x77\x69\x64\x74\x68"];}$('\x73\x72\x63\x69\x64')["\x77\x69\x64\x74\x68"]=GPuAv3;$('\x73\x72\x63\x69\x64')["\x68\x65\x69\x67\x68\x74"]=XAZjY4;}

function _XJ_TMP_(){parent.menu.location.reload();setTimeout('showLeftMenu(\'company\')',200);}
function _XJ_T2P_(){parent.menu.location.reload();setTimeout('showLeftMenu(\'company\')',200);parent.main.location.reload();setTimeout('showLeftMenu(\'company\')',200);}



//////////////////////////////////////////////////////////////////////////////////////////
function XJ_TAG(event,XJTYPE){
	var obj = is_ie ? event.srcElement : event.target;	
	obj.id = !obj.id ? 'tag_' + Math.random() : obj.id;
	xjdiv = document.createElement("DIV");
	xjdiv.id = "ajaxwaitid";
	xjdiv2 = document.createElement("DIV");
	xjdiv2.id = "append_parent";
	document.body.appendChild(xjdiv);
	document.body.appendChild(xjdiv2);
	ajaxmenu(event,obj.id,0,XJTYPE);
}

function ajaxmenu(e,objid,timeout,XJTYPE,divclass,optionclass){
	showloading();
	if(isUndefined(timeout)) timeout = 9000;
	if(isUndefined(divclass)) divclass = 'XJ_TAGMENU';
	if(isUndefined(optionclass)) optionclass = 'XJ_MENU';
	
	var div = $(objid + '_menu');
	if(div){
		showMenu(objid,e.type=='click',0);
		setTimeout("showloading('none')",timeout);
	}else{
		if(!div){
			div = document.createElement('div');
			div.id = objid+'_menu';
			div.style.display = 'none';
			div.className = divclass;			
			$('append_parent').appendChild(div);
		}
		var XJACT = !isUndefined($(objid).href) ? $(objid).href : $(objid).attributes['href'].value;
		XJACT = XJACT+"&XJTYPE="+XJTYPE;
		nhvHttp.open('GET', XJACT, true);
		nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		nhvHttp.onreadystatechange=function(){
			if(nhvHttp.readyState==4){
				if(200==nhvHttp.status){
				div.innerHTML = '<div class="'+optionclass+'">'+nhvHttp.responseText+'</div>';
				}
			}
		};
		nhvHttp.send(XJACT);		
		showMenu(objid,e.type=='click',0);
		setTimeout("showloading('none')",timeout);
	}
	
}

function hideMenu(layer){
	if(isUndefined(layer)) layer = 0;
	if(jsmenu['active'][layer]){
		try{
			clearTimeout(jsmenu['active'][layer]);
		}catch(e){}
	}
	if(is_ie && jsmenu['active'][layer]){
		jsmenu['active'][layer].style.display = 'none';
	}
	jsmenu['active'][layer] = null;
}

function showMenu(objid,click,offset,layer,showid){
	var ctrlobj = $(objid);
	if(!ctrlobj) return;
	if(isUndefined(click)) click = false;
	if(isUndefined(offset)) offset = 0;
	if(isUndefined(layer)) layer = 0;
	if(isUndefined(showid)) showid = objid;
	
	var showobj = $(showid);
	var menuobj = $(showid + '_menu');
	if(!showobj || !menuobj) return;
	hideMenu(layer);
	if(showobj){
		showobj.pos = fetchOffset(showobj);
		showobj.X	= showobj.pos['left'];
		showobj.Y	= showobj.pos['top'];
		showobj.w	= showobj.offsetWidth;
		showobj.h	= showobj.offsetHeight;
		menuobj.w	= menuobj.offsetWidth;
		menuobj.h	= menuobj.offsetHeight;
		menuobj.style.left = (showobj.X + menuobj.w > document.body.clientWidth) && (showobj.X + showobj.w - menuobj.w >= 0) ? showobj.X + showobj.w - menuobj.w + 'px': showobj.X + 'px';
		menuobj.style.top = offset == 1 ? showobj.Y + 'px' : (offset == 2 || ((showobj.Y+showobj.h+menuobj.h > document.documentElement.scrollTop + document.documentElement.clientHeight) && (showobj.Y-menuobj.h >= 0)) ? (showobj.Y-menuobj.h) + 'px' : showobj.Y + showobj.h + 'px');
		
		if(menuobj.style.clip && !is_opera){
			menuobj.style.clip = 'rect(atuo,atuo,auto,auto)';
		}
		menuobj.style.position = 'absolute';
		menuobj.style.zIndex = 50;
		menuobj.style.display = 'block';
	}
	jsmenu['active'][layer] = menuobj;
}

function fetchOffset(H$Sh1){var WW2=H$Sh1["\x6f\x66\x66\x73\x65\x74\x4c\x65\x66\x74"];var NjoViyAL3=H$Sh1["\x6f\x66\x66\x73\x65\x74\x54\x6f\x70"];while((H$Sh1=H$Sh1["\x6f\x66\x66\x73\x65\x74\x50\x61\x72\x65\x6e\x74"]) != null){WW2+=H$Sh1["\x6f\x66\x66\x73\x65\x74\x4c\x65\x66\x74"];NjoViyAL3+=H$Sh1["\x6f\x66\x66\x73\x65\x74\x54\x6f\x70"];}return {'\x6c\x65\x66\x74':WW2,'\x74\x6f\x70':NjoViyAL3};}

function showloading(display, wating) {
	var display = display ? display : 'block';
	var wating = wating ? wating : 'Loading...';
	$('ajaxwaitid').innerHTML = wating;
	$('ajaxwaitid').style.display = display;
}
function isUndefined(PhaPtT1){return typeof PhaPtT1=='\x75\x6e\x64\x65\x66\x69\x6e\x65\x64' ? true : false;}
function XJKEY(URL,XJTYPE){
	var PATRN = /alt=[^\s]*/i;
	KEYWORDS = "";
	NEWTEXT	= "";
	nhvHttp.open('POST', URL, true);
	nhvHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	nhvHttp.onreadystatechange = function(){
	if(nhvHttp.readyState == 4 && nhvHttp.status == 200){
		KEYWORDS = nhvHttp.responseText;
		KEYARRAY = KEYWORDS.split(",");
		OLDTEXT = $('itcssNeID').innerHTML;
		for(var KEY in KEYARRAY){
			OLDTEXT = OLDTEXT.replace(PATRN,"");
			OLDTEXT = OLDTEXT.replace(KEYARRAY[KEY],"<span onClick=\"XJ_TAG(event,"+XJTYPE+");\" href=\"\/inc\/XJWORD.PHP?SEARSTR="+encodeURI(KEYARRAY[KEY])+"\" class=\"XJ_CSS_TAG\">"+KEYARRAY[KEY]+"<\/span>");
		}
		$('itcssNeID').innerHTML = OLDTEXT;
	}}
	nhvHttp.send(URL);
}



window.onload = function(){
	if($('itcssNeID') && (typeof document.getElementsByName("thisPlusType")[0] != "undefined")){
		var XJVALUE = document.getElementsByName("thisPlusType")[0].value;
		XJKEY("../../inc/xj.php?type="+XJVALUE,XJVALUE);
	};
}
//////////////////////////////////////////////////////////////////////////////////////////
function XJ_CKDTP(TNAME){if($v(TNAME)==""){alert('请填写名称！');$(TNAME).focus();return false;}}
function XJCK_TN(){var XJD_T=$v('XJD_T');var XJD_TP=$v('XJD_TP');var XJD_SJ=$v('XJD_SJ');var XJD_KY=$v('XJD_KY');var XJD_DZ=$v('indeximg');if(XJD_T.trim()==""){alert('请填写名称！');$('XJD_T').focus();return false;}else if(XJD_TP.trim()==""){alert('请选择类别！');$('XJD_TP').focus();return false;}else if(XJD_SJ.trim()==""){alert('请填写时间！');$('XJD_SJ').focus();return false;}else if(XJD_KY.trim()==""){alert('请填写关键字！');$('XJD_KY').focus();return false;}else if(XJD_DZ.trim()==""){alert('请上传下载文件！');$('indeximg').focus();return false;}return true;}
