//QQ:75314404
//@daqzrc.com
//更新alert的弹出方式
//测试在：IE6+通过
function showAlert(title,html,w,h,s)
{
    var obj = document.createElement("div");
	var closeLabel='<div style="float:right; padding-top:8px;"><img src="/style/images/close1.jpg" class="hand"  onClick="closeForm(\''+s+'\');" /></div>';
	if(s.indexOf('.close()')!=-1) closeLabel='<div style="float:right; padding-top:8px;"><img src="/style/images/close1.jpg" class="hand" onClick="closePage()" /></div>';
    obj.id="filter";
    obj.innerHTML = '<div id="dmask" style="z-index:10000; display:block; background:#000; filter:alpha(opacity=70); -moz-opacity:0.7; opacity:0.7; position:absolute; visibility:hidden;"></div>\
        <div id="frmmask" style="z-index:9999; display:block; background:#000; filter:alpha(opacity=0); -moz-opacity:0; opacity:0; position:absolute; visibility:hidden;"></div>\
        <div id="frmDialog" style=" background-image:url(/style/images/popbg.jpg); background-repeat:no-repeat;border: 12px solid #DCDDDE;background-color:#FFFFFF; vertical-align:middle;height:68px; width:455px!important; width:500px; padding:10px;z-index: 10010; position: absolute; display: block; visibility: hidden;">\
			<div id="showmessage" style="color:#0274C3;height:48px; width:auto; ">\
				<div style="width:auto;">\
					<div style="color:#0274C3;height:30px; padding:8px; width:auto; text-align:left; color:#333333; float:left;" class="font14"><b>\
					'+title+'</b></div>'+closeLabel+'</div>\
				<div style="clear:both; background-image:url(/Images/altbg.jpg); width:auto;height:1px; overflow:hidden; margin:8px 0px 0px 0px;"></div>\
				<div style="color:#0274C3;height:48px; width:auto; padding:10px; text-align:left; line-height:180%;" class="font12">\
					'+html+'</div>\
		</div>';
    document.body.appendChild(obj);
	//if(document.getElementById("CategoryID")) $get("CategoryID").disabled=true;
	if(document.getElementById("LoginRightFrm")) LoginRightFrm.ExpireNum.disabled=true;
    showMask(true,w,h);
}
function showMask(show,widthVal,heightVal)
{
	setSelectState(true);
	var mask = document.getElementById('dmask');
	var frmmask = document.getElementById('frmmask');
	var frmDialog=document.getElementById('frmDialog');
	if(mask && frmmask)
	{
		var width = document.body.scrollWidth;
		if(width < document.body.clientWidth)
			width = document.body.clientWidth;
		if(width < document.documentElement.clientWidth)
			width = document.documentElement.clientWidth;
		if(width < document.documentElement.scrollWidth)
			width = document.documentElement.scrollWidth;
			
		var height = document.body.scrollHeight;
		if(height < document.body.clientHeight)
			height = document.body.clientHeight;
		if(height < document.documentElement.clientHeight)
			height = document.documentElement.clientHeight;
		if(height < document.documentElement.scrollHeight)
			height = document.documentElement.scrollHeight;
		mask.style.top = '0px';
		mask.style.left = '0px';
		mask.style.width = width + 'px';
		mask.style.height = height + 'px';
		
		frmmask.style.top = '0px';
		frmmask.style.left = '0px';
		frmmask.style.width = width + 'px';
		frmmask.style.height = height + 'px';

		if(show)
		{
			mask.style.visibility = 'visible';
			frmmask.style.visibility = 'visible';
			frmDialog.style.visibility = 'visible';
		}else
		{
			mask.style.visibility = 'hidden';
			frmmask.style.visibility = 'hidden';
			frmDialog.style.visibility = 'hidden';
		}
	}
	var width=widthVal;
	var height=heightVal;
	var top = (window.screen.height/2 + (document.body.scrollTop>document.documentElement.scrollTop ? document.body.scrollTop:document.documentElement.scrollTop) - height/2 - 100)>0?(window.screen.height/2 + (document.body.scrollTop>document.documentElement.scrollTop ? document.body.scrollTop:document.documentElement.scrollTop) - height/2 - 100):0;
	var left = (window.screen.width/2 + (document.body.scrollLeft>document.documentElement.scrollLeft ? document.body.scrollLeft:document.documentElement.scrollLeft) - width/2)>0?(window.screen.width/2 + (document.body.scrollLeft>document.documentElement.scrollLeft ? document.body.scrollLeft:document.documentElement.scrollLeft) - width/2):0;
	frmDialog.style.top = top + 'px';
	frmDialog.style.left = left + 'px';
	//frmDialog.style.width = width + 'px';
	frmDialog.style.height = height + 'px';
	document.body.style.overflow='hidden';
}
function closeForm(sym)
{
	$("select").show();
	if(sym!="")
	{
		eval(sym);
		if(sym.indexOf(".close()")!=-1) return false;
	}
	setSelectState(false);
    var objF = document.getElementById("filter");
    if(objF)
    {
        document.body.removeChild(objF);
		document.body.style.overflow='';
    }
	//if(document.getElementById("CategoryID")) $get("CategoryID").disabled=false;
	if(document.getElementById("LoginRightFrm")) LoginRightFrm.ExpireNum.disabled=false;
}
function setSelectState(bool)
{
	var objs=document.getElementsByTagName("SELECT");
	for(var i=0;i<objs.length;i++)
	{
		//objs[i].disabled=bool;
	}
}
//==============================可调用的函数=============================
function showMessage()
{
	//没有使用
}
function listTc()
{
	var s=ptc;
	var altHtml='<div style="width:760px; height:450px; overflow:scroll;">'+s+'</div>\
					  <div style="text-align:center;padding-top:15px;"><input type="button" style="font-size:12px; cursor:pointer;" name="Submit" value="　关　闭　！" class="font12 hand" onClick="closeForm(\'\');" /></div>\
				</div>';
	showAlert("相关技术说明：",altHtml,800,500,"");
}
function listPhotoTechText(response)
{
	var s=response.replace("NULL","");
	var altHtml='<input name="Content1" type="hidden" id="Content1" value="'+s+'">\
					<input type="hidden" name="maxLine" id="maxLine" value="1">\
					<IFRAME ID="eWebEditor" src="/editor/ewebeditor.asp?id=Content1&style=1" frameborder="0" scrolling="no" width="100%" height="320"></IFRAME>\
					<div align="center" style="margin-top:5px;">\
					  <input type="button" style="font-size:12px; cursor:pointer;" name="Submit" onclick="saveTechText();closeForm(\'\');" value="确认编辑完成！" />&nbsp;&nbsp;<input type="button" style="font-size:12px; cursor:pointer;" name="Submit" value="取消保存！" class="font12 hand" onClick="closeForm(\'\');" />\
					</div>';
	showAlert("输入技术说明：",altHtml,620,340,"");
	eWebEditor.focus();	
}
function showSearch()
{
	var sel="<SELECT class=font12 id=CategoryID name=CategoryID>"+$get("CategoryID").innerHTML+"</SELECT>";
	var altHtml='<div style="color:#0274C3;height:48px; width:auto; padding:10px; text-align:left; line-height:180%;" class="font12"><form action="SearchList.asp" method="get" id="searchForm" name="searchForm">\
					分　　类：'+sel+'<div style=" height:4px; overflow:hidden;"></div>\
					关&nbsp;键&nbsp;字：<input title="查询多个关键字，请使用空格隔开！" name="Keyword" type="text" id="Keyword" style="width:180px;" class="font12" maxlength="20"><div style=" height:4px; overflow:hidden;"></div>\
					发布日期：<input name="SDate" type="text" class="font12" id="SDate" style="width:100px;"><img src="Images/clock.gif" align="absmiddle" border="0" hspace="2" class="hand" onClick="return getClientDate($get(\'SDate\'));">－<input name="EDate" class="font12" type="text" id="EDate" style="width:100px;"><img src="Images/clock.gif" align="absmiddle" border="0" hspace="2" class="hand" onClick="return getClientDate($get(\'EDate\'));">\
				</div>\
				<div style="width:auto; text-align:center;">\
					<input type="submit" value=" 点击搜索 " class="font12 hand" />&nbsp;<input type="button" value=" 关闭窗口 " class="font12 hand" onClick="closeForm(\'\');" />\
				</div></form>\
				</div>';
	showAlert("高级查询：",altHtml,500,180,"");
}
function showBaikeReply(ID)
{
	var altHtml='<div style="color:#0274C3;height:48px; width:100%; padding:10px; text-align:left; line-height:180%;" class="font12"><form action="BaikeList.asp" method="post" id="BaikeForm" name="BaikeForm">\
					回答如下：<div style=" height:4px; overflow:hidden;"></div>\
					<textarea name="ReplyContent" rows="8" class="font12" id="ReplyContent" style="width:430px;"></textarea>\
	    			<input name="ReplyBaikeID" type="hidden" id="ReplyBaikeID" value="'+ID+'">\
	    			<input name="act" type="hidden" id="act" value="Reply">\
				</div>\
				<div style="width:auto; text-align:center;">\
					<input type="submit" value=" 确认回答 " class="font12 hand" />&nbsp;<input type="button" value=" 关闭窗口 " class="font12 hand" onClick="closeForm(\'\');" />\
				</div></form>\
				</div>';
	showAlert("百科回答：",altHtml,500,180,"");
}
function showBaikeAppend(ID)
{
	var altHtml='<div style="color:#0274C3;height:48px; width:100%; padding:10px; text-align:left; line-height:180%;" class="font12"><form action="BaikeList.asp" method="post" id="BaikeForm" name="BaikeForm">\
					补充如下：<div style=" height:4px; overflow:hidden;"></div>\
					<textarea name="Content" rows="8" class="font12" id="Content" style="width:430px;"></textarea>\
	    			<input name="BaikeID" type="hidden" id="BaikeID" value="'+ID+'">\
	    			<input name="act" type="hidden" id="act" value="Append">\
				</div>\
				<div style="width:auto; text-align:center;">\
					<input type="submit" value=" 确认补充 " class="font12 hand" />&nbsp;<input type="button" value=" 关闭窗口 " class="font12 hand" onClick="closeForm(\'\');" />\
				</div></form>\
				</div>';
	showAlert("百科问题补充：",altHtml,500,180,"");
}
var memberIsLogin = false;
var isShowWindow = true;
function showLoginFrame(clearPrevFrame,url,action)
{
	if(action == 'isCus'){
		action = '';
		isShowWindow = false;
	}
	if(clearPrevFrame)closeForm("");
	var dc=document.cookie.toLowerCase();
	var ume="";
	if (dc.indexOf("tg=")!=-1) ume=unescape(dc.substring(dc.indexOf("tg=")+3).split(";")[0]);
	var codesrc="";
	var timenow = new Date().getTime();
	if(document.getElementById("vcode")) codesrc=$("vcode").src
	else codesrc="rand!frontVerificationCode.do?d="+timenow;
	var altHtml='<div style="color:#0274C3; width:auto; *padding:10px; text-align:left; line-height:180%;" class="font12"><form method="post" id="altLoginFrm" name="altLoginFrm" onsubmit="return ckAltLoginFrm(this);">\
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;用户名：<INPUT name="u" class="textstyle1" id="u" style="WIDTH: 122px" maxlength="20" value="'+ume+'"><div style=" height:4px; overflow:hidden;"></div>\
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;密　码：<INPUT name="p" type=password class="textstyle1" id="p" style="WIDTH: 122px" maxlength="20"><div style=" height:4px; overflow:hidden;"></div>\
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;验证码：<INPUT name="code" class="textstyle1" id="code" style="WIDTH: 60px" maxlength="4" onkeydown="loginKeyDown()">&nbsp;<span style="padding:3px 0 3px 0; background-color:#FFFFFF;">\
					<img id="codes" src="" onClick="changeCode()" border="0" align="absmiddle" style="cursor:pointer; "/></span><div style=" height:4px; overflow:hidden;"></div>\
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;保　存：<SELECT name="ExpireNum" class="font12" id="ExpireNum">\
						<OPTION value=0 selected>不保存</OPTION>\
						<OPTION value=1>一天</OPTION>\
						<OPTION value=7>一周</OPTION>\
						<OPTION value=30>一月</OPTION>\
					</SELECT>\
					<input name="URL" type="hidden" id="URL" value="'+url+'" />\
				</div>\
				<div style="width:auto; text-align:center;margin-top: 1px;">\
					<input type="button" onclick="ajaxMemberLogin()" value=" 登录系统 " class="font12 hand" />&nbsp;<input type="button" value=" 关闭窗口 " class="font12 hand" onClick="closeForm(\''+action+'\');" />&nbsp;<a href="/License.jsp" style="color:#0274C3;">我要注册&gt;&gt;</a>\
				</div></form>\
				</div>';
	showAlert("会员登录：",altHtml,500,205,action);
	changeCode();
	$("#orders").hide();
}
var time = 5;
function showGoMemberManagerFrame(clearPrevFrame,url,action)
{
	if(clearPrevFrame)closeForm("");
	var dc=document.cookie.toLowerCase();
	var ume="";
	if (dc.indexOf("tg=")!=-1) ume=unescape(dc.substring(dc.indexOf("tg=")+3).split(";")[0]);
	var codesrc="";
	var timenow = new Date().getTime();
	if(document.getElementById("vcode")) codesrc=$("vcode").src
	else codesrc="rand!frontVerificationCode.do?d="+timenow;
	var altHtml='<div style="color:#0274C3; width:auto; padding:10px; text-align:left; line-height:180%;" class="font12"><form method="post" id="altLoginFrm" name="altLoginFrm" onsubmit="return ckAltLoginFrm(this);">\
					<font style="width=100%;text-align:center;color:blue;">欢迎回到工艺资源网! <font id="timeFont" style="color:red;">5</font>秒后返回登录前页面</font>\
				</div>\
				<div style="width:auto; text-align:center;margin-top: 1px;">\
				<input type="button" value=" 浏览当前内容 " class="font12 hand" onClick="location.reload()" />&nbsp;<input type="button" onclick="toMemberManager()" value=" 进入会员中心 " class="font12 hand" />&nbsp;\
				</div></form>\
				</div>';
	showAlert("会员登录：",altHtml,500,120,action);
	$("#orders").hide();
	countDown(time);
}
function showRegMemberFrame(clearPrevFrame,url,action)
{
	if(clearPrevFrame)closeForm("");
	var dc=document.cookie.toLowerCase();
	var ume="";
	if (dc.indexOf("tg=")!=-1) ume=unescape(dc.substring(dc.indexOf("tg=")+3).split(";")[0]);
	var codesrc="";
	var timenow = new Date().getTime();
	if(document.getElementById("vcode")) codesrc=$("vcode").src
	else codesrc="rand!frontVerificationCode.do?d="+timenow;
	var altHtml='<div style="color:#0274C3; width:auto; padding:10px; text-align:left; line-height:180%;" class="font12"><form method="post" id="altLoginFrm" name="altLoginFrm" onsubmit="return ckAltLoginFrm(this);">\
					<font style="width=100%;text-align:center;color:blue;">恭喜您注册成功! <font id="regTimeFont" style="color:red;">5</font>秒后返回首页</font>\
				</div>\
				<div style="width:auto; text-align:center;margin-top: 1px;">\
					<input type="button" onClick="location.href=\'index.jsp\'" value=" 返回首页 " class="font12 hand" />&nbsp;<input type="button" value=" 进入会员中心 " class="font12 hand" onclick="toMemberManager()" />&nbsp;\
				</div></form>\
				</div>';
	showAlert("会员注册：",altHtml,500,180,action);
	regCountDown(time);
}
function showCostomContentFrame(partName,keyWord,url,action)
{
	var altHtml='<div style="color:#0274C3; width:auto; padding:10px; text-align:left; line-height:180%;" class="font12"><form method="post" id="altLoginFrm" name="altLoginFrm" onsubmit="return ckAltLoginFrm(this);">\
					<font style="width=100%;text-align:center;color:blue;">恭喜您定制内容成功!</font><br />\
					<font style="width=100%;text-align:center;color:blue;">您已定制了 ' + partName + ' 栏目下 ' + keyWord + '</font>\
				</div>\
				<div style="width:auto; text-align:center;margin-top: 1px;">\
					<input type="button" onClick="closeForm(\''+action+'\');" value=" 继续定制 " class="font12 hand" />&nbsp;<input type="button" value=" 查看效果 " class="font12 hand" onclick="location.href=\'/index.jsp\';" />&nbsp;\
				</div></form>\
				</div>';
	showAlert("定制提示：",altHtml,500,180,action);
}
function delCostomContentFrame(keyWord,objid)
{
	var action = '';
	var altHtml='<div style="color:#0274C3; width:auto; padding:10px; text-align:left; line-height:180%;" class="font12">\
					<font style="width=100%;text-align:center;">您确定要删除 <font style="color: red;">' + keyWord + '</font> 此条定制内容吗?</font>\
				</div>\
				<div style="width:auto; text-align:center;margin-top: 1px;">\
					<input type="button" onClick="closeForm(\''+action+'\');" value=" 否,我按错了. " class="font12 hand" />&nbsp;<input type="button" value=" 是,我不要了. " class="font12 hand" onclick="removeCustomContent(true,' + objid + ');" />&nbsp;\
				</div>\
				</div>';
	showAlert("定制提示：",altHtml,500,150,action);
}
function toMemberManager(){
	location.href="member!frontGetMemberIndex.do";
}
function countDown(){
	document.getElementById("timeFont").innerHTML = time;
	if (time <= 0){
		location.reload();
	}else{
		setTimeout('countDown()',1000);
	}
	time --;
}
function regCountDown(){
	document.getElementById("regTimeFont").innerHTML = time;
	if (time <= 0){
		location.href="/index.jsp";
	}else{
		setTimeout('regCountDown()',1000);
	}
	time --;
}
/*function showLoginFrame(clearPrevFrame,url,action)
{
	if(clearPrevFrame)closeForm("");
	var dc=document.cookie.toLowerCase();
	var ume = "";
	if(getCookies("unm") != null && getCookies("unm") != ""){
		ume = getCookies("unm");
	}
	var upw = "";
	if(getCookies("upw") != null && getCookies("upw") != ""){
		upw = getCookies("upw");
	}
	var codesrc="";
	var altHtml='<div style="color:#0274C3;height:48px; width:auto; padding:10px; text-align:left; line-height:180%;" class="font12">\
					<form method="post" id="altLoginFrm" name="altLoginFrm">\
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;用户名：<INPUT name="userName" class="textstyle1" id="u" style="WIDTH: 122px" onkeydown="loginKeyDown()" maxlength="20" value="'+ume+'"><div style=" height:4px; overflow:hidden;"></div>\
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;密　码：<INPUT name="passWord" type=password class="textstyle1" onkeydown="loginKeyDown()" id="p" style="WIDTH: 122px" value="' + upw + '" maxlength="20"><div style=" height:4px; overflow:hidden;"></div>\
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;验证码：<INPUT name="code" class="textstyle1" id="code" style="WIDTH: 60px" maxlength="6" onkeydown="loginKeyDown()">&nbsp;<span style="padding:3px 0 3px 0; background-color:#FFFFFF;">\
					<img id="codes" src="" onClick="changeCode()" border="0" align="absmiddle" style="cursor:pointer; "/></span><div style=" height:4px; overflow:hidden;"></div>\
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;保　存：<SELECT name="ExpireNum" class="font12" id="ExpireNum">\
						<OPTION value=0 selected>不保存</OPTION>\
						<OPTION value=1>一天</OPTION>\
						<OPTION value=7>一周</OPTION>\
						<OPTION value=30>一月</OPTION>\
					</SELECT>\
					<input name="URL" type="hidden" id="URL" value="'+url+'" />\
				</div>\
				<div style="width:auto; text-align:center;">\
					<input type="button" onclick="ajaxMemberLogin()" value=" 登录系统 " class="font12 hand" />&nbsp;<input type="button" value=" 关闭窗口 " class="font12 hand" onClick="closePage()" />&nbsp;<a href="/License.jsp" style="color:#0274C3;">我要注册&gt;&gt;</a>\
				</div></form>\
				</div>'
	showAlert("会员登录：",altHtml,500,180,action);
	changeCode();
	$("#orders").hide();
}*/
function closePage(){
	$("select").show();
	window.close();
}
//==================================页面查看友情提示==================================
function thumbErrorMessage(n)
{
	if(n==1)//还没登录
	{
		var altHtml='<div style="color:#0274C3;height:48px; width:100%; padding:10px; text-align:left; line-height:180%;" class="font12"><form action="BaikeList.asp" method="post" id="BaikeForm" name="BaikeForm">\
						您还未登录，不能查看全部免费小图。<div style=" height:4px; overflow:hidden;"></div>\
						如果确认您已有本站账户，请点击“立即登录”。<div style=" height:4px; overflow:hidden;"></div>\
						如果您没有注册本站的登录账户，请进入“免费注册”，谢谢合作！<div style=" height:4px; overflow:hidden;"></div>\
					</div>\
					<div style="width:auto; text-align:center;">\
						<input type="button" value=" 立即登录 " class="font12 hand" onclick="showLoginFrame(true,\''+escape(location.href)+'\',\'history.back();\');" />&nbsp;<input type="button" value=" 免费注册 " class="font12 hand" onclick="location.href=\'/License.jsp\';" />\
					</div></form>\
					</div>';
		showAlert("友情提示：",altHtml,500,205,"history.back();");
	}
	else//点数不足，权限不足，已经过期
	{
		var url=location.href.replace(/\&CurPage\=[0-9]{1,}/gi,"");
		var altHtml='<div style="color:#0274C3;height:48px; width:100%; padding:10px; text-align:left; line-height:180%;" class="font12">\
						您浏览权限不足或账户过期或点数不足，请联系您的服务代表，或致电<b>0595-22561488</b>。<div style=" height:4px; overflow:hidden;"></div>\
						福州：<b>0591-62086815</b> 德化：<b>18905050542</b> <div style=" height:2px; overflow:hidden;"></div>\台州：<b>0576-85466680</b> 潮州：<b>0768-6898827</b>。<div style=" height:4px; overflow:hidden;"></div>\
						为了更快获得服务，请就近联系各个地区的服务代表，谢谢合作！<div style=" height:4px; overflow:hidden;"></div>\
					</div>\
					<div style="width:auto; text-align:center;">\
						<input type="button" value=" 点击确认 " class="font12 hand" onclick="location.href=\''+url+'\';" />\
					</div>\
					</div>';
		showAlert("友情提示：",altHtml,500,205,"history.back();");
	}
}
function ViewPhotoErrorMessage(n)
{
	if(n==4)//无权限时
	{
		var altHtml='<div style="color:#0274C3; width:100%; text-align:left; line-height:180%;" class="font12">\
						该页面需要更高级别会员，请联系您的服务代表或致电<b>0595-22561488</b>升级。<div style=" height:4px; overflow:hidden;"></div>\
						福州：<b>0591-62086815</b> 德化：<b>18905050542</b> <div style=" height:2px; overflow:hidden;"></div>\台州：<b>0576-85466680</b> 潮州：<b>0768-6898827</b>。<div style=" height:4px; overflow:hidden;"></div>\
						为了更快获得服务，请就近联系各个地区的服务代表，谢谢合作！<div style=" height:4px; overflow:hidden;"></div>\
					</div>\
					<div style="width:auto; text-align:center;">\
						<input type="button" value=" 回到首页 " class="font12 hand" onclick="location.href=\'/\';" />&nbsp;<input type="button" value=" 关闭页面 " class="font12 hand" onclick="closePage()" />\
					</div>\
					</div>';
		showAlert("友情提示：",altHtml,500,205,"closePage()");
	}
	else if(n==46)//无原创点
	{
		var altHtml='<div style="color:#0274C3; width:100%; text-align:left; line-height:180%;" class="font12">\
						该内容需要原创点数，请联系您的服务代表或致电<b>0595-22561488</b>升级。<div style=" height:4px; overflow:hidden;"></div>\
						福州：<b>0591-62086815</b> 德化：<b>18905050542</b> <div style=" height:2px; overflow:hidden;"></div>\台州：<b>0576-85466680</b> 潮州：<b>0768-6898827</b>。<div style=" height:4px; overflow:hidden;"></div>\
						为了更快获得服务，请就近联系各个地区的服务代表，谢谢合作！<div style=" height:4px; overflow:hidden;"></div>\
					</div>\
					<div style="width:auto; text-align:center;">\
						<input type="button" value=" 回到首页 " class="font12 hand" onclick="location.href=\'/\';" />&nbsp;<input type="button" value=" 关闭页面 " class="font12 hand" onclick="closePage()" />\
					</div>\
					</div>';
		showAlert("友情提示：",altHtml,500,205,"closePage()");
	}
	else if(n==5)//无权限，且来自博客的点击
	{
		var altHtml='<div style="color:#0274C3; width:100%; text-align:left; line-height:180%;" class="font12"><form action="BaikeList.asp" method="post" id="BaikeForm" name="BaikeForm">\
						如果未登录<a href="/" onclick="showLoginFrame(true,\''+escape(location.href)+'\',\'closePage()\');return false;" style="color:#0274C3;">请您点击这里<b>登录</b></a>，还没用户名<a href="/License.jsp" style="color:#0274C3;">请点这里<b>免费注册</b></a>。<div style=" height:4px; overflow:hidden;"></div>\
						如果您已登录，则还未经博客主人授权或已过期，请查看【关于我】中的联系方式与博主联系，或致电：<b>0595-22561488</b>。<div style=" height:4px; overflow:hidden;"></div>\
						福州：<b>0591-62086815</b> 德化：<b>18905050542</b> <div style=" height:2px; overflow:hidden;"></div>\台州：<b>0576-85466680</b> 潮州：<b>0768-6898827</b>。<div style=" height:4px; overflow:hidden;"></div>\
					</div>\
					<div style="width:auto; text-align:center;">\
						<input type="button" value=" 回到首页 " class="font12 hand" onclick="location.href=\'/\';" />&nbsp;<input type="button" value=" 关闭页面 " class="font12 hand" onclick="closePage()" />\
					</div></form>\
					</div>';
		showAlert("友情提示：",altHtml,500,205,"closePage()");
	}
	else//未登录，过期会员，点数不够
	{
		var altHtml='<div style="color:#0274C3; width:100%; text-align:left; line-height:180%;" class="font12"><form action="BaikeList.asp" method="post" id="BaikeForm" name="BaikeForm">\
						如果未登录<a href="/" onclick="showLoginFrame(true,\''+escape(location.href)+'\',\'closePage()\');return false;" style="color:#0274C3;">请您点击这里<b>登录</b></a>，还没用户名<a href="/License.jsp" style="color:#0274C3;">请点这里<b>免费注册</b></a>。<div style=" height:4px; overflow:hidden;"></div>\
						如果已登录，则浏览该页面的权限不足或已经过期或点数不足。请联系您的服务代表，或致电<b>0595-22561488</b>。<div style=" height:4px; overflow:hidden;"></div>\
						福州：<b>0591-62086815</b> 德化：<b>18905050542</b> <div style=" height:2px; overflow:hidden;"></div>\台州：<b>0576-85466680</b> 潮州：<b>0768-6898827</b>。<div style=" height:4px; overflow:hidden;"></div>\
					</div>\
					<div style="width:auto; text-align:center;">\
						<input type="button" value=" 回到首页 " class="font12 hand" onclick="location.href=\'/\';" />&nbsp;<input type="button" value=" 立即登录 " class="font12 hand" onclick="showLoginFrame(true,\''+escape(location.href)+'\',\'history.back();\');" />&nbsp;<input type="button" value=" 免费注册 " class="font12 hand" onclick="location.href=\'/License.jsp\';" />\
					</div></form>\
					</div>';
		showAlert("友情提示：",altHtml,455,205,"closePage()");
	}
}
//=======================Alt的会员登录提示=======================================
function ckAltLoginFrm(frm)
{
	var txtvalue=frm.u.value;
	if(isEmpty(txtvalue))
	{
		alert("对不起，请输入有效的登录用户名，谢谢！");
		frm.u.focus();
		return false;
	}
	txtvalue=frm.p.value;
	if(isEmpty(txtvalue))
	{
		alert("对不起，请输入有效的登录密码，谢谢！");
		frm.p.focus();
		return false;
	}
	txtvalue=frm.code.value;
	if(!isNumber(txtvalue)||txtvalue.toString().length!=4)
	{
		alert("对不起，请输入有效的验证码信息，谢谢！");
		frm.code.focus();
		return false;
	}
	return true;
}
function changeCode() {   
    var timenow = new Date().getTime();   
    document.all("codes").src="rand!frontVerificationCode.do?d="+timenow;
} 
function isEmpty(v)
{
	return (v=="")?true:false;
}
function isNumber(v)
{
	var fl="0123456789";
	var chars="";
	if (isEmpty(v)) return false;
	for(var i=0;i<v.length;i++)
	{
		chars=v.substring(i,i+1);
		if (fl.indexOf(chars)==-1)
		{
			return false;
			break;
		}
	}
	return true;
}
function ajaxMemberLogin(){
	var frm = document.getElementById("altLoginFrm");
	var txtvalue=frm.u.value;
	if(isEmpty(txtvalue))
	{
		alert("对不起，请输入有效的登录用户名，谢谢！");
		frm.u.focus();
		return false;
	}
	txtvalue=frm.p.value;
	if(isEmpty(txtvalue))
	{
		alert("对不起，请输入有效的登录密码，谢谢！");
		frm.p.focus();
		return false;
	}
	txtvalue=frm.code.value;
	if(!isNumber(txtvalue)||txtvalue.toString().length!=4)
	{
		alert("对不起，请输入有效的验证码信息，谢谢！");
		frm.code.focus();
		return false;
	}
	
	var userName = frm.u.value;
	
	$.ajax({
		type:"post",
		cache:false,
		url:"member!frontGetMemberByInfo.do?userName=" + encodeURIComponent(userName) + "&passWord=" + frm.p.value + "&code=" + frm.code.value,
		success:function(result){
			if(result != null && result != ""){
				if(result == "codeError"){
					alert("验证码错误!");
				}else if(result == "namePassNumm"){
					alert("用户名密码为空!");
				}else if(result == "namePassError"){
					alert("用户名密码错误!");
				}else if(result == "memberNoActive"){
					alert("用户已被锁定!");
				}else{
					var t = document.getElementById("ExpireNum").value;
					var time = parseInt(t);
					if(time > 0){
						$.cookies.set("userNameCookie",userName,{hoursToLive:time*24});
						$.cookies.set("passWordCookie",result,{hoursToLive:time*24});
					}
					//询问页面
					if(isShowWindow == true || isShowWindow == null){
						closeForm('');
						showGoMemberManagerFrame(true,escape(location.href),'');
					}else{
						closeForm('');
						loginAddPartCustomContent();
					}
				}
			}
		}
	});
}
function loginKeyDown(downFile){
	if (event.keyCode == 13){
		ajaxMemberLogin();
	}
}
//存入cookie
function SetCookie(name, value, time)
{ 
    var exp = new Date();
    exp.setTime(exp.getTime() + (time*24*60*60*1000));
    window.document.cookie = name + "=" + escape (value) + "; expires=" + exp.toGMTString()+";path=/";
}
function getCookies(name)
{
   var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
   if(arr != null) return unescape(arr[2]); return null;
}
//重新加载图片,防止图片未加载完成
function loadImgError(img){
	/*var errorCount = $(img).attr("errorCount");
	if(errorCount != null && errorCount != ""){
		errorCount = parseInt(errorCount);
		if(errorCount < 3){
			//alert($(img).attr("id") + "-" + errorCount);
			var src = $(img).attr("src");
			$(img).attr("src",src);
			$(img).attr("errorCount",errorCount + 1);
		}else{
			$(img).error(function(){
				var src = $(img).attr("src");
				alert(src);
			});
			
		}
	}*/
	/*var src = $(img).attr("src");
	$(img).attr("src",src);
	setTimeout(function(){
		var h = $(img).attr("height");
		if(h != null){
			$(img).attr("src",'http://www.ca9.cc/Images/nopic.jpg');
		}
	}, 500);*/
}

