/*
'=================================================================================
'
'    Designer's site Program 全站静态系统
'    xizon@c945.com
'    www.c945.com
'    技术支持：没位道
'    未经允许不得私自用于任何商业用途
'    产品官方网站：http://www.badpark.net   http://www.c945.com/d-s
'
'=================================================================================
*/

//menu of shortCut
var MyrootPath_S="/";var MY_ManageHomeIndexUrl="";var siteURL="";var siteName="";
var nameNow=MySite.Cookie.get('cat');
var nameNowM=MySite.Cookie.get('catName');
var nameMemNow=MySite.Cookie.get('memSupUserName');
var userLevelName="secManage";
var userLevelName2="supManage";
var showNameTip;
var adminURLPar;
var cacheNow=Math.round(Math.random()*100000000000000);

if ( nameMemNow!=null && nameMemNow != ""){
	showNameTip = nameMemNow;
	adminURLPar = '&memberSupadminName=' + showNameTip;
	
}else{
	showNameTip = MySite.Cookie.get('cat');
	adminURLPar = "";
}

/*鼠标右键控制*/ 
//取得鼠标坐标			
var rmX;
var rmY;
$(document).mousemove(function(e){ 
//获取鼠标坐标
rmX = e.pageX;
rmY = e.pageY;

}); 		
//鼠标右键侦听，兼容各浏览器和FF 
var menuShowChk = 0;
function getButton(evt){
	$(document).bind('contextmenu',function(e){
	    return false; 
	});
	var e = evt ? evt :window.event
	if(!evt){
	  switch (e.button)
		{
			case 1: 
			//左键;
			break;
			case 2: 
			//右键;
			showRightMenu();
			break;
			case 4: 
			//中键;
			break;
	   }
	}
	else
	{ 
	   switch (e.button){
		  
		  case 0: 
		  //左键;
		  break;
		  case 2: 
		  //右键;
		  showRightMenu();
		  break;
		  case 1: 
		  //中键;
		  break;
	   }
	}
	function showRightMenu(){
		$("#rightMenuStyle").fadeIn(500).animate({marginTop: "0"},{queue:false,duration:500});;
		$("#rightMenuStyle").css({"left":rmX + "px","top":rmY + "px"});
		$("#rightMenuStyle a, body").click(function(){ 
			$("#rightMenuStyle").fadeOut(500).animate({marginTop: "-50px"},{queue:false,duration:500});
		}); 
	}
}




