function Trim(s){var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);return (m == null)?"":m[1];}
function gid(id){return document.getElementById?document.getElementById(id):null;}
function gna(id){return document.getElementsByName?document.getElementsByName(id):null;}
function gname(name){return document.getElementsByTagName?document.getElementsByTagName(name):new Array()}
function Browser(){var ua, s, i;this.isIE = false;this.isNS = false;this.isOP = false;this.isSF = false;ua = navigator.userAgent.toLowerCase();s = "opera";if ((i = ua.indexOf(s)) >= 0){this.isOP = true;return;}s = "msie";if ((i = ua.indexOf(s)) >= 0) {this.isIE = true;return;}s = "netscape6/";if ((i = ua.indexOf(s)) >= 0) {this.isNS = true;return;}s = "gecko";if ((i = ua.indexOf(s)) >= 0) {this.isNS = true;return;}s = "safari";if ((i = ua.indexOf(s)) >= 0) {this.isSF = true;return;}}
function ScreenConvert()
{
	var browser = new Browser();
	var objScreen = gid("ScreenOver");
	if(!objScreen) var objScreen = document.createElement("div");
	var oS = objScreen.style;
	objScreen.id = "ScreenOver";
	oS.display = "block";
	oS.top = oS.left = oS.margin = oS.padding = "0px";
	if(document.body.scrollHeight)
	{
		var wh = document.body.scrollHeight + "px";
	}
	if (document.body.clientHeight) 
	{
		var wh = document.body.clientHeight + "px";
	}
	else if (window.innerHeight)
	{
		var wh = window.innerHeight + "px";
	}
	else
	{
		var wh = "100%";
	}
	oS.width = "100%";
	oS.height = wh;
	oS.position = "absolute";
	oS.zIndex = "3";
	if ((!browser.isSF) && (!browser.isOP))
	{
		oS.background = "#cccccc";
	}
	else
	{
		oS.background = "#cccccc";
	}
	oS.filter = "alpha(opacity=40)";
	oS.opacity = 40/100;
	oS.MozOpacity = 40/100;
	document.body.appendChild(objScreen);
	}
function ScreenClean(){var objScreen = gid("ScreenOver");if (objScreen) objScreen.style.display = "none";var allselect = gname("select");for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "visible";}
var t_DiglogX,t_DiglogY,t_DiglogW,t_DiglogH;
function DialogLoc(){var dde = document.documentElement;if (window.innerWidth){var ww = window.innerWidth;var wh = window.innerHeight;var bgX = window.pageXOffset;var bgY = window.pageYOffset;}else{var ww = dde.offsetWidth;var wh = dde.offsetHeight;var bgX = dde.scrollLeft;var bgY = dde.scrollTop;}t_DiglogX = (bgX + ((ww - t_DiglogW)/2));t_DiglogY = (bgY + ((wh - t_DiglogH)/2));}
function DialogShow(showdata,ow,oh,w,h){var objDialog = gid("DialogMove");if (!objDialog) objDialog = document.createElement("div");t_DiglogW = ow;t_DiglogH = oh;DialogLoc();objDialog.id = "DialogMove";var oS = objDialog.style;oS.display = "block";oS.top = t_DiglogY + "px";oS.left = t_DiglogX + "px";oS.margin = "0px";oS.padding = "0px";oS.width = w + "px";oS.height = h + "px";oS.position = "absolute";oS.zIndex = "5";oS.background = "#FFF";oS.border = "solid #000 1px";objDialog.innerHTML = showdata;document.body.appendChild(objDialog);}
function DialogHide(){ScreenClean();var objDialog = gid("DialogMove");if (objDialog) objDialog.style.display = "none";}
function OpenNewWindow(u, i, w, h, r, s, t){var t = 20;var l = 120;if (window.screen.height) t = (window.screen.height - h) / 2;if (window.screen.width) l = (window.screen.width - w) / 2;var win = window.open(u, i, "width=" + w + ",height=" + h + ",resizable=" + (r?"yes":"no") + ",scrollbars=" + (s?"yes":"no") + ",status=" + (t?"1":"0") + ", top=" + t + ", left=" + l);if (win) win.focus();return win;}
//举报
function Report(Type,ID)
{
	var uid = GetCookie(strUIdCookie);
	if(uid == null)
	{
		uid = -1;
		alert("您还没有登录无法举报或报错，请先登录");
		return ;
	}
  ScreenConvert();
  uid = '"' + uid + '"';
  var strDivHtml = "<div class='round_msg_input_item_div1' id='DialogTitle'>" +
  			"<div class='round_msg_input_item_div1_li1' id='DialogTitleText'>举报和报错</div>" +
  		"</div>" +
  		"<div ><textarea cols='50' rows='8' name='txtErrorMessage' id='txtErrorMessage'></textarea></div>" +
        " <div class='round_msg_input_item_div1'>" +
        "<div class='round_msg_input_item_div1_li114'>" +
        "	<button id='ReportOK' onclick='return ReportOK(" + uid + "," + Type + "," + ID + ");'>提交</button>&nbsp;&nbsp;&nbsp;&nbsp;<button id='ReportCancle' onclick='return DialogHide();'>取消</button>" +
        "</div>" +
        "</div>" +
        "<div class='clear_both'>&nbsp;</div> ";
  

  DialogShow(strDivHtml,400,300,450,300);
}

