var $=function(id){return document.getElementById(id);}
//支持多种浏览器的方式创建 XMLHttpRequest 对象
var request;
function createRequest() {
	try {
		request = new XMLHttpRequest();
	} catch (trymicrosoft) {
	try {
		request = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (othermicrosoft) {
	try {
		request = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (failed) {
		request = false;
		}
	}
}
if (!request)
    alert("Error initializing XMLHttpRequest!");
}
//==选择风格
function skin(id){
	createRequest();
	request.open("GET","Ft_admin_ajax.asp?action=skin&id="+id+"&"+Math.random(),true);
	request.onreadystatechange = function(){
	if (request.readyState == 4 && request.status == 200) {
      if(request.responseText=="ok"){
      top.location="admin_index.asp";
          }else{
          alert(request.responseText)
                }
  }
	}
	request.send(null);
}
//----------------退出登陆------
function loginout(){ createRequest(); request.open("GET","../ajax.asp?action=loginout&"+Math.random(),true); request.onreadystatechange = function(){if (request.readyState == 4 && request.status == 200) { if (request.responseText=="ok") { window.parent.location.reload('../index.asp'); }else{ alert("退出失败,未知错误!"); return false; } } }; request.send(null);};
//扔鸡蛋|送鲜花
function e_f(id,str){
	createRequest();
	request.open("GET","Ft_admin_ajax.asp?action=e_f&id="+id+"&str="+str+"&"+Math.random(),true);
	request.onreadystatechange = function(){
	if (request.readyState == 4 && request.status == 200) {
    var t=request.responseText;
    if (t=="0"){
              alert("您扔过鸡蛋或者送过鲜花!");
              }else{
              $(str+id).innerHTML = t;
                    }
	}
}
	request.send(null);
}
//读短信
function read_note(id,user){
	var j="r"+id;
  $(j).style.display=($(j).style.display=="none")?"block":"none";
	createRequest();
	request.open("GET","Ft_admin_ajax.asp?action=read_note&id="+id+"&user="+user+"&"+Math.random(),true);
	request.onreadystatechange = function(){
	if (request.readyState == 4 && request.status == 200) {
  }
	}
	request.send(null);
}
//送花
function flower(id){
alert ("成功送花"+id);
}
function writeCookie(name, value) { 
 exp = new Date(); 
 exp.setTime(exp.getTime() + (86400 * 1000 * 30));
 document.cookie = name + "=" + escape(value) + "; expires=" + exp.toUTCString() + "; path=/"; 
}
function get_Cookie(cookieName) {
    var cookieString = document.cookie;
    var start = cookieString.indexOf(cookieName + '=');
    if (start == -1)
        return null;
    start += cookieName.length + 1;
    var end = cookieString.indexOf(';', start);
    if (end == -1) return unescape(cookieString.substring(start));
    return unescape(cookieString.substring(start, end));
}
//全选框
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall') 
    e.checked = form.chkall.checked; 
   }
  }
function submits(){
	document.all("content").value=IframeID.document.body.innerHTML;
	}
function selectAll()
{ for (var i=0;i<document.select.id.length;i++){
   var temp=document.select.id[i];
   temp.checked=!temp.checked;
  }
}
function runscript(n)
{
txtRun=n;window.open('../templatesview.asp')
}
//QQ菜单
function showsubmenu(sid){
var e="submenu"+sid;
$(e).style.display=($(e).style.display=="block")?"none":"block";
}
//多行文本框字数统计
function gbcount(message)
{
	var max = 200;
	if (message.value.length > 200){
		message.value = message.value.substring(0,max);
		alert("字符不能超过" +max+ "个字!");
		}
	if(message.value.length>4){
	$("note_ok").disabled="";
	}else{
	$("note_ok").disabled="true";
	}
}
//表格行换色
function inStyle(obj){
	obj.style.background="#FFFF99";
}
function outStyle(obj){
    obj.style.background="#FFFFFF";
}
//顶部
var displayBar=true;
function preloadImg(src)
{
	var img=new Image();
	img.src=src
}
function switchBar(obj){
	if (displayBar)	{
parent.frame.cols="0,*";
		displayBar=false;
		obj.src="Images/admin_top_open.gif";
		obj.title="打开左边管理导航菜单";
	}	else{
		parent.frame.cols="180,*";
		displayBar=true;
		obj.src="Images/admin_top_close.gif";
		obj.title="关闭左边管理导航菜单";
	}
}
//时钟
function show2(){
if (!document.all)
return
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="AM" 
if (hours>12){
dn="PM"
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var ctime=hours+":"+minutes+":"+seconds+" "+dn
if($("tick2")=="[object]"){
tick2.innerHTML="<span style='font-size:12px;color:#FFFFFF;'>"+ctime+"</span>"
setTimeout("show2()",1000)
}
}
window.onload=show2
//==========================菜单
function change(id){
if (runtimes<1){changeItem(id);}else{alert("请不要点击过快!");}
}
function moveUp(){
	for(var i=onItemIndex+1;i<=toItemIndex;i++)
		$(i).style.top=parseInt($(i).style.top)-12+"px";
}
function moveDown(){
	for(var i=onItemIndex;i>toItemIndex;i--)
		$(i).style.top=parseInt($(i).style.top)+12+"px";
}
function pop(pageurl){
var
popwin=window.open(pageurl,"popWin","scrollbars=auto,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,width=411,height=320");
return false;
}
