﻿/* Javascript Document 
 .....................................................................................
 .. www.jingqu.cn V 3.2.1 Public Javascript	for lijiang         	    	  		    ..
 ..	说明：忽略所有javascript 错误                                                     ..
 ..	设计：xyb www.ectrip.com Design Time: 2008.10.23 Edit Time: 2009.07.27           ..
......................................................................................*/
//隐藏错误
var mainTitle = "黄果树旅游电子商务平台";
var errTitle = mainTitle + "温馨提示您：";
var online = new Array(); //QQ online
var endHours = 15;

var errImgErr = "<img src=\'/images/li_err.gif\' id='\li_err\' align=\'absmiddle\'  height=\'16\'/>";
var errImgOk = "<img src=\'/images/li_ok.gif\' id='\li_ok\' align=\'absmiddle\' height=\'16\'/>";

/*function killErrors() {
  return true; 
}
window.onerror = killErrors;*/

function getDiv(divid) {
	return document.getElementById(divid);
}

function MM_swapImgRestore() { //v3.0
	var i, x, a = document.MM_sr;
	for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}
function MM_swapImage() { //v3.0
	var i, j = 0,
	x, a = MM_swapImage.arguments;
	document.MM_sr = new Array;
	for (i = 0; i < (a.length - 2); i += 3) if ((x = MM_findObj(a[i])) != null) {
		document.MM_sr[j++] = x;
		if (!x.oSrc) {
			x.oSrc = x.src;
		}
		x.src = a[i + 2];
	}
}
function MM_findObj(n, d) { //v4.01
	var p, i, x;
	if (!d) {
		d = document;
	}
	if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
		d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0, p);
	}
	if (! (x = d[n]) && d.all) {
		x = d.all[n];
	}
	for (i = 0; ! x && i < d.forms.length; i++) {
		x = d.forms[i][n];
		for (i = 0; ! x && d.layers && i < d.layers.length; i++) {
			x = MM_findObj(n, d.layers[i].document);
		}
		if (!x && d.getElementById) {
			x = d.getElementById(n);
		}
		return x;
	}
}

//浏览器
function localUrl(mode) {
	var mode = mode || 'href';
	var l = window.location;
	var lPath = l.pathname.toString() + l.search.toString();
	lPath = lPath.indexOf("/user/") != -1 ? "/": lPath;
	switch (mode) {
	case 'href':
	case 'host':
	case 'hash':
		return eval("window.location." + mode);
		break;
	case 'root':
		// return l.protocol + "//" + l.host + ":" + l.port;
		break;
	case 'path':
		return {
            "uncode":
            encodeURI(lPath),
            "code": encodeURIComponent(lPath)
        };
		break;
	}
}

function strDate(str) {
	var tempdate = new Date();
	var datearray = str.split("-");
	var yearstr = parseInt(datearray[0], 10);
	var monthstr = parseInt(datearray[1], 10);
	var datestr = parseInt(datearray[2], 10);

	//alert(yearstr+"monthstr"+monthstr+"datestr"+datestr);

	/*	tempdate.setUTCFullYear(yearstr);
	tempdate.setUTCMonth(monthstr-1);
	tempdate.setUTCDate(datestr);*/

	//alert("tempdate:"+tempdate+"\nnew Date:"+new Date(yearstr, monthstr-1, datestr));

	//return tempdate;
	return new Date(yearstr, monthstr - 1, datestr, tempdate.getHours(), tempdate.getMinutes(), tempdate.getSeconds());
}

function setHomepage() {
	var homeUrl = localUrl();
	if (document.all) {
		document.body.style.behavior = 'url(#default#homepage)';
		document.body.setHomePage(homeUrl);

	} else if (window.sidebar) {
		if (window.netscape) {
			try {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
				prefs.setCharPref('browser.startup.homepage', homeUrl);
			} catch(e) {
				alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
			}
		}

	}

}

function bookmark(url, title) {
	var title = title || document.title;
	var url = url || document.location.href;

	if (window.sidebar) window.sidebar.addPanel(title, url, "");
	else if (window.opera && window.print) {
		var mbm = document.createElement('a');
		mbm.setAttribute('rel', 'sidebar');
		mbm.setAttribute('href', url);
		mbm.setAttribute('title', title);
		mbm.click();
	} else if (document.all) window.external.AddFavorite(url, title);
}

//浏览器客户端属性
var getBrowser = function(mode) {
	var mode = mode || 1;
	var agt = navigator.userAgent.toLowerCase();
	var data = 'agt=' + escape(agt) + '&r=' + escape(document.referrer) + '&aN=' + escape(navigator.appName) + '&lg=' + escape(navigator.systemLanguage) + '&OS=' + escape(navigator.platform) + '&aV=' + escape(navigator.appVersion) + '&ntime=0.34535600 1225763187&showp=' + escape(screen.width + 'x' + screen.height);
	switch (mode) {
	case 9:
		return data;
		break;
	default:
		return data;
		break;
	}
}

