﻿jQuery.fn.loadthumb = function()
{
	this.each(function()
	{
		var loadimg = $(this);
		var loadimgsrc = $(this).attr("src");
		loadimg.attr("src","../image/loading.gif");    
		var thisimg = new Image();
		$(thisimg).load(function()
		{
			loadimg.attr("src", loadimgsrc);
			loadimg.show();
		}).attr("src", loadimgsrc);
		return loadimg;
	});
}
$(document).ready(function()
{
	$(".piccontent img").loadthumb();
	$(".diyproc_procpic img").loadthumb();
	$(".zuopincontent_pic img").loadthumb();
	$(".albumpic img").loadthumb();
	AutoLogin();
})
var lang = new Array();
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
/*Array.prototype.push = function(value) {
	this[this.length] = value;
	return this.length;
}*/
function fetchCheckbox(cbn) {
	return $dnt(cbn) && $dnt(cbn).checked == true ? 1 : 0;
}
function getcookie(name) {
	var cookie_start = document.cookie.indexOf(name);
	var cookie_end = document.cookie.indexOf(";", cookie_start);
	return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
}
function thumbImg(obj) {
	var zw = obj.width;
	var zh = obj.height;
	if(is_ie && zw == 0 && zh == 0) {
		var matches
		re = /width=(["']?)(\d+)(\1)/i
		matches = re.exec(obj.outerHTML);
		zw = matches[2];
		re = /height=(["']?)(\d+)(\1)/i
		matches = re.exec(obj.outerHTML);
		zh = matches[2];
	}
	obj.resized = true;
	obj.style.width = zw + 'px';
	obj.style.height = 'auto';
	if(obj.offsetHeight > zh) {
		obj.style.height = zh + 'px';
		obj.style.width = 'auto';
	}
	if(is_ie) {
		var imgid = 'img_' + Math.random();
		obj.id = imgid;
		setTimeout('try {if ($dnt(\''+imgid+'\').offsetHeight > '+zh+') {$dnt(\''+imgid+'\').style.height = \''+zh+'px\';$dnt(\''+imgid+'\').style.width = \'auto\';}} catch(e){}', 1000);
	}
}
function in_array(needle, haystack) {
	if(typeof needle == 'string' || typeof needle == 'number') {
		for(var i in haystack) {
			if(haystack[i] == needle) {
					return true;
			}
		}
	}
	return false;
}
function setcopy(text, alertmsg){
	if(is_ie) {
		clipboardData.setData('Text', text);
		alert(alertmsg);
	} else if(prompt('Press Ctrl+C Copy to Clipboard', text)) {
		alert(alertmsg);
	}
}
function CheckAll(chkname)
{
	var chks = document.getElementsByName(chkname);
	var i = 0;
	while(i < chks.length)
	{
		chks[i].checked = chks[i].checked ? "" : "checked";
		i ++;
	}
}
function CheckHasCheck(chkname)
{
	var chks = document.getElementsByName(chkname);
	var i = 0;
	while(i < chks.length)
	{
		if(chks[i].checked)
		{
			return true;
		}
		i ++;
	}
	return false;
}
function windowOpening(URL)
{
    window.open(URL,'','height=450,width=620,top=150,left=200,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=no,toolbar=no,directories=no');
}
function OpenIFrame(url, fullCssClass, IFrameCssClass, width, height)
{
	var bgDiv = document.createElement("div");
	bgDiv.id = "fullbg";
	bgDiv.className = fullCssClass;
	bgDiv.style.width = document.body.scrollWidth + "px";
	var scrollHeight = document.body.scrollHeight + 20;
	bgDiv.style.height = scrollHeight+"px";
	bgDiv.innerHTML = "<iframe frameborder=\"0\" scrolling=\"no\" src=\"about:blank\" style=\"background-color:#FFFFFF;width:" + document.body.scrollWidth + "px;height:" + scrollHeight + "px;\"></iframe>";
	document.body.appendChild(bgDiv);
	var my51IFrame = document.createElement("div");
	my51IFrame.id = "my51IFrame";
	my51IFrame.className = IFrameCssClass;
	my51IFrame.innerHTML = "<iframe frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\" src=\"" + url + "" + "\" style=\" width:" + width + "px; height:" + height + "px;\"></iframe>";
	document.body.appendChild(my51IFrame);
	CenterIFrame(my51IFrame);
}

function CloseIFrame()
{
	if(document.getElementById("fullbg"))
	{
		document.body.removeChild(document.getElementById("fullbg"));
	}
	if(document.getElementById("my51IFrame"))
	{
		document.body.removeChild(document.getElementById("my51IFrame"));
	}
}

function CenterIFrame(obj)
{
    var h1 = document.body.clientHeight;
    var h2 = document.documentElement.clientHeight;
    var isXhtml = (h2<=h1&&h2!=0)?true:false;
    var body = isXhtml?document.documentElement:document.body;   
    var wh={left:0,top:0};
    var vwh={w:0,h:0};
    vwh.w=$.browser.msie?parseInt(body.clientWidth):parseInt(window.innerWidth);
    vwh.h=$.browser.msie?parseInt(body.clientHeight):parseInt(window.innerHeight);
    wh.left=(vwh.w/2)-parseInt($(obj).css("width"))/2;
    wh.top=body.scrollTop+(vwh.h/2)-parseInt($(obj).css("height"))/2;
    $(obj).css("top",wh.top);
    $(obj).css("left",wh.left);
}

function isUndefined(variable)
{
	return typeof variable == 'undefined' ? true : false;
}

function mb_strlen(str) {
	var len = 0;
	for(var i = 0; i < str.length; i++) {
		len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? (/*charset == 'utf-8' ? 3 : 2*/3) : 1;
	}
	return len;
}

function setcookie(cookieName, cookieValue, seconds, path, domain, secure) {
	var expires = new Date();
	expires.setTime(expires.getTime() + seconds);
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; expires=' + expires.toGMTString() : '')
		+ (path ? '; path=' + path : '/')
		+ (domain ? '; domain=' + domain : '')
		+ (secure ? '; secure' : '');
}

function strlen(str) {
	return (is_ie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length;
}

function updatestring(str1, str2, clear) {
	str2 = '_' + str2 + '_';
	return clear ? str1.replace(str2, '') : (str1.indexOf(str2) == -1 ? str1 + str2 : str1);
}

function toggle_collapse(objname, noimg) {
	var obj = $dnt(objname);
	obj.style.display = obj.style.display == '' ? 'none' : '';
	if(!noimg) {
		var img = $dnt(objname + '_img');
		img.src = img.src.indexOf('_yes.gif') == -1 ? img.src.replace(/_no\.gif/, '_yes\.gif') : img.src.replace(/_yes\.gif/, '_no\.gif')
	}
	var collapsed = getcookie('discuz_collapse');
	collapsed =  updatestring(collapsed, objname, !obj.style.display);
	setcookie('discuz_collapse', collapsed, (collapsed ? 86400 * 30 : -(86400 * 30 * 1000)));
}

function trim(str) {
	return (str + '').replace(/(\s+)$/g, '').replace(/^\s+/g, '');
}

/*
function updateseccode() {
	type = seccodedata[2];
	var rand = Math.random();
	if(type < 2) {
		$dnt('seccodeimage').innerHTML = '<img id="seccode" onclick="updateseccode()" width="' + seccodedata[0] + '" height="' + seccodedata[1] + '" src="seccode.php?update=' + rand + '" class="absmiddle" alt="" />';
	} else {
		$dnt('seccodeimage').innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + seccodedata[0] + '" height="' + seccodedata[1] + '" align="middle">'
			+ '<param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="seccode.php?update=' + rand + '" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />'
			+ '<embed src="seccode.php?update=' + rand + '" quality="high" wmode="transparent" bgcolor="#ffffff" width="' + seccodedata[0] + '" height="' + seccodedata[1] + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	}
}

function updatesecqaa() {
	var x = new Ajax();
	x.get('ajax.php?action=updatesecqaa&inajax=1', function(s) {
		$dnt('secquestion').innerHTML = s;
	});
}
*/

function _attachEvent(obj, evt, func) {
	if(obj.addEventListener) {
		obj.addEventListener(evt, func, false);
	} else if(obj.attachEvent) {
		obj.attachEvent("on" + evt, func);
	}
}
/*Discuz!NT*/
function scrollHiddenDiv(div, scrollwidth)
{
	div.scrollLeft += scrollwidth;
}

function findtags(parentobj, tag) {
	if(!isUndefined(parentobj.getElementsByTagName)) {
		return parentobj.getElementsByTagName(tag);
	} else if(parentobj.all && parentobj.all.tags) {
		return parentobj.all.tags(tag);
	} else {
		return null;
	}
}

function getQueryString(queryname) {
    var qKeys = {};
    var re = /[?&]([^=]+)(?:=([^&]*))?/g;
    var matchInfo;
    while(matchInfo = re.exec(location.search)){
	    qKeys[matchInfo[1]] = matchInfo[2];
    }
    return typeof(qKeys[queryname])=='undefined'?'':qKeys[queryname];
}

function getUserid()
{
	// cookies are separated by semicolons
	var aCookie = document.cookie.split("; ");
	for (var i=0; i < aCookie.length; i++)
	{
		// a name alue pair (a crumb) is separated by an equal sign
		var aCrumb = aCookie[i].split("=");
		for(var j = 0; j < aCrumb.length; j++)
		{
			if ("userid" == aCrumb[j])
			{
				return aCrumb[j+1].split("&")[0];
			}
		}
	}
	// a cookie with the requested name does not exist
	return null;
}
function AutoLogin()
{
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.open("post", "/Ajax/common.aspx", true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.send("action=logininfo");
	function handleStateChange()
	{
		if(xmlHttp.readyState == 4) 
		{
			if(xmlHttp.status == 200) 
			{
				var result = xmlHttp.responseText;
				if(result != "false")
				{
					$("#loginInfo").html(result);
				}
				CustTrack("");
			}
		}
	}
}
function CustTrack(page){}
var tipText = "";
var TimeOutToolTip = null;
var TimeOutReloadToolTip = null;
/*function ShowToolTip(pic1, pic2, ref)
{
	ClearTimeOutToolTip();
	tipText = "<DIV id=\"tip\" class=\"tooltip\" style=\"FLOAT: left; PADDING-TOP: 1px;\" onmouseover=\"ClearTimeOutToolTip();\" onmouseout=\"ClearToolTip();\"><TABLE><TBODY><TR><TD><div align=\"right\"><a style=\"color:#fff;font-weight:bold;\" onclick=\"CloseToolTip();ClearTimeOutToolTip();\" href=\"javascript:void(0);\">ClOSE</a></div><div style=\"padding:15px;\"><img src=\"" + pic1 + "\" onmouseover=\"SwitchDesignPic('" + pic1 + "','" + pic2 + "', this);\" onmouseout=\"SwitchDesignPic('" + pic1 + "','" + pic2 + "', this);\" /></div></TD><TH style=\"BACKGROUND-POSITION: right top\"></TH></TR><TR><TH style=\"BACKGROUND-POSITION: left bottom\"></TH><TH style=\"BACKGROUND-POSITION: right bottom\"></TH></TR></TBODY></TABLE></DIV>";
	var tipDiv = document.createElement("div");
	tipDiv.style.display = "none";
	tipDiv.innerHTML = tipText;
	document.body.appendChild(tipDiv);
	TimeOutReloadToolTip = window.setTimeout(ReloadTip, 500);
	ReloadTip();
}*/
function ShowToolTip(pic1, pic2, ref)
{
	return;
	ClearTimeOutToolTip();
	/*var tipText = "<DIV id=\"tip\" class=\"tooltip\" style=\"FLOAT: left; PADDING-TOP: 1px;\" onmouseover=\"ClearTimeOutToolTip();\" onmouseout=\"ClearToolTip();\"><TABLE><TBODY><TR><TD><div align=\"right\"><a style=\"color:#fff;font-weight:bold;\" onclick=\"CloseToolTip();ClearTimeOutToolTip();\" href=\"javascript:void(0);\">ClOSE</a></div><div style=\"padding:15px;\"><img src=\"" + pic1 + "\" onmouseover=\"SwitchDesignPic('" + pic1 + "','" + pic2 + "', this);\" onmouseout=\"SwitchDesignPic('" + pic1 + "','" + pic2 + "', this);\" /></div></TD><TH style=\"BACKGROUND-POSITION: right top\"></TH></TR><TR><TH style=\"BACKGROUND-POSITION: left bottom\"></TH><TH style=\"BACKGROUND-POSITION: right bottom\"></TH></TR></TBODY></TABLE></DIV>";*/
	var tipText = "<DIV id=\"tip\" class=\"tooltip\" style=\"FLOAT: left; PADDING-TOP: 1px;\"><div style=\"padding:15px;\"><img src=\"" + pic1 + "\" onmouseover=\"SwitchDesignPic('" + pic1 + "','" + pic2 + "', this);\" onmouseout=\"SwitchDesignPic('" + pic1 + "','" + pic2 + "', this);\" /></div></TD><TH style=\"BACKGROUND-POSITION: right top\"></TH></TR><TR><TH style=\"BACKGROUND-POSITION: left bottom\"></TH><TH style=\"BACKGROUND-POSITION: right bottom\"></TH></DIV>";
	var tipDiv = document.getElementById("tipDiv") != null ? document.getElementById("tipDiv") : document.createElement("div");
	tipDiv.id = "tipDiv";
	tipDiv.innerHTML = tipText;
	document.body.appendChild(tipDiv);
	var MeTop = ref.offsetTop; 
	var MeLeft = ref.offsetLeft;
	while (ref = ref.offsetParent)
	{
		MeTop += ref.offsetTop;
		MeLeft += ref.offsetLeft;
	}
	tipDiv.style.position = "absolute";
	tipDiv.style.top = Number(MeTop) + 75 + "px";
	tipDiv.style.left = Number(MeLeft) + 75 + "px"; 
	tipDiv.style.display = "block";
}
function ReloadTip()
{
	Tip(tipText);
}
function ClearToolTip()
{
	return;
	CloseToolTip();
}
function ClearTimeOutToolTip()
{
	if(TimeOutToolTip != null)
	{
		window.clearTimeout(TimeOutToolTip);
	}
	if(TimeOutReloadToolTip != null)
	{
		window.clearTimeout(TimeOutReloadToolTip);
	}
}
function CloseToolTip()
{
	if(document.getElementById("tipDiv") != null)
	{
		document.getElementById("tipDiv").style.display = "none";
	}
}
function SwitchDesignPic(pic1, pic2, ref)
{
	ref.src = ref.src.indexOf(pic1) > -1 ? pic2 : pic1;
}
function FavouriteZuoPin(id)
{
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.open("post", "/Ajax/common.aspx", true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.send("action=favourite&id=" + id);
	function handleStateChange()
	{
		if(xmlHttp.readyState == 4) 
		{
			if(xmlHttp.status == 200) 
			{
				var result = xmlHttp.responseText;
				switch(result)
				{
					case "-1" : alert("收藏失败！"); break;
					case "1" : alert("作品已加入您的收藏夹！"); break;
				    case "0": if(confirm("您还没有登录，是否现在登录？")){window.location = "/user/reg.html";}; break;
				    default :  break;
				}
				$("#loading").css("display", "none");
			}
		}
		else
		{
			$("#loading").css("display", "block");
		}
	}
}

function JoinTribe(tribesID)
{
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange;xmlHttp.open("post", "/Ajax/team.aspx", true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");xmlHttp.send("action=join&trbid=" + tribesID);
	function handleStateChange() 
	{
		if(xmlHttp.readyState == 4)
		{
			if(xmlHttp.status == 200)
			{
				var result = xmlHttp.responseText;
				switch(result)
				{
					
					case "0" : if(confirm("您还没有登录，是否现在登录？")){window.location = "/user/reg.html";} break;
					case "-1" : My51_Alert("申请失败！"); break;
					case "1" : My51_Alert("您已成功加入部落！"); break;
					case "2" : My51_Alert("您的申请已提交，需要等待部落管理员的审核通过！"); break;
					default : My51_Alert("申请失败！"); break;
				}
				$("#loading").css("display","none");
			}
		}
		else
	    {
		   $("#loading").css("display","block");	
	    }	
    } 	   
}

function DelPosting(postingID)
{
	if(!confirm("您确认要删除吗?"))
	return;
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange;xmlHttp.open("post", "/Ajax/team.aspx", true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");xmlHttp.send("action=delposting&id=" + postingID);
	function handleStateChange() 
	{
		if(xmlHttp.readyState == 4)
		{
			if(xmlHttp.status == 200)
			{
				var result = xmlHttp.responseText;
				switch(result)
				{
					
					case "0" :  My51_Alert("您无权进行此项操作！"); break;
					case "-1" : My51_Alert("删除失败！"); break;
					case "1" :  if(confirm("帖子已删除，是否刷新页面？")) window.history.go(0);break;
					default : My51_Alert("删除失败！"); break;
				}
				$("#loading").css("display","none");
			}
		}
		else
	    {
		   $("#loading").css("display","block");	
	    }	
    } 	   
}

function goPage(pageName)
{
	var pageIndex = $("#txt_pageNum").attr("value");
	if(/^[0-9]*$/.test(pageIndex))
	{
		var url = window.location.toString();
		var partn = eval("/" + pageName + "=\\d/");
		if(partn.test(url))
		{
			url = url.replace(partn, pageName + "=" + pageIndex);
		}
		else
		{
			url += "?" + pageName + "=" + pageIndex;
		}
		window.location = url;
	}
}

function WriteLetter(touser)
{
	window.open("/user/message.html?to=" + touser);
}

function goQQ()
{
	window.open("http://bizapp.qq.com/webc.htm?new=0&sid=706258246&o=http://www.my51.com&q=7", "_blank", "height=502, width=644,toolbar=no,scrollbars=no,menubar=no,status=no");
}

function DrawImage(ImgD,FitWidth,FitHeight){     
var image=new Image(); image.src=ImgD.src;  
if(image.width>0 && image.height>0)
{        
	if(image.width/image.height>= FitWidth/FitHeight)
	{           
	    if(image.width>FitWidth)
	    { 
			ImgD.width=FitWidth; ImgD.height=(image.height*FitWidth)/image.width;
		}
	    else
	    {
			ImgD.width=image.width;ImgD.height=image.height;
		}
	 } 
	 else
	 {
		if(image.height>FitHeight)
		{ 
	        ImgD.height=FitHeight;  
	        ImgD.width=(image.width*FitHeight)/image.height;
	    }
	    else
	    { 
		  ImgD.width=image.width;ImgD.height=image.height; 
		}
	 }
}
} 
	     
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_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 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_swapImage2() { //v3.0
  var i,j=0,x,a=MM_swapImage2.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_swapImage3() { //v3.0
  var i,j=0,x,a=MM_swapImage3.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 PreviewImg(theimg,img_id,img)
{
 document.getElementById(img).style.display = "none";
 var img = document.getElementById(img_id);
 img.style.display = "block";
 img.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = theimg.value;
 img.style.width = img.offsetWidth;
 img.style.height = img.offsetHeight;
 img.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").sizingMethod = 'scale';
}        
  
function getQueryString(key)
{
	var locString = location.search;
	var reg = new RegExp("(\\?|\\&)" + key + "=([^\\&]*)(\\&?)","i").exec(locString);
	return unescape(RegExp.$2);
}
function SearchZuopin()
{
	var key = $("#txtKey").attr("value");
	if(key == undefined || key == "" || key == "请输入关键字")
	{
		alert("请输入关键字！");
		return;
	}
	else
	{
		window.location = "/chuangyi/search.html?kw=" + escape($("#txtKey").attr("value"));
	}
}
function SearchTeam()
{
	var key = $("#txtKey").attr("value");
	if(key == undefined || key == "" || key == "请输入关键字")
	{
		alert("请输入关键字！");
		return;
	}
	else
	{
		window.location = "/team/search.html?key=" + escape($("#txtKey").attr("value"));
	}
}
function SearchPosting()
{
	var key = $("#txtKey").attr("value");
	if(key == undefined || key == "" || key == "请输入关键字")
	{
		alert("请输入关键字！");
		return;
	}
	else
	{
		window.location = "/team/postingsearch.html?key=" + escape($("#txtKey").attr("value"));
	}
}
function PreviewImgs(theimg,img)
{
var newPreview = document.getElementById(img);
newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = theimg.value;
img.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").sizingMethod = 'scale';
} 

function openwin(url,swidth,sheight)
{
    splashWin= window.showModalDialog(url,window,'dialogHeight:'+swidth+'px;dialogWidth:'+sheight+'px;center:Yes;help:No;scroll:auto;resizable:No;status:No;');
}

function openwins(url,swidth,sheight)
{
    splashWin= window.showModalDialog(url,window,'dialogHeight:'+swidth+'px;dialogWidth:'+sheight+'px;center:Yes;help:No;scroll:auto;resizable:No;status:No;'); 
}

function openwin_modelless(url,swidth,sheight)
{
    splashWin= window.showModelessDialog(url,window,'dialogHeight:'+swidth+'px;dialogWidth:'+sheight+'px;center:Yes;help:No;scroll:Auto;resizable:No;status:No;');
}

function switch_ad(menuid)
{
   for(var i = 1; i < menuid; i ++)
   {
	   $("#admenu" + i.toString()).attr("class","admenudefault_top");
   }
   for(var i = menuid + 1; i <= 4; i ++)
   {
	   $("#admenu" + i.toString()).attr("class","admenudefault_bottom");
   }
   $("#admenu" + menuid.toString()).attr("class","admenucurrent");
   $("#chuangyi_adimg").attr("src", "../adsimg/chuangyi_adtop" + menuid.toString() + ".jpg")
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

<!-- 客户端验证
   function ShowTitle(refer,msg,node)
{
	<!--显示提示输入框里的内容和背景颜色
	var obj = document.getElementById(node);
	obj.innerHTML=msg;
	obj.style.borderColor="#F5D247";
	obj.style.backgroundColor="#FFFFFF";
	-->
}
function ShowError(refer,msg,node)
{
	<!--显示输入错误时提示内容和背景颜色
	var obj = document.getElementById(node);
	obj.innerHTML='<img src="../image/error.gif" alt="" />'+msg;
	obj.style.borderColor="red";
	obj.style.backgroundColor="#feeeed";
	-->
}
function ShowRight(refer,msg,node)
{
	<!--显示输入正确时提示内容和背景颜色
	var obj = document.getElementById(node);
	obj.innerHTML='<img src="../image/ok.gif" alt="" />'+msg;
	obj.style.borderColor="green";
	obj.style.backgroundColor="#ECFFEC";
	-->
}

function isChinese(name) 
{ 
	if(name.length == 0)
	return false;
	for(i = 0; i < name.length; i++) { 
	if(name.charCodeAt(i) > 128)
	return true;
	}
	return false;
}

var KeyIndex = -1;
function Mack_KeyIndex()
{
	KeyIndex += 1;
	document.write(KeyIndex);
}

var current_path;
function login(v,m)
{
	if(v)
	{
		window.location = current_path + "/user/reg.aspx";
	}
}

var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
	xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
	xmlHttp = new XMLHttpRequest();
}
}

function startRequest(url) 
{
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange;
	xmlHttp.open("post", url, true);
	xmlHttp.send(null);
}

function return_value(v,m)
{
   return v;
}

function VerifyCode(CodeName,CodeValue)
{
	if(CodeValue == "")
	{
		My51_Alert("请填写验证码！");
		return;
	}
    createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange_VerifyCode;
	xmlHttp.open("post", "Ajax_VerifyCode.aspx", true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.send("CodeName=" + CodeName + "&CodeValue=" + CodeValue);
}

function handleStateChange_VerifyCode()
{
	if(xmlHttp.readyState == 4) 
	{
		if(xmlHttp.status == 200) 
		{
			var result = xmlHttp.responseText;
			switch(result)
			{
			   case "0" : My51_Alert("验证码错误！"); break;
			   default :  break;
			}
			
		}
	}
}

function Send_Msg(toUser,title,content,code)
{
    createXMLHttpRequest();
	xmlHttp.onreadystatechange = handleStateChange_SendMsg;
	xmlHttp.open("post", Current_Path + "/user/Ajax_SendMsg.aspx", true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.send("to_user=" + toUser + "&title=" + title + "&msg=" + content + "&code=" + code);
}

function handleStateChange_SendMsg()
{
	if(xmlHttp.readyState == 4) 
	{
		if(xmlHttp.status == 200) 
		{
			var result = xmlHttp.responseText;
			switch(result)
			{
			   case "0" : check_Login(Current_Path); break;
			   case "1" : My51_Alert("信件已成功发出！");add_area_display(false); break;
			   case "2" : My51_Alert("收信人不存在！"); break;
			   case "3" : My51_Alert("验证码错误！"); break;
			   case "-1": My51_Alert("信件发送失败！"); break;
			   default : My51_Alert("未知错误,发送失败！"); break;
			}
			RefreshCode("LogCode");
		}
	}
}

var hash=window.location.hash;
hash=hash.substring(1,hash.length);
var arr=hash.split('#')[0].split('/');
keyValue=arr[0].split('.')[1];
function pageload()
{
    if(keyValue)
        showList(keyValue);
    else
        showList(0);
}
function showMsg(msg,w)
{
    document.getElementById("Loding_Msg").style.display="block";
    document.getElementById("Loding_Msg").innerHTML= "<img src=\"../img/loading_16x16.gif\" />" + msg;
    if(w==1)
        setTimeout(closeMsg,5000);
}
function closeMsg()
{
    document.getElementById("Loding_Msg").innerHTML="";
    document.getElementById("Loding_Msg").style.display="none";
}
function Refresh_Code()
{
   document.getElementById("img_code").src = "../VerifyCode.aspx?r=" + Math.random();
}

function RefreshCode(LoginCode)
{
   $("#" + LoginCode).attr("src","../VerifyCode.aspx?CodeName=" + LoginCode + "&r=" + Math.random());
}


function check_Login(path)
{
	<!--
	current_path = path;
	try
	{
	   $.prompt("你还没有登录,是否登录?",{callback: login, buttons: { '确定': true, '取消': false } });
	}catch(e){}
	-->
}
	
function My51_Logion(path)
{
	if(confirm("你还没有登录，是否登录?"))
	{
		window.location = current_path + "/user/reg.aspx";
	}
}

function My51_Confirm(msg,CallBack_function)
{
   if(confirm(msg))
   {
	   CallBack_function;
   }
}
function My51_Alert(msg)
{
	alert(msg);
}