﻿//查询操作，如输入信息，失去光标，查询框显? message?
function pp_writeOrighValueForQuery(queryObj, msg) {
	if (queryObj) {
		if (queryObj.value == "") {
			queryObj.value = msg;
		}
	}
}

//obj的值为空，则将msg赋给obj.value?
//若obj的值等于msg，则将obj.value制空?
//适合查询：选中输入框?
function pp_setSepecialObjValues(obj, msg) {
	if (obj.value == "") {
		obj.value = msg;
	} else {
		if (pp_isStrEqual(obj.value, msg)) {
			obj.value = "";
		}
	}
}
//字符串相等判断?
function pp_isStrEqual(firstStr, secondeStr) {
	return firstStr == secondeStr;
}

// 增加点击数
function sp_addHit(_nObjType, _nObjId) {
		var response = co_sendXMLHttpRequest('../common/AddHit.service?objType=' + _nObjType + '&objId=' + _nObjId, "post", null);
}


//增加详细页面点击数
function sp_addDFHit(_nObjType,_nHostType, _nObjId,_nName) {// 20000,对象类型，对象id，用户名
		var response = co_sendXMLHttpRequest('../common/addDFTotalHitsServlet.service?objType=' + _nObjType +'&hostType='+_nHostType+ '&objId=' + _nObjId+'&name='+_nName, "post", null);
}
//试穿数统计
function sp_addTTHit(_nObjType,_nHostType, _nObjId,_nName){// 20000,对象类型，对象id，用户名
	var response = co_sendXMLHttpRequest('../common/addTTTotalHitsServlet.service?objType=' + _nObjType +'&hostType='+_nHostType+ '&objId=' + _nObjId+'&name='+_nName, "post", null);
}

/* BEGIN: 统计从saas到卖家宝贝页的流量*/
function sendRequest(_nId,_nBaomingId,_nVisitorId,_sRoomName) {
	try {
		var response = co_sendXMLHttpRequest("../stc/ProductStcServlet.service?id=" + _nId + "&baoMingId=" + _nBaomingId + "&visitorId=" + _nVisitorId + "&roomName=" +_sRoomName , "POST",null);
	} catch(ex) {
		alert(ex.toSource());
	};
}

/**
 * 从URL中查询参数_sParamName的值
 * 
 * @param _sParamName:
 *            参数名称
 */
function sd_queryString(_sParamName) {
	var LocString = String(window.document.location.href);
	var rs = new RegExp("(^|)" + _sParamName + "=([^\&]*)(\&|$)", "gi")
			.exec(LocString), tmp;
	if (tmp = rs)
		return tmp[2];
	return null;
}
/* BEGIN: 统计从saas宝贝的试穿的流量 记录每天的试穿次数*/
function sf_sendDressupRequest(_nProductId,_sProductName,_sProductUrl,_sRoomName) {
	try {
		var response = co_sendXMLHttpRequest("../stc/DressupStcServlet.service?id=" + _nProductId + "&productName=" + _sProductName + "&productUrl=" + _sProductUrl + "&roomName=" +_sRoomName , "POST",null);
	} catch(ex) {
		alert(ex.toSource());
	};
}