function randomNumber(limit) {
	return Math.floor(Math.random() * limit + 1);
}

function tabs(tabsId, j) {
	var tab = tabsId.find(".tabs");
	tab.hide();
	tab.eq(j).show();
}

function priceInt() { //保留整数
	var priceIntArry = $("span.priceInt");
	for (var t = 0; t < priceIntArry.length; t++) if (!isNaN(parseInt(priceIntArry.eq(t).text()))) priceIntArry.eq(t).text(parseInt(priceIntArry.eq(t).text()).toString());
}

function openwin(url, wid, hei, reload) {
	var str;
	if (url == null) {
		alert('您的URL不能为空!');
		return;
	}

	if (wid == null || wid == '') {
		wid = 450;
	}
	if (hei == null || hei == '') {
		hei = 360;
	}

	str = window.showModalDialog('/system/openwin.html', url, 'dialogWidth:' + wid + 'px;dialogHeight:' + hei + 'px;status:no;scrollbars=no;help:0;center:1');
	if (reload == true && str != "login" && str != "no" && eval("typeof(" + str + ")") != 'undefined') {
		location.reload();
	}
	if (str == "login") {
		top.window.location.replace("/user/UserLogin.jsp?url=" + DeleteDomain(top.window.location));
	}
	return str;
}

function closewindow() {
	window.close();
}
function gotoS(LocationUrl) {
	if (LocationUrl == "/") {
		window.location = "/index.html";
	} else {
		window.location = LocationUrl;
	}
}

function gotoP(LocationUrl, type) {
	if (LocationUrl == "/") {
		LocationUrl = "/index.html";
	}

	if (typeof type == "undefined") {
		top.window.location.replace(LocationUrl);
	} else {
		self.window.location.replace(LocationUrl);
	}
}

function MM_openBrWindow(theURL, winName, features) { //v2.0
	window.open(theURL, winName, features);
}