function ReportOK(UId,Type,ID)
{
	var strMessage = Trim(document.getElementById('txtErrorMessage').value);
	if (strMessage.length < 5 || strMessage.length > 500)
	{
		alert('举报和报错的长度应为5-500个字符');
		document.getElementById('txtErrorMessage').focus();
		return false;
	}
	var myShopError = new ShopError(UId,Type,ID,strMessage);
	myShopError.setError();
}

////////////////////////////////////////////////////////////////////////////////////////
function ShopError(UId,ItemType,ItemId,Message) {
	this.UId = UId;
	this.ItemType = ItemType;
	this.ItemId = ItemId;
	this.Message = Message; 
	this.setError = function ()
	{
		var strURL = window.location.protocol + "//" + window.location.host + 
				"/_20module/outing/shops_error_add_post.php";
		ajax_post(strURL, 
			this.toJSONString(), this.setCallback);
	}
	
	this.setCallback = function(responseText)
	{
		var objResult = responseText.parseJSON();
		if (objResult)
		{
			alert (objResult.desc);
			if(objResult.no > 0)
			{
				DialogHide();
			}
		}
	}
}

////////////////////////////////////////////////////////////////////////////////////////

//举报
function Guzhang(pid)
{
	var uid = GetCookie(strUIdCookie);
	if(uid == null)
	{
		uid = -1;
		alert("您还没有登录无法举报或报错，请先登录");
		return ;
	}
  ScreenConvert();
  //uid = '"' + uid + '"';
  var strDivHtml = "<div id='guzhang001'  style='width:200px; height:150px; margin-top: 0; margin-right: auto; margin-bottom: 0; margin-left: auto;'>" +
        "<form method='POST' action='/gootrip/_20module/eating/shops_list_detail_pic_post.php' target='upost'><table width='100%' border='0' cellpadding='0' cellspacing='0' style='background-color:#eeeeee;'>" +
        "<tr>" +
        "<td height='36'><span style='padding-left:20px; color:#cc0202; font-weight:bold; line-height:20px;'>来点掌声吧</span></td>" +
        "<td width='30' align='center'><img  onclick='return DialogHide();' src='/gootrip/_20images/food/zt2.gif' width='20' height='20' /></td>" +
        "</tr>" +
        "</table>" +
        "<table width='70%' border='0' align='center' cellpadding='0' cellspacing='0' style='margin-top:10px'>" +
        "<tr>" +
        "<td width='16%' height='30'><input type='hidden' name='pid' value='"+pid+"'><input type='hidden' name='uid' value='"+uid+"'>" +
        "<label><input type='radio' name='flower' value='1' id='RadioGroup1_0' /></label></td>" +
        "<td width='24%'><img src='/gootrip/_20images/food/hand_ico_03.gif' width='29' height='27' /></td>" +
        "<td width='60%'>呱唧呱唧</td>" +
        "</tr>" +
        "<tr>" +
        "<td height='30'> <label><input type='radio' name='flower' value='-1' id='RadioGroup1_1' /></label></td>" +
        "<td><img src='/gootrip/_20images/food/hand_ico_06.gif' width='29' height='27' /></td>" +
        "<td>鼓倒掌</td>" +
        "</tr>" +
        "</table>" +
        "<table width='85%' height='30' border='0' align='center' cellpadding='0' cellspacing='0'>" +
        "<tr>" +
        "<td height='40' align='center'><table width='60%' border='0' cellspacing='0' cellpadding='0'>" +
        "<tr>" +
        "<td align='center'><input type='submit' name='button' id='button' value='提交' /></td>" +
        "<td align='center'><input type='button' name='button2'  onclick='return DialogHide();' id='button2' value='取消' /></td>" +
        "</tr></table></td>  </tr></table></form></div> ";
  

  DialogShow(strDivHtml,300,200,200,150);
}
