//check user login
function chkmoney(){
	var myvalue=frmMoney.txtmoney.value;
	var myid=frmMoney.txtuserid.value;
	myvalue=parseInt(myvalue);
	myid=parseInt(myid);
	if (myid==0){
		window.alert('对不起,未登陆用户不能兑换！');
		return false;
	}
	else{
		frmMoney.action='jsdh.asp';
		frmMoney.submit();
	}
}
function hiddendiv(){
	var mydiv=document.getElementById('hideform')
	if(frmReg.txtUserType[0].checked){
		mydiv.innerHTML='';
	}else{
		executeQuery('hideform','companyform','');
	}
	return true;
}
function selectDate(objname,datevalue){
	window.open('getDate.asp?objectName='+objname+'&ReqDate='+datevalue,'','width=310,height=200');
}

function makeDate(objname,datevalue){
	var tmpobj=getObject(objname);
	tmpobj.value=datevalue;
	return true;
}

function getObject(objIdName){
	var n=document.getElementById(objIdName);
	return n;
}

function changeExchange(shopIndex){
	var shopArr=new Array(2000,500,100,20,18,15);
	var exchangevalue=parseInt(frmShop.txtexchange.value);
	if (frmShop.txtuserid.value=='0'){
		window.alert('对不起,未登陆用户不能兑换！');
		return false;
	}else if ((parseInt(frmShop.txtmoney.value)*10)<exchangevalue){
		window.alert('对不起，您的金沙不够，不能兑换礼品！');
		return false;
	}
	else if (exchangevalue<shopArr[shopIndex]){
		window.alert('对不起，您的礼金不够，不能兑换当前礼品！');
		return false;
	}else{
		frmShop.txtindex.value=shopIndex;
		frmShop.action='lpdh_second.asp';
		//window.alert('对不起，暂时关闭');
		frmShop.submit();
		return true;
		var temphtml;
		if (shopIndex<3){
			temphtml = '联系电话：<input name="txtaddress" value="">';
		}else{
			temphtml = '联系地址<textarea name="txtaddress" cols=25 rows=5></textarea>';
		}
		temphtml = temphtml + '<input value="兑换" type="button" onclick="checkExchange(' + shopIndex + ');">';
		var tmpobj=getObject('addressDiv');
		tmpobj.innerHTML=temphtml;
		//frmShop.submit();
		return true;
	}
}

function checkExchange(shopIndex){
	if (frmShop.txtname.value==''){
		window.alert('对不起，您一定要输入姓名');
		frmShop.txtname.focus();
		return false;
		
	}else if (frmShop.txtaddress.value==''){
		window.alert('对不起，您一定要输入地址');
		frmShop.txtaddress.focus();
		return false;
		
	}else if (frmShop.txtzip.value==''){
		window.alert('对不起，您一定要输入邮编');
		frmShop.txtzip.focus();
		return false;
		
	}else if (frmShop.txtphone.value==''){
		window.alert('对不起，您一定要输入联系电话');
		frmShop.txtphone.focus();
		return false;
		
	}else if (frmShop.txtidcard.value==''){
		window.alert('对不起，您一定要输入身份证号码');
		frmShop.txtidcard.focus();
		return false;
	}else{
		frmShop.action='lpdh.asp';
		frmShop.submit();
		return true;
	}
}

function startfinduser(divname,pagestr,sql,msg){
	var tmpobj=getObject(divname);
	tmpobj.innerHTML = msg;
	//alert(divname + ',' + pagestr + ',' + sql);
	executeQuery(divname,pagestr,sql);
	return true;
}