

function StrCode(str){if(encodeURIComponent) return encodeURIComponent(str);if(escape) return escape(str);}

function UnStrCode(str){if(decodeURIComponent ) return decodeURIComponent (str);if(unescape) return unescape(str);}

function Trim(s){var m = s.match(/^\s*(\S+(\s+\S+)*)\s*$/);return (m == null)?"":m[1];}

function HtmlEncode(text){var re = {'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'};for (i in re) text = text.replace(new RegExp(i,'g'), re[i]);return text;}

function HtmlDecode(text){var re = {'&lt;':'<','&gt;':'>','&amp;':'&','&quot;':'"'};for (i in re) text = text.replace(new RegExp(i,'g'), re[i]);return text;}



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 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 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.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 = "#000000";}else{oS.background = "#000000";}oS.filter = "alpha(opacity=40)";oS.opacity = 40/100;oS.MozOpacity = 40/100;document.body.appendChild(objScreen);var allselect = gname("select");for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "hidden";}



function ScreenClean(){var objScreen = document.getElementById("ScreenOver");if (objScreen) objScreen.style.display = "none";var allselect = gname("select");for (var i=0; i<allselect.length; i++) allselect[i].style.visibility = "visible";}



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 = document.getElementById("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 3px";objDialog.innerHTML = showdata;document.body.appendChild(objDialog);}

function DialogHide(){ScreenClean();var objDialog = document.getElementById("DialogMove");if (objDialog) objDialog.style.display = "none";}

function changelocation(city,url){

	ScreenConvert();var AJAX_changeBody="<div id=\"DialogTitle\"><div id=\"DialogTitleText\">切换城市</div><div id=\"DialogTitleBtn\" onclick=\"return DialogHide();\" onmouseover=\"var objShut = document.getElementById('DialogTitleBtn');objShut.style.border='solid 1px #000000';\" onmouseout=\"var objShut = document.getElementById('DialogTitleBtn');objShut.style.border='solid 1px #EEE';\"></div></div><div id=\"DialogContent\">你确认下次访问时直接进入<font color=red>"+ city +"</font>站吗！</div><div id=\"DialogValidator\"></div><div id=\"DialogButtons\"><button id=\"AjaxMainSure\" onclick=\"window.location.href='" + url + "?changeLocation=Y';\">我确认</button>&nbsp;&nbsp;&nbsp;&nbsp;<button id=\"AjaxMainCancle\" onclick=\"return DialogHide();\">取消</button>&nbsp;&nbsp;&nbsp;&nbsp;<button id=\"AjaxMainGo\" onclick=\"window.location.href='" + url + "';\">先进逛逛</button></div>";DialogShow(AJAX_changeBody,250,120,300,150);

}



function head_on (but) {

	var but_list = ["home","trader","zhidao","bbs","helper","my"];

	$.each(but_list,function(k,n){

			$("#"+n).removeClass();

			if (but == n) {

				$("#"+n).addClass("hd_on");

			} else {

				$("#"+n).addClass("hd_out");

			}		

	});

}





function goSubmit(){

	form=document.searchForm;

	if (form.keyword.value=='' || form.keyword.value=='请输入关键字'){

		alert("请输入关键字");

		form.keyword.focus();

		return false;

	}



	switch(form.sch_area.value){

	case 'A':

		window.open("http://www.99wed.com/artcle/main.php?key="+form.keyword.value,"_blank");

		return false;

		break;

	case 'N':

		window.open("http://www.99wed.com/news/list.php?key="+form.keyword.value,"_blank");

		return false;

		break;

	case 'B'://商家

		window.open("http://so.99wed.com/goto.php?key="+form.keyword.value,"_blank");

		return false;

		break;

	default:

		document.searchForm.submit();

		return false;

		break;

	}

}



function My_dialog(v_w, v_h, v_title)

{

 var width = v_w;

 var height = v_h;

 var title = v_title;



 this.open = function(_sUrl)

	 {

		 ScreenConvert();

		 var openIframe = "<iframe width='100%' height='" + (height-45) + "' name='iframe_parent' id='iframe_parent' src='" + _sUrl + "' frameborder='0' scrolling='auto'></iframe>";

		var AJAX_changeBody="<div id=\"DialogTitle\"><div id=\"DialogTitleText\">" + title +"</div><div id=\"DialogTitleBtn\" onclick=\"return DialogHide();\" onmouseover=\"var objShut = document.getElementById('DialogTitleBtn');objShut.style.border='solid 1px #000000';\" onmouseout=\"var objShut = document.getElementById('DialogTitleBtn');objShut.style.border='solid 1px #EEE';\"></div></div><div id=\"DialogContent\">" + openIframe + "</div>";DialogShow(AJAX_changeBody,v_w,v_h,width,height);

		

	 }

	this.reset = function(){

		 DialogHide();

	}

}





function openWindow(_sUrl, _sWidth, _sHeight, _sTitle)

{

 var oEdit = new My_dialog(_sWidth, _sHeight, _sTitle);

 oEdit.open(_sUrl);

}



function MM_findObj(n, d) {

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 MM_showHideLayers() {

var i,p,v,obj,args=MM_showHideLayers.arguments;

for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];

if (obj.style) { obj=obj.style; v=(v=="show")?"visible":(v=="hide")?"hidden":v; }

obj.visibility=v;

if(obj.visibility=="visible"){

if ((obj2=MM_findObj("sch_area"))!=null){

if(obj2.style) obj2.style.visibility="hidden";

}

}

else{

if ((obj2=MM_findObj("sch_area"))!=null){

if(obj2.style) obj2.style.visibility="visible";

}

}

}

}

function showsort(sort){
	if($("#sortid_"+sort).css("display")=="none"){
		$("#sortid_"+sort).show();
		//$("#img_"+sort).attr("src","http://vip.99wed.com/images/so_0907/sanjiao2.jpg");
		//$("#img_"+sort).css("margin-left","-2px");
		
	}else{
		$("#sortid_"+sort).hide();
		//$("#img_"+sort).attr("src","http://vip.99wed.com/images/so_0907/sanjiao.jpg");
	}
}

function myAddPanel(title,url,slice){
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,''); 
	} else if( document.all ) { 
		try
	        {
	            window.external.addFavorite(url, title);
	        }
		catch (e)
	        {
				try
	            {
	                window.external.addToFavoritesBar(url, title,'slice');
	            }
				catch(e)
				{
					try
					{
						var mbm = document.getElementById('addFavor');
						mbm.setAttribute('rel','sidebar');
						mbm.setAttribute('href',url);
						mbm.setAttribute('title',title);
						mbm.click();
					}
					catch (e2)
					{
						alert('加入收藏失败，请您按ctrl+D手工加入。');
					}
				}
	        }
	} else if( window.opera && window.print ) { 
		return true; 
	} else{
		alert('加入收藏失败，请您按ctrl+D手工加入。');
	}


	}

