﻿<!--
var operate = SystemAbsolutPath + "ajaxoperate.asp";

function showajaxwin(url, width) {
	var x = new Ajax('statusid', 'XML');
	x.get(url, function(s) {
		if($("ajaxdiv")) {
			var divElement = $("ajaxdiv");
		} else {
			var divElement = document.createElement("DIV");
			divElement.id = "ajaxdiv";
			divElement.className = "ajaxwin";
			document.body.appendChild(divElement);
		}
		divElement.style.cssText = "width:"+width+"px;";
		//var userAgent = navigator.userAgent.toLowerCase();
		//var is_opera = (userAgent.indexOf('opera') != -1);
		var clientHeight = scrollTop = 0; 
		if(browser.opera) {
			clientHeight = document.body.clientHeight /2;
			scrollTop = document.body.scrollTop;
		} else {
			clientHeight = document.documentElement.clientHeight /2;
			scrollTop = document.documentElement.scrollTop;
		}
		divElement.innerHTML = s.lastChild.firstChild.nodeValue;
		divElement.style.left = (document.documentElement.clientWidth /2 +document.documentElement.scrollLeft - width/2)+"px";
		divElement.style.top = (clientHeight +　scrollTop - divElement.clientHeight/2)+"px";
		if ($('imgValidateCode')) {$('imgValidateCode').src = SystemAbsolutPath + "common/VerifyCode.asp?"+ Math.round(Math.random() * 10000).toString();}
	});	
}

/*删除房源*/
function delhouse(itemid) {
	var x = new Ajax('statusid', 'XML');
	x.get(operate+'?'+ randomUrl()+'&cmd=delhouse&itemid='+itemid, function(s) {
		var text = s.lastChild.firstChild.nodeValue;
		if (text.indexOf(":") != -1) {
			$("myhouse_" + itemid).style.display = "none";
			$("recCounts").innerHTML = parseInt($("recCounts").innerHTML) - 1;
			var arr = text.split(":");
			alert(arr[1]);
		}	else {
			alert(text);
		}
	});
}	

/*验证邮箱(修改资料)*/
function isvalidEmail(e) {
	var result = e.value;
	if (trim(result) != "") {
		var x = new Ajax('statusid', 'XML');
		x.get(operate+'?'+ randomUrl()+'&cmd=validemail&value='+encodeURIComponent(result), function(s) {
			var text = s.lastChild.firstChild.nodeValue;
			if (text.indexOf(":") != -1) {
				var state = text.substr(0,1);
				if (state != "1") {alert(text.substr(2));}
			}	else {
				alert(text);
			}	
		});
	}	
}

/*短消息内容*/
function msgDetail(itemid) {
	var _row = $("msgRow_" + itemid);
	var _cell = $("showMsgCell_" + itemid);
	var param
	if (browser.msie) {param = "block"} else {param = "table-row"}		/*mozilla必须使用table-row*/
	if (_row.style.display == param) {
		_row.style.display = "none";
	} else {
		_row.style.display = param;
		_cell.className = "msgcontents";
		if (_cell.innerHTML == "") {
			var x = new Ajax('statusid', 'XML');
			x.get(operate+'?'+ randomUrl()+'&cmd=getmsg&itemid='+itemid, function(s) {
				var text = s.lastChild.firstChild.nodeValue;
				if (text.indexOf("|:|") != -1) {
					var arr = text.split("|:|");
					if (arr[0] == "Error") {
						alert(arr[1]);
					} else if (arr[0] != "") {
						echo($("msgstate_"+ itemid) ,"&nbsp;");
						echo($("msgs"),arr[0]);
						echo(_cell,arr[1]);	
					}	
				}	else {
					echo(_cell,text);	
				}	
			});
		}
	}	
}

/*删除短消息*/
function delmsg(itemid) {
	var x = new Ajax('statusid', 'XML');
	x.get(operate+'?'+ randomUrl()+'&cmd=delmsg&itemid='+itemid, function(s) {
		var text = s.lastChild.firstChild.nodeValue;
		if (text.indexOf(":") != -1) {
			$("msg_" + itemid).style.display = "none";
			$("msgRow_" + itemid).style.display = "none";
			$("recCounts").innerHTML = parseInt($("recCounts").innerHTML) - 1;
			var arr = text.split(":");
			echo($("msgs"),arr[0]);
			alert(arr[1]);
		}	else {
			alert(text);
		}
	});
}

/*服务评价*/
function PJpost(itemid, items) {
	//alert(submitPJ);return false;
	if (getCookie(PJCookiesName)) {
		alert('友情提示：\n您已经对该经纪人进行过服务评价！');
		return false;
	} else {
		if (!confirm("确定需要对该经纪人进行服务评价？")) {
			return false;
		} else {
			var x = new Ajax('statusid', 'XML');
			x.get(operate+'?'+ randomUrl()+'&cmd=pjpost&itemid='+itemid+'&items='+encodeURIComponent(items), function(s) {
				var text = s.lastChild.firstChild.nodeValue;
				if (text.indexOf(":") != -1) {
					var arr = text.split(":");
					echo($(items+"_num"),arr[0]);
					alert(arr[1]);
				} else {
					alert(text);
					return false;
				}			
			});	
			setCookie(PJCookiesName,true);	
		}	
	}
}
-->