//快捷管理菜单
function top_shortCut(){
	var navHtml = '<a href="' + MyrootPath_S + 'list/article_default.html">文章日志</a><a href="' + MyrootPath_S + 'list/showcase_default.html">案例展示</a><a href="' + MyrootPath_S + 'message/message_default.html#writeNow">快速留言</a><a href="' + MyrootPath_S + 'mood/mood_default.html">站内微博</a><a href="' + MyrootPath_S + 'search.html">站内搜索</a><a href="' + MyrootPath_S + 'catlinks.html">友情链接</a><a href="' + MyrootPath_S + 'selfinfo.html">关于我们</a><a href="javascript:" onclick="location.reload() ">刷新页面</a>';
	if (nameNow!=null && nameNow != ""  && nameNowM != "memManage" && nameNowM != "secManage" && nameNowM != "supManage") {
	  document.onmousedown=getButton;
      $("body").prepend('<div id="rightMenuStyle" style="display:none;"><span class="userPlant"><a href="' + MyrootPath_S + 'admin/' + MY_ManageHomeIndexUrl + '?supadmin='+ nameNow + ''+ adminURLPar + '&cache=' + cacheNow + '">系统管理</a></span>' + navHtml + '</div><ul id="shortNavLink"><li class="f"><a href="' + MyrootPath_S + 'admin/' + MY_ManageHomeIndexUrl + '?supadmin='+ nameNow + ''+ adminURLPar + '&cache=' + cacheNow + '">系统管理</a></li></ul>');

	}else 	if (nameNow!=null && nameNow != ""  && nameNowM != "supManage" && (nameNowM == "memManage" && nameNowM != "secManage")) {
	  document.onmousedown=getButton;
      $("body").prepend('<div id="rightMenuStyle" style="display:none;"><span class="userPlant"><a href="' + MyrootPath_S + 'member/' + MY_ManageHomeIndexUrl + '?name='+ nameNow + '&cache=' + cacheNow + '">会员中心</a></span>' + navHtml + '</div><ul id="shortNavLink"><li class="f"><a href="' + MyrootPath_S + 'member/' + MY_ManageHomeIndexUrl + '?name='+ nameNow + '&cache=' + cacheNow + '">会员中心</a></li></ul>');

	}else 	if (nameNow!=null && nameNow != ""  && nameNowM != "supManage" && (nameNowM != "memManage" && nameNowM == "secManage")) {
	  document.onmousedown=getButton;
      $("body").prepend('<div id="rightMenuStyle" style="display:none;"><span class="userPlant"><a href="' + MyrootPath_S + 'member/secDefault.asp?name='+ nameNow + '&cache=' + cacheNow + '">会员中心</a></span>' + navHtml + '</div><ul id="shortNavLink"><li class="f"><a href="' + MyrootPath_S + 'member/secDefault.asp?name='+ nameNow + '&cache=' + cacheNow + '">会员中心</a></li></ul>');

	}
	else{
		document.onmousedown=getButton;
		var logHtml = '<form id=frmLogin  method=post action=' + MyrootPath_S + 'admin/admin_login/chk_login.asp?mode=shortcut><table width=430 class=setting cellspacing=0><thead><tr><th width=100></th><th colspan=2></th></tr></thead><tfoot><tr><td></td><td colspan=2><input name=Submit type=submit value=登陆 class=input />&nbsp;&nbsp;<a  href=' + MyrootPath_S + 'admin/admin_login/?mode=reg target=_blank>立即注册</a></td></tr></tfoot><tbody><tr><tr><td align=right>帐&nbsp;&nbsp;号：</td><td colspan=2 align=left><input name=userName  type=text style=width:200px  class=input_text id=userName size=15 /></td></tr><tr><td align=right>密&nbsp;&nbsp;码：</td><td colspan=2 align=left><input name=userPass  type=password style=width:200px  class=input_text id=userPass size=15 /></td></tr></tbody></table></form>';
		$("body").prepend('<div id="rightMenuStyle" style="display:none;"><span class="userPlant"><a href="javascript:" onclick="floatWin(\'快捷登录\',\'' + logHtml + '\',430,150,170,0,0,0);">用户登录</a></span>' + navHtml + '</div><ul id="shortNavLink"><li><a href="javascript:" onclick="floatWin(\'快捷登录\',\'' + logHtml + '\',430,180,170,0,0,0);">登录</a></li><li><a  href=' + MyrootPath_S + 'admin/admin_login/?mode=reg target=_blank>注册</a></li></ul>');
	}
}

//================================================
//IE6浏览器拒绝提示
//================================================

if ($.browser.msie && $.browser.version < 7) {

    if (MySite.Cookie.get('tip_ie6') != "tip_ie6" ){
		
		document.write('<div id="ie6alert">温馨提醒：系统检测到您的浏览器版本过低,不利于管理和显示最佳效果,微软倡议<a href="http://www.ie6countdown.com/" target="_blank">对IE6说再见</a>,告别速度慢、风险高的IE6浏览器！推荐下载<a href="http://windows.microsoft.com/zh-CN/internet-explorer/downloads/ie" target="_blank">IE最新版</a>|<a href="http://www.google.cn/intl/zh-CN/chrome/browser/" target="_blank">Chrome 浏览器</a>&nbsp;&nbsp;<a href="javascript:" class="close" title="关闭">×</a></div>');
		
		
		$('#ie6alert .close').click( 
			function () {
				$("#ie6alert").fadeOut(500);
				$("html").css("padding-top","0");
				//提醒过期
				var expdateIe6=new Date();
				var ctimeIe6 = 1000*86400;//1天
				expdateIe6.setTime(expdateIe6.getTime()+ ctimeIe6);
				MySite.Cookie.set("tip_ie6","tip_ie6",expdateIe6);
				
			}
		);
	
		
		function resizeDivAlertIE6()
		{
			var docWidth = document.documentElement.clientWidth;
			var docHeight = document.documentElement.clientHeight;
			document.getElementById("ie6alert").style.position="absolute";
			document.getElementById("ie6alert").style.top = parseInt(document.documentElement.scrollTop,10)+0;	
	
			
		}
		//window.onresize = resizeDivAlertIE6;
		window.onscroll = resizeDivAlertIE6;
	
	}


}