function gotoN(LocationUrl) {
	MM_openBrWindow(LocationUrl, 'windows_' + randomNumber(10000), 'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
}
function goback() {
	window.history.back();
}

//添加提交信息
function _subSub(id, info, classType, jQNo) {

	if (typeof jQNo != "undefined") {
		if (jQNo == 1) {
			$ = jQuery;
		}
	}

	if ($("#main_errors") && id != "#main_errors") {
		$("#main_errors").hide()
	};
	//if (id!="main_errors"){
	if (typeof classType == "undefined") {
		$(id).addClass("submitInfo");
	}

	if (typeof classType != "undefined") { //不添加样式
		if (classType != 0) { //不添加样式
			$(id).addClass(classType);
		}
	}

	$(id).show();
	//$(id).css("color","#669900");
	//}
	if (typeof info == "undefined") {
		info = "数据提交中";
	} else if (info == "" || info == null) {
		info = "数据提交中";
	} else if (info == "loading") {
		info = "加载中";
	}

	$(id).html("<img src=\"/images/loading.gif\" alt=\"loading\" width=\"16\" height=\"16\" align=\"absmiddle\" class=\"user\" />&nbsp;&nbsp;" + info + "......");

	setTimeout(function() {
		if ($(id).html().indexOf("数据提交中") != -1 || $(id).html().indexOf(info) != -1) {
			$(id).html("<img src=\"/images/li_err.gif\" alt=\"loading\" width=\"16\" height=\"16\" align=\"absmiddle\" class=\"user\" />&nbsp;&nbsp;<span class=\"red\">非常抱歉，服务器连接超时，请重新刷新页面！<a href=\"#\" onclick=\"window.location.reload();return false;\">[立即刷新]</a>");
			$("form").submit(function() {
				return false;
			});
			return false;
		}
	},
	30000);

}

//添加错误信息
function addErr(info, ErrId) {
	var str = "";
	var ErrIdD = "main_errors";

	if (info.indexOf(",") != -1) {
		for (var i = 0; i < info.split(",").length; i++) {
			if (info.split(",")[i] != "") {
				str += "<li>" + info.split(",")[i] + "</li>";
			}
		}
	} else {
		str = "<li>" + info + "</li>";
	}

	if (typeof ErrId != "undefined") {
		ErrIdD = ErrId;
	}

	var errObj = $("#" + ErrIdD);

	if (errObj.length != 0 && str != "") {

		errObj.html("<div class=\"main_errors_title\">" + errTitle + "</div><ul>" + str + "</ul>");
		if (errObj.css("display") != "block") {
			errObj.slideDown("fast");
		}
	}

}

function checkClass(name, divName, MsgClass, MsgImg, Msg) {
	//alert(MsgImg);
	if (name != "") {
		if (MsgClass == "MsgErr") {
			var nameO = $("#" + name)[0];
			nameO.focus();
			nameO.select();
		}
	}
	if (divName != "") {
		var divName = $("#" + divName)[0];
		divName.className = MsgClass;
		divName.innerHTML = MsgImg + Msg;
	}
	if (MsgClass == "MsgOk") {
		return true;
	} else {
		return false;
	}
}

//错误信息判断
function hideErrId() {
	var main_errors = jQuery("#main_errors");
	if (main_errors.length == 0 || main_errors.length > 1) {
		main_errors = jQuery("div[className^='main_errors']");
	}

	if (main_errors.length > 0) {

		for (i = 0; i < main_errors.length; i++) {
			if (main_errors.eq(i).find("li").length == 0) {
				main_errors.eq(i).hide(); //MM_showHideLayers(strtype,'','hide');//hide("main_errors");
			} else {
				main_errors.eq(i).slideDown("fast");
				main_errors.eq(i).html(main_errors.eq(i).html().replace("系统提示:", errTitle));
			}
		}
	}

}

//分页判断
function hidePageId() {
	var publicPage = jQuery("#publicPage");
	publicPage = publicPage.length == 0 ? jQuery(".publicPage") : publicPage;
	publicPage.each(function(i) {
		var thisEq = publicPage.eq(i);
		if (thisEq.find("a").length > 0) {
			thisEq.show();
		}
	});
}

function isValidUsid(s) {
	noUsid = new Array("admin", "blog", "travel", "trip", "ectrip", "hotel", "ticket", "cms", "bbs", "help", "price", "line", "custom", "manage", "system", "root", "daoyou", "user", "article", "ask", "order", "ciceroni", "air", "train", "bus", "home");
	for (i = 0; i < noUsid.length; i = i + 1) {
		if (s == noUsid[i]) {
			return false;
		}
	}
	return true;
}

function setInputCheck(checkInfo, tForm) {
	var subtype = new Array("id", "dataType", "msg", "min", "max", "Require", "to", "operator"); //operator 如：GreaterThanEqual，需要和to一起使用
	//var info="usid,Username,请正确输入用户名,2,16,,,||password,Password,请正确输密码,8,16,,,||random,Code,请正确输入验证码,,,,,";
	var info = "";
	var tForm = tForm || "";
	if (eval("typeof(" + "checkInfo" + ")") != 'undefined') {
		info = checkInfo.toString();
		var infoArr = new Array();
		infoArr = info.split("||");

		if (infoArr.length != 0) {

			var inputFirstN = infoArr[0].split(",")[0];
			var inputFirst = jQuery("*[name=" + inputFirstN + "]").eq(0);

			inputFirst = inputFirst.length == 0 ? jQuery("#" + inputFirstN).eq(0) : inputFirst;

			tForm = tForm == "undefined" ? jQuery("#" + tForm) : inputFirst.parents("form").eq(0);

			for (var q = 0; q <= infoArr.length - 1; q++) {
				var infoOneArr = new Array();
				infoOneArr = infoArr[q].split(",");

				var thisQname = infoOneArr[0];
				var inputObj = tForm.find("*[name=" + thisQname + "]");

				if (inputObj.length == 0) {
					inputObj = jQuery("#" + thisQname).eq(0);
				}
				if (inputObj.length > 0) {
					for (var i = 0; i <= infoOneArr.length - 1; i++) {
						if (infoOneArr[i] != "" && i > 0) {
							try {
								var n = subtype[i];
								var str = infoOneArr[i];

								if (str.indexOf("[oldmsg]") != -1) {
									inputObj.each(function() {
										var _this = jQuery(this);
										_this.attr(n, str.replace("[oldmsg]", " [" + _this.attr("oldmsg") + "] "));
									});
								} else {
									inputObj.eq(0).attr(n, str);
								}

								if (infoOneArr[1] == "Filter") {
									inputObj.attr("accept", infoOneArr[7]);
								}
								if (infoOneArr[6] == "" && infoOneArr[7] != "") {
									inputObj.attr("format", infoOneArr[7]);
								}
							} catch(e) {}
						}
					}
				}
			}

		}
	}
}

//电话号码和email调用：

//var telinfo="服务热线：||tel||1||1&24小时值班电话：<br/>||24tel||0||0";
//参数说明:名称||类别||是否加粗(1为加粗)||颜色选择(1为red，2为yellow，0为默认颜色)
function tel_all(telinfo) {
	subtel = new Array("0744-8388555", "0744-8388555", "0744-8388555", "0744-8388555", "0744-8388555", "", "001", "002", "zjjmps01@hotamil.com", "zjjmps02@hotmail.com", "zjjmps03@hotmail.com", "service@zjjmps.com");
	subtype = new Array("tel", "ordertel", "hottel", "24tel", "fax", "mobi", "QQ1", "QQ2", "MSN1", "MSN2", "MSN3", "email");

	//电话,24小时值班电话,预订热线,服务热线传真,应急电话,QQ1,QQ2,msn1,msn2,msn3,email
	//Type: tel,ordertel,hottel,24tel,fax,mobi,QQ1,QQ2,msn1,msn2,msn3,email
	var tel_content;
	tel_content = "";

	for (var q = 0; q <= telinfo.split("&").length - 1; q++) {
		for (var i = 0; i <= subtype.length - 1; i++) {

			if (telinfo.split("&")[q].split("||")[1] == subtype[i]) {
				if (telinfo.split("&")[q].split("||")[2] == "1") {
					if (telinfo.split("&")[q].split("||")[3] == "1") {
						tel_content += telinfo.split("&")[q].split("||")[0] + "<span class='red'><strong>" + subtel[i] + "</strong></span>";
					} else if (telinfo.split("&")[q].split("||")[3] == "2") {
						tel_content += telinfo.split("&")[q].split("||")[0] + "<span class='yellow'><strong>" + subtel[i] + "</strong></span>";
					} else {
						tel_content += telinfo.split("&")[q].split("||")[0] + "<strong>" + subtel[i] + "</strong>";
					}
				} else {
					if (telinfo.split("&")[q].split("||")[3] == "1") {
						tel_content += telinfo.split("&")[q].split("||")[0] + "<span class='red'>" + subtel[i] + "</span>";
					} else if (telinfo.split("&")[q].split("||")[3] == "2") {
						tel_content += telinfo.split("&")[q].split("||")[0] + "<span class='yellow'>" + subtel[i] + "</span>";
					} else {
						tel_content += telinfo.split("&")[q].split("||")[0] + subtel[i];
					}
				}

				break;
			} else {
				tel_content += "";
				continue;
			}

		}
	}
	document.write(tel_content);
}

//v1.7
// Flash Player Version Detection
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true: false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true: false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true: false;
function ControlVersion() {
	var version;
	var axo;
	var e;
	try {
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version")
	} catch(e) {}
	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			version = "WIN 6,0,21,0";
			axo.AllowScriptAccess = "always";
			version = axo.GetVariable("$version")
		} catch(e) {}
	}
	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version")
		} catch(e) {}
	}
	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0"
		} catch(e) {}
	}
	if (!version) {
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11"
		} catch(e) {
			version = -1
		}
	}
	return version
}
function GetSwfVer() {
	var flashVer = -1;
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0": "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4]
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1)
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"))
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision
		}
	} else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if (isIE && isWin && !isOpera) {
		flashVer = ControlVersion()
	}
	return flashVer
}
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) {
	versionStr = GetSwfVer();
	if (versionStr == -1) {
		return false
	} else if (versionStr != 0) {
		if (isIE && isWin && !isOpera) {
			tempArray = versionStr.split(" ");
			tempString = tempArray[1];
			versionArray = tempString.split(",")
		} else {
			versionArray = versionStr.split(".")
		}
		var versionMajor = versionArray[0];
		var versionMinor = versionArray[1];
		var versionRevision = versionArray[2];
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer)) return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision)) return true
			}
		}
		return false
	}
}
function AC_AddExtension(src, ext) {
	if (src.indexOf('?') != -1) return src.replace(/\?/, ext + '?');
	else return src + ext
}
function AC_Generateobj(objAttrs, params, embedAttrs) {
	var str = '';
	if (isIE && isWin && !isOpera) {
		str += '<object ';
		for (var i in objAttrs) {
			str += i + '="' + objAttrs[i] + '" '
		}
		str += '>';
		for (var i in params) {
			str += '<param name="' + i + '" value="' + params[i] + '" /> '
		}
		str += '</object>'
	} else {
		str += '<embed ';
		for (var i in embedAttrs) {
			str += i + '="' + embedAttrs[i] + '" '
		}
		str += '> </embed>'
	}
	document.write(str)
}
function AC_FL_RunContent() {
	var ret = AC_GetArgs(arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash");
	AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs)
}
function AC_SW_RunContent() {
	var ret = AC_GetArgs(arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000", null);
	AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs)
}
function AC_GetArgs(args, ext, srcParamName, classid, mimeType) {
	var ret = new Object();
	ret.embedAttrs = new Object();
	ret.params = new Object();
	ret.objAttrs = new Object();
	for (var i = 0; i < args.length; i = i + 2) {
		var currArg = args[i].toLowerCase();
		switch (currArg) {
		case "classid":
			break;
		case "pluginspage":
			ret.embedAttrs[args[i]] = args[i + 1];
			break;
		case "src":
		case "movie":
			args[i + 1] = AC_AddExtension(args[i + 1], ext);
			ret.embedAttrs["src"] = args[i + 1];
			ret.params[srcParamName] = args[i + 1];
			break;
		case "onafterupdate":
		case "onbeforeupdate":
		case "onblur":
		case "oncellchange":
		case "onclick":
		case "ondblclick":
		case "ondrag":
		case "ondragend":
		case "ondragenter":
		case "ondragleave":
		case "ondragover":
		case "ondrop":
		case "onfinish":
		case "onfocus":
		case "onhelp":
		case "onmousedown":
		case "onmouseup":
		case "onmouseover":
		case "onmousemove":
		case "onmouseout":
		case "onkeypress":
		case "onkeydown":
		case "onkeyup":
		case "onload":
		case "onlosecapture":
		case "onpropertychange":
		case "onreadystatechange":
		case "onrowsdelete":
		case "onrowenter":
		case "onrowexit":
		case "onrowsinserted":
		case "onstart":
		case "onscroll":
		case "onbeforeeditfocus":
		case "onactivate":
		case "onbeforedeactivate":
		case "ondeactivate":
		case "type":
		case "codebase":
		case "id":
			ret.objAttrs[args[i]] = args[i + 1];
			break;
		case "width":
		case "height":
		case "align":
		case "vspace":
		case "hspace":
		case "class":
		case "title":
		case "accesskey":
		case "name":
		case "tabindex":
			ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i + 1];
			break;

		default:
			ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i + 1]
		}
	}
	ret.objAttrs["classid"] = classid;
	if (mimeType) ret.embedAttrs["type"] = mimeType;
	return ret
}