//评论提交按钮
function commentsSubmit(){
	var re = /select|update|delete|exec|count|script|'|"|=|;|>|<|%/i;
	if(re.test(userName)){
		alert("请不要在评论信息中输入特殊字符和SQL关键字!");
		return;
	}
	$("#commentsForms").form('submit',{
		url:'comments!frontAddComments.do',
		success:function(result){
			if(result == "success"){
				alert("评论成功！请等待审核...");
			}else{
				alert("评论失败！");
			}
		}
	});
}
function RedrawImage(ImgD,iwidth,iheight){
    //参数(图片,允许的宽度,允许的高度)
    var image=new Image();
    image.src=ImgD.src;
    //alert(ImgD.parentNode.parentNode.tagName);
    
    if(image.width>0 && image.height>0){    
    if(image.width/image.height>= iwidth/iheight){
        if(image.width>iwidth){ 
        ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
        }else{
        ImgD.width=image.width; 
        ImgD.height=image.height;
        }  
      
        }
    else{
        if(image.height>iheight){ 
        ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;       
        }else{
        ImgD.width=image.width; 
        ImgD.height=image.height;
        }
       
        }
    }
    //alert(ImgD.style.position.top);
	var temp = ($(ImgD).parent().parent().height()-$(ImgD).height())/2;
	if(temp >=0 ){
    	ImgD.style.paddingTop = temp;
	}
}
function RedrawPartImage(ImgD,iwidth,iheight){
    //参数(图片,允许的宽度,允许的高度)
    var image=new Image();
    image.src=ImgD.src;
    //alert(ImgD.parentNode.parentNode.tagName);
    
    if(image.width>0 && image.height>0){    
    if(image.width/image.height>= iwidth/iheight){
        if(image.width>iwidth){ 
        ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
        }else{
        ImgD.width=image.width; 
        ImgD.height=image.height;
        }  
      
        }
    else{
        if(image.height>iheight){ 
        ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;       
        }else{
        ImgD.width=image.width; 
        ImgD.height=image.height;
        }
       
        }
    }
    //alert(ImgD.style.position.top);
	var temp = ($(ImgD).parent().parent().height()-$(ImgD).height())/2;
	if(temp >=0 ){
    	ImgD.style.marginTop = temp;
	}
}
function imgOnLoad(img){
	var bigP = $(img);
	if(bigP != null){
		if(bigP.width() > 780){
			bigP.height(bigP.height() * (780/bigP.width()));
			bigP.width(780);
		}
	}
}
//详细页面打印按钮
function printButton(){
	$("#smallDiv").hide();//右侧隐藏
	$("#associateTitle").hide();//推荐标题隐藏
	$("#associate").hide();	//推荐内容隐藏
	$("#commentsInfo").hide();//评论隐藏
	window.print();
	$("#smallDiv").show();//右侧隐藏
	$("#associateTitle").show();//推荐标题隐藏
	$("#associate").show();	//推荐内容隐藏
	$("#commentsInfo").show();//评论隐藏
}
function verification(str){
	var re = /select|update|delete|exec|count|script|'|"|=|;|>|<|%/i;
	if(re.test(str)){
		alert("请不要在参数中输入特殊字符和SQL关键字!");
	}
}
//下载按钮。
function downFileFunction(id){
	$.ajax({
		type:'post',
		url:'photo!frontDeductionDownloadsAjax.do?pid=' + id,
		cache:false,
		success:function(result){
			if(result == "error"){
				alert("下载错误");
			}else if(result == "notDown2"){
				//alert("原创下载次数不足");
				viewDownFileErrorMessage(1);
			}else if(result == "notDown1"){
				//alert("普通下载次数不足");
				viewDownFileErrorMessage(0);
			}else{
				window.location = result;
			}
		}
	});
}
function viewDownFileErrorMessage(n){
	if(n == 0){
		var altHtml='<div style="color:#0274C3;height:48px; width:100%; padding:10px; text-align:left; line-height:180%;" class="font12">\
			<font style="color:red;">该下载需要相应的普通下载次数</font>，请联系您的服务代表或致电<b>0595-22561488</b>。<div style=" height:4px; overflow:hidden;"></div>\
			福州：<b>0591-62086815</b> 德化：<b>18905050542</b> <div style=" height:2px; overflow:hidden;"></div>\台州：<b>0576-85466680</b> 潮州：<b>0768-6898827</b>。<div style=" height:4px; overflow:hidden;"></div>\
			为了更快获得服务，请就近联系各个地区的服务代表，谢谢合作！<div style=" height:4px; overflow:hidden;"></div>\
		</div>\
		<div style="width:auto; text-align:center;">\
			<input type="button" value=" 回到首页 " class="font12 hand" onclick="location.href=\'/\';" />&nbsp;<input type="button" value=" 关闭页面 " class="font12 hand" onclick="closePage()" />\
		</div>\
		</div>';
		showAlert("友情提示：",altHtml,500,180,"");
	}else if(n == 1){
		var altHtml='<div style="color:#0274C3;height:48px; width:100%; padding:10px; text-align:left; line-height:180%;" class="font12">\
			<font style="color:red;">该下载需要相应的原创下载次数</font>，请联系您的服务代表或致电<b>0595-22561488</b>。<div style=" height:4px; overflow:hidden;"></div>\
			福州：<b>0591-62086815</b> 德化：<b>18905050542</b> <div style=" height:2px; overflow:hidden;"></div>\台州：<b>0576-85466680</b> 潮州：<b>0768-6898827</b>。<div style=" height:4px; overflow:hidden;"></div>\
			为了更快获得服务，请就近联系各个地区的服务代表，谢谢合作！<div style=" height:4px; overflow:hidden;"></div>\
		</div>\
		<div style="width:auto; text-align:center;">\
			<input type="button" value=" 回到首页 " class="font12 hand" onclick="location.href=\'http://www.ca9.cn\';" />&nbsp;<input type="button" value=" 关闭页面 " class="font12 hand" onclick="closePage()" />\
		</div>\
		</div>';
		showAlert("友情提示：",altHtml,500,180,"");
	}else if(n == 2){
		var altHtml='<div style="color:#0274C3;height:48px; width:100%; padding:10px; text-align:left; line-height:180%;" class="font12">\
			<font style="color:red;">该下载没有对应的下载文件</font>，请联系您的服务代表或致电<b>0595-22561488</b>。<div style=" height:4px; overflow:hidden;"></div>\
			福州：<b>0591-62086815</b> 德化：<b>18905050542</b> <div style=" height:2px; overflow:hidden;"></div>\台州：<b>0576-85466680</b> 潮州：<b>0768-6898827</b>。<div style=" height:4px; overflow:hidden;"></div>\
			为了更快获得服务，请就近联系各个地区的服务代表，谢谢合作！<div style=" height:4px; overflow:hidden;"></div>\
		</div>\
		<div style="width:auto; text-align:center;">\
			<input type="button" value=" 回到首页 " class="font12 hand" onclick="location.href=\'http://www.ca9.cn\';" />&nbsp;<input type="button" value=" 关闭页面 " class="font12 hand" onclick="history.back();" />\
		</div>\
		</div>';
		showAlert("友情提示：",altHtml,500,180,"history.back();");
	}else if(n == 3){
		var altHtml='<div style="color:#0274C3;height:48px; width:100%; padding:10px; text-align:left; line-height:180%;" class="font12">\
			<font style="color:red;">该次请求为非法的连接请求</font>，请联系您的服务代表或致电<b>0595-22561488</b>。<div style=" height:4px; overflow:hidden;"></div>\
			福州：<b>0591-62086815</b> 德化：<b>18905050542</b> <div style=" height:2px; overflow:hidden;"></div>\台州：<b>0576-85466680</b> 潮州：<b>0768-6898827</b>。<div style=" height:4px; overflow:hidden;"></div>\
			为了更快获得服务，请就近联系各个地区的服务代表，谢谢合作！<div style=" height:4px; overflow:hidden;"></div>\
		</div>\
		<div style="width:auto; text-align:center;">\
			<input type="button" value=" 回到首页 " class="font12 hand" onclick="location.href=\'http://www.ca9.cn\';" />&nbsp;<input type="button" value=" 关闭页面 " class="font12 hand" onclick="history.back();" />\
		</div>\
		</div>';
		showAlert("友情提示：",altHtml,500,180,"history.back();");
	}
}