function _sFocus(imgStr, w, h, h_t, id) {
	var focus_width = w;
	var focus_height = h;
	var text_height = h_t;
	var swf_height = focus_height + text_height;
	var imgArr = imgStr;
	var imgArrL = imgStr.length;
	//	var pics=imgUrl1+"|"+imgUrl2+"|"+imgUrl3+"|"+imgUrl4+"|"+imgUrl5
	//	var links=imgLink1+"|"+imgLink2+"|"+imgLink3+"|"+imgLink4+"|"+imgLink5
	//	var texts=imgtext1+"|"+imgtext2+"|"+imgtext3+"|"+imgtext4+"|"+imgtext5
	var pics = "";
	var links = "";
	var texts = "";
	for (var i = 0; i < imgArrL; i = i + 3) {
		if (i == 0) {
			texts += imgArr[i];
			pics += imgArr[i + 1];
			links += imgArr[i + 2];
		} else {
			texts += "|" + imgArr[i];
			pics += "|" + imgArr[i + 1];
			links += "|" + imgArr[i + 2];
		}
	}
	if (pics !== "") {
		//'wmode','transparent',
		AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0', 'name', id, 'width', focus_width, 'height', swf_height, 'align', 'middle', 'id', id, 'FlashVars', 'pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height, 'src', '/media/focus', 'menu', 'false', 'quality', 'high', 'scale', 'noscale', 'wmode','transparent','bgcolor', '#c3e0ff', 'allowscriptaccess', 'sameDomain', 'allowfullscreen', 'false', 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'movie', '/media/focus');

	}
}
function getPlayerCheck(mode) {
	var pluginsArr={rm:"http://realplayer.cn.real.com/",wmv:"http://www.microsoft.com/china/windows/products/winfamily/mediaplayer/default.mspx",flv:"http://get.adobe.com/flashplayer/",mov:"http://www.apple.com.cn/quicktime/"};
	if(confirm("缺少播放视频（音频）的插件，是否立即下载？")){
		try{
			$("body").prepend('<div style="position: absolute; z-index: 10000; top:200px; width: 100%; text-align: center" id="playplugins"><div style="border: 1px solid #FFCC33; background-color:#FEF0DA; width: 300px; margin: auto; white-space: nowrap; overflow: visible;  padding: 5px; line-height: 30px; height: 30px;">视频(音频)播放插件下载地址：<a href="'+pluginsArr[mode]+'" target="_blank" onclick="$(\'#playplugins\').remove();">点击下载</a></div></div>');
		
		}catch(e){}
	}
}


function getPlayer(url, w, h, s, e, m, mode) {
	var urlArr = url.split(".");
	var urlArrLen = urlArr.length;
	var h =parseInt(h) || 320;
	var w =parseInt(w) || 480;
	
	var urlType = urlArr[urlArrLen-1].toLowerCase();
	var urlPath = "";
	
	var urlName = "viedo_" + randomNumber(1000);
	

	var videoStr = "";
	var msgStr = "";
	msgStr = "格式：" + urlType;
	//navigator.plugins
/*	function DetectActiveX()
	{
	try {
	var comActiveX = new ActiveXObject('V2.V2Ctrl.1'); // 判断IE是否已经安装视频插件
	} catch (e) {
	return false;
	}
	return true;
	}
	 
	if(DetectActiveX()==true){
	alert("插件安装");
	}else{
	alert("插件未装");
	}*/

	if (urlType != "") {
		
		for(var i=0; i<urlArrLen-1;i++) {
			urlPath+=urlArr[i];		
		}
		
		switch (urlType) {
			//mid,mp3,wma,wav,mpeg,mpg,wmv,avi,rm,rmvb,swf
		case "mid":
		case "mp3":
		case "wma":
		case "wav":
		case "asx":
			try{
			videoStr = '<EMBED src="' + url + '" onerror="javascript:getPlayerCheck(\'wmv\')" id="' + urlName + '" name="' + urlName + '" type=audio/mpeg AUTOSTART="1" loop="0" width="' + w + '" height="68" showstatusbar="true" showcontrols="true" showaudiocontrols="true" ></EMBED>';
			}catch(e){getPlayerCheck("wmv");} 
			break;

		case "mpeg":
		case "mpg":
		case "wmv":
			try{
			videoStr = '<object  id="' + urlName + '" name="' + urlName + '" width="' + w + '" height="' + h + '" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/controls/vc/mfc42.cab" onerror="javascript:getPlayerCheck(\'wmv\')"><param NAME="AutoStart" VALUE="-1"><param NAME="Balance" VALUE="0"><param name="enabled" value="' + e + '"><param NAME="EnableContextMenu" VALUE="' + m + '"><param NAME="url" VALUE="' + url + '"><param NAME="PlayCount" VALUE="1"><param name="rate" value="1"><param name="currentPosition" value="0"><param name="currentMarker" value="0"><param name="defaultFrame" value=""><param name="invokeURLs" value="0"><param name="baseURL" value=""><param name="stretchToFit" value="-1"><param name="volume" value="50"><param name="mute" value="0"><param name="uiMode" value="' + mode + '"><param name="windowlessVideo" value="0"><param name="fullScreen" value="0"><param name="enableErrorDialogs" value="-1"></object>';
			}catch(e){getPlayerCheck("wmv");}
			break;
		case "mov":
			try{
				var ieStr;
				if(isIE){
					ieStr='<object type="video/quicktime" data="' + url + '" width="' + w + '" height="' + h + '" onerror="javascript:getPlayerCheck(\'mov\')"><param name="autoplay" value="false" /><param name="controller" value="true" /></object>';
				}
				videoStr = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="' + w + '" height="' + h + '"><param name="src" value="' + url + '" /><param name="controller" value="true" /><param name="autoplay" value="false" />'+ieStr+'</object>';
				
			}catch(e){getPlayerCheck("mov");}//
			
			break;
		case "avi":
			try{
			videoStr = '<EMBED src="' + url + '" onerror="javascript:getPlayerCheck(\'wmv\')" id="' + urlName + '" name="' + urlName + '" type=audio/mpeg AUTOSTART="1" loop="0" width="' + w + '" height="' + h + '" showstatusbar="true" showcontrols="true" showaudiocontrols="true" ></EMBED>';
			}catch(e){getPlayerCheck("wmv");}
			break;

		case "rm":
		case "rmvb":
			try{
			videoStr += '<object  id="rmVideo" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="' + w + '" height="' + h + '" onerror="javascript:getPlayerCheck(\'rm\')">';
			videoStr += '<param name="_ExtentX" value="3016" />';
			videoStr += '<param name="_ExtentY" value="2646" />';
			videoStr += '<param name="AUTOSTART" value="-1" />';
			videoStr += '<param name="SHUFFLE" value="0" />';
			videoStr += '<param name="PREFETCH" value="0" />';
			videoStr += '<param name="NOLABELS" value="-1" />';
			videoStr += '<param name="SRC" value="' + url + '"; />';
			videoStr += '<param name="CONTROLS" value="Imagewindow" />';
			videoStr += '<param name="CONSOLE" value="clip1" />';
			videoStr += '<param name="LOOP" value="0" />';
			videoStr += '<param name="NUMLOOP" value="0" />';
			videoStr += '<param name="CENTER" value="0" />';
			videoStr += '<param name="MAINTAINASPECT" value="0" />';
			videoStr += '<param name="BACKGROUNDCOLOR" value="#000000" />';
			videoStr += '</object>';
			videoStr += '<object  id="rmVideo2" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"  width="' + w + '" height=30>';
			videoStr += '<param name="_ExtentX" value="11298" />';
			videoStr += '<param name="_ExtentY" value="794" />';
			videoStr += '<param name="AUTOSTART" value="-1" />';
			videoStr += '<param name="SHUFFLE" value="0" />';
			videoStr += '<param name="PREFETCH" value="0" />';
			videoStr += '<param name="NOLABELS" value="-1" />';
			videoStr += '<param name="SRC" value="' + url + '" />';
			videoStr += '<param name="CONTROLS" value="ControlPanel" />';
			videoStr += '<param name="CONSOLE" value="clip1" />';
			videoStr += '<param name="LOOP" value="0" />';
			videoStr += '<param name="NUMLOOP" value="0" />';
			videoStr += '<param name="CENTER" value="0" />';
			videoStr += '<param name="maintainaspect" value="0" />';
			videoStr += '<param name="BACKGROUNDCOLOR" value="#000000" />';
			videoStr += '</object>';
			}catch(e){getPlayerCheck("rm");}

			break;

		case "swf":
			try{
			videoStr = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" onerror="javascript:getPlayerCheck(\'flv\')" width="' + w + '"  id="' + urlName + '" name="' + urlName + '" height="' + h + '"><param name="menu" value="false" /><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="true" /><param name="movie" value="' + url + '"> <param name="quality" value="high"> <embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash"  width="' + w + '" height="' + h + '"> </embed> </object> ';
			}catch(e){getPlayerCheck("flv");}
			break;
		case "flv":
			try{
			videoStr = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" onerror="javascript:getPlayerCheck(\'flv\')" width="' + w + '" height="' + h + '" id="FLVPlayer"><param name="movie" value="' + webBasePath + '/media/ectripFlvPlay.swf" /><param name="salign" value="lt" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="bgcolor" value="#000000" /><param name="menu" value="false" /><param name="FlashVars" value="flvurl=' + url + '&skinColor=333333&backColor=000000&width=' + w + '&height=' + h + '&skinUrl=' + webBasePath + '/media/SkinOverAllNoFullNoCaption.swf" /><embed src="' + webBasePath + '/media/ectripFlvPlay.swf" flashvars="flvurl=' + url + '&skinColor=333333&backColor=000000&width=' + w + '&height=' + h + '&skinUrl=' + webBasePath + '/media/SkinOverAllNoFullNoCaption.swf" quality="high" scale="noscale" width="' + w + '" height="' + h + '" menu="false" allowScriptAccess="sameDomain" allowFullScreen="true"  name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" bgcolor="#000000"/></object>';
			}catch(e){getPlayerCheck("flv");}
			break;

		default:
			try{
			videoStr = '<EMBED  onerror="javascript:getPlayerCheck(\'wmv\')"src="' + url + '"  id="' + urlName + '" name="' + urlName + '" type=audio/mpeg AUTOSTART="1" loop="0" showstatusbar="true" showcontrols="true" showaudiocontrols="true" ></EMBED>';
			}catch(e){getPlayerCheck("wmv");}
			break;
		}

	}
	return videoStr;
}

function getWeather(id,t,obj){
	//getWeather("58437")  //当天天气
	//getWeather("58437",1)  //所有天气 未来n天
	var t=t || 0;
	var obj=obj || null;
	var objV=false;
	
	var $weather;
	if(t==1){
		obj=$(obj);
		if(obj!=null&&obj.length>0){
			objV=true;
			$weather = $("<div id='weatherNewMain' style='padding: 10px; clear:both; margin:auto;'></div>");
			$weather.html("<span class='yellow'><img src=\"/images/loading.gif\" alt=\"loading\" width=\"16\" height=\"16\" align=\"absmiddle\" />&nbsp;&nbsp;天气预报加载中......</span>");
			$weather.appendTo(obj.eq(0));
		}
	}
	
	
	var id=id || "57558";
	var nodeName,url;
	var icoUrl="http://images4.cache.netease.com/yodaoimages/weathericon/";
	var attrArr=new Array();
	var attrArrTitle=new Array("","","","风力：","","路况指数：");
	var strArr=new Array();
	
	var strArr=new Array();
	
	var returnStr="";
	if(t==0){
		nodeName="weather";
		attrArr=["c","qx","wd","fl","qximg","lk"];
		url="/weather/weatherXml.jsp?id="+id+"&r="+randomNumber(10000);
	}else{
		nodeName="city";
		attrArrTitle=["","","","","风向/风力：","穿衣指数：","晨练指数：","路况指数：","紫外线强度指数："];
		attrArr=["date","general","qximg","temperature","wind","clothes","drill","traffic","sunvisor"];
		url="/weather/weatherXml.jsp?r="+randomNumber(10000);
	}

	$.ajax({

		type: "get",
		url: url,
		dataType: "xml",
		success: function(msg) {
			var xmlDoc=$(msg);
			var nodeObj=xmlDoc.find(nodeName);
			
			if(t==0){//当天
				var day_icoArr=nodeObj.attr(attrArr[4]).split(",");
				var day_ico_b=day_icoArr[0]!=""?"<img style='vertical-align:middle' src='"+icoUrl+day_icoArr[0]+"' /> ":"";
				var day_ico_e=day_icoArr.length>1?" <img style='vertical-align:middle' src='"+icoUrl+day_icoArr[1]+"' /> ":"";
				var day_ico=day_ico_b+day_ico_e;
				
				$('#main_weather_m_m').html("<ul title='"+attrArrTitle[3]+nodeObj.attr(attrArr[3])+"&#13;"+attrArrTitle[5]+nodeObj.attr(attrArr[5])+"'><li class='b'>今日天气</li><li>"+day_ico+nodeObj.attr(attrArr[1])+"<li>温度</li><li>"+nodeObj.attr(attrArr[2])+"</li></ul>");
			
			}else{//未来3天
				nodeObj =xmlDoc.find(nodeName);
				//alert("ok????"+nodeObj.length);
				for(i=0;i<nodeObj.length;i++){
					if(nodeObj.eq(i).attr('id')==id){
						
						var nextNodeObj=nodeObj.eq(i).find("day");
						var nextNodeObjLen=nextNodeObj.length;
						
						for(j=0;j<nextNodeObjLen;j++){
							
							var thisEq=nextNodeObj.eq(j);		
							var dayT=thisEq.attr(attrArr[0]);
							var today_weather=thisEq.attr(attrArr[1]);				
							var day_icoArr=thisEq.attr(attrArr[2]).split(",");
							var day_ico_b=day_icoArr[0]!=""?"<img src='"+icoUrl+day_icoArr[0]+"' /> ":"";
							var day_ico_e=day_icoArr.length>1?" <img src='"+icoUrl+day_icoArr[1]+"' />":"";
							var today_wendu=thisEq.attr(attrArr[3]);//today_wendu
							var today_wind=thisEq.attr(attrArr[4]);//today_wind
							
							if(j==0){
								
								strArr.push('<table cellspacing="1" cellpadding="2" width="90%" align="center" bgcolor="#cccccc" border="0" style="margin:auto;"><tbody><tr><td class="b_14  blue center" id="weather_today_title" bgcolor="#b9e7ff" colspan="2" align="center" style="font-size: 14px; font-weight:bold; line-height: 30px;">'+nodeObj.eq(i).attr('name')+' 今日（'+returnDate(j)+' ）天气预报</td></tr><tr><td class="b" id="weather_today_ico" valign="middle" align="center" width="40%" bgcolor="#ffffff" style="font-size: 14px; font-weight:bold; line-height: 30px;">'+day_ico_b+day_ico_e+'<br/>'+today_weather+'<br/><span class="blue">'+today_wendu+'</span></td><td id="weather_today_info" valign="middle" bgcolor="#ffffff" style="line-height: 20px;">');
								for(var k=4;k<attrArr.length;k++){
									var today_info_str=thisEq.attr(attrArr[k]);
									
									if(today_info_str!=""&&today_info_str!="--"&&today_info_str!=undefined)
									strArr.push('<span class="b" style="font-weight:bold;">'+attrArrTitle[k]+'</span>'+today_info_str+'<br/>');
								}
								
								strArr.push('</td></tr></tbody></table><br />');
								if(nextNodeObjLen>1)
								strArr.push('<table cellspacing="1" cellpadding="2" width="90%" align="center" bgcolor="#cccccc" border="0" style="margin:auto;"><tr><td class="b_14  center" id="weather_f_days" bgcolor="#dadede" colspan="4" align="center" style="font-size: 14px; font-weight:bold; line-height: 30px;">未来 '+(nextNodeObjLen-1)+' 天 天气预报</td></tr><tr id="weather_f_title"><td class="b center" valign="middle" align="center" bgcolor="#ffffff" style="font-weight:bold; line-height: 25px;">日期</td><td class="b center" valign="middle" align="center" bgcolor="#ffffff" style="font-weight:bold; line-height: 25px;">天气</td><td class="b center" valign="middle" align="center" bgcolor="#ffffff" style="font-weight:bold; line-height: 25px;">风向/风力</td><td class="b center" valign="middle" bgcolor="#ffffff" style="font-weight:bold; line-height: 25px;" align="center">温度</td></tr>');
								
							}else{
								strArr.push('<tr><td align="center" bgcolor="#FFFFFF" align="center" valign="middle" style=" line-height: 25px;">'+returnDate(j)+'</td><td align="center" bgcolor="#FFFFFF" align="center" valign="middle" style=" line-height: 25px;">'+day_ico_b+day_ico_e+'<br/>'+today_weather+'</td><td bgcolor="#FFFFFF" align="center"  valign="middle" style=" line-height: 25px;">'+today_wind+'</td><td bgcolor="#FFFFFF" align="center"  valign="middle" style=" line-height: 25px;">'+today_wendu+'</td></tr>');
								
							}
						}					
						if(nextNodeObjLen>1)
						strArr.push('</table>');
						if(objV)
						$weather.html(strArr.join(""));
						//return strArr.join("");
						break;
					}
				}
			}
		},
		error:function(){
			//alert("失败!");
		}
	})
	
	return returnStr;
}
