var x, y;
var ms;
var COpen, Cdesign;
COpen = "skyopen";
// 0 开 1 关
CDesign = "skydesign";
// 0 小 1 大
function MeMoveDiv(obj)
{
   ms = obj;
   event.srcElement.setCapture();
   x = document.all(ms).style.pixelLeft - event.x;
   y = document.all(ms).style.pixelTop - event.y;
   // document.all(ms).style.backgroundColor = '#BFDFFF';
}

function document.onmousemove()
{
   if(ms != "")
   {
      document.all(ms).style.pixelLeft = x + event.x;
      document.all(ms).style.pixelTop = y + event.y;
      document.all(ms).style.cursor = "move";

   }
}

function document.onmouseup()
{
   if(ms != "")
   {
      event.srcElement.releaseCapture();
      document.all(ms).style.cursor = "hand";
      ms = 0;
   }
}
function MoveInitDefault()
{
   var s;
   s = document.getElementById("helpinfodiv");
   if(GetCookie(COpen) != 1)
   {

      var divx, divy;
      divx = document.body.clientWidth - 320;
      divy = document.body.clientHeight - 170;
      s.style.left = divx;
      s.style.top = divy;
      s.style.width = "300";
      s.style.height = "150";
      s.style.display = "";
	  //alert(divx + "+" + divy)
      // SetCookie("big", "mewww");
      // alert(GetCookie("big"));
   }
   else
   {
      s.style.display = "none";
   }
}
function Closediv()
{
   //window.alert("系统提示您:对不起，本功能暂时不支持关闭！");
   var s;
   s = document.getElementById("helpinfodiv");
   s.style.display = "none";
   //SetCookie(COpen, 1);
   
}
function OpenHelpdiv()
{
   var s;

   s = document.getElementById("helpinfodiv");
   s.style.display = "";
   if(GetCookie(COpen) == 0)
   {
      SetCookie(COpen, 1);
   }
   else
   {
      SetCookie(COpen, 0);
   }
   MoveInitDefault();
}
// ####################################################################################################################
//
function setTexttoDiv(txt)
{
   //alert(txt);
   JsMainFrm();
   var s;
   s = document.getElementById("HelpFontText");
   s.innerHTML = txt;
   MoveInitDefault();
}
// ###################################################################################################################
function JsMainFrm()
{
document.write('<div id="helpinfodiv" style="Z-INDEX:1; LEFT:36px; WIDTH:273px; POSITION:absolute; TOP:205px; HEIGHT:85px; display:none00;">');
document.write('<table height="100%"border="0" align="center" cellpadding="0" cellspacing="0" class="HelpTable" id="HelpTable">');
document.write('<tr><td><table width="100%"border="0" cellspacing="0" cellpadding="0" onmousedown=MeMoveDiv("helpinfodiv"); class="HelpMove"><tr><td class="HelpTableL">&nbsp;</td>');
document.write('<td class="HelpTableC"><table width="100%" height="28"border="0" cellpadding="0" cellspacing="0">');
document.write('<tr><td class="HelpFontTitle"><a href="#" >系统提示</a></td>');
document.write('<td class="HelpTableCr"><table height="25"border="0" align="right" cellpadding="2" cellspacing="0"><tr>');
document.write('<td valign="bottom"><img src="Style/Open/allOpen.gif" width="15" height="15" onClick="bigorsmalldiv(this);" style="cursor:hand;" title="控制帮助的大小"></td>');
document.write('<td><img src="Style/Open/allClose.gif" width="15" height="15" onClick="Closediv();" style="cursor:hand;" title="关闭帮助信息"></td>');
document.write('</tr></table></td></tr></table></td><td class="HelpTableR">&nbsp;</td></tr></table></td></tr>');
document.write('<tr><td height="100%" valign="top">');
document.write('<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="HelpFoot"><tr>');
document.write('<td bgcolor="#FFFFFF" class="HelpFootbody">');
document.write('<table width="100%" height="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="HelpFont">');
document.write('<tr><td height="100%" valign="top">');
document.write('<div class="HelpFont"id="HelpFontText" style="width:100%; height:100%; overflow:auto;overflow-x:hidden" >帮助信息</div></td></tr></table></td></tr></table></td></tr></table></div>');
}
//#########
var bigs = false;
function bigorsmalldiv(o)
{
   var divx, divy;
   var s;
   s = document.getElementById("helpinfodiv");
   if(GetCookie(CDesign) == 0)
   {
      // xiao
      SetCookie(CDesign, 1)
      MoveInitDefault();
	  o.src="/Admin/Style/Open/allOpen.gif"
      o.title="这里可以最大化"
   }
   else
   {
      SetCookie(CDesign, 0)
      divx = document.body.clientWidth;
      divy = document.body.clientHeight;
      s.style.left = 0;
      s.style.top = 0;
      s.style.width = divx;
      s.style.height = divy;
      s.style.display = "";
	  o.src="/Admin/Style/Open/allOpenmin.gif"
	  o.title="这里可以还原"
      // s.filters.alpha.opacity = 20
   }
}
// ########################################################################################################################
function GetCookie (name)
{
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen)
   {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0)
      break;

   }
   return null;
}

function getCookieVal (offset)
{
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == - 1)    endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}

function SetCookie (name, value)
{
   var argv = SetCookie.arguments;
   var argc = SetCookie.arguments.length;
   var expires = (argc > 2) ? argv[2] : null;
   var hours;
   hours = 240000;
   expire = new Date((new Date()).getTime() + hours * 3600000);
   var path = (argc > 3) ? argv[3] : null;
   var domain = (argc > 4) ? argv[4] : null;
   var secure = (argc > 5) ? argv[5] : false;
   document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expire)) + ((path == null) ? "" : ("; path=" + path)) +  ((domain == null) ? "" : ("; domain=" + domain)) +    ((secure == true) ? "; secure" : "");
}
//############################################################################
 var sInitColor;
 function callColorDlg(src,vl){
  if(sInitColor == null)
   var sColor = dlgHelper.ChooseColorDlg();
  else
   var sColor = dlgHelper.ChooseColorDlg(sInitColor);

  sColor = sColor.toString(16);
  if (sColor.length < 6) {
   var sTempString = "000000".substring(0,6-sColor.length);
   sColor = sTempString.concat(sColor);
  }

  document.all[src].style.backgroundColor = '#' + sColor;
 
  document.all[vl].value= sColor;
  sInitColor = sColor;
 }
//############################################################################
function mewwwOpen(webname)
{
   window.open (webname, window, 'width=650, height=550, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, status=yes ,top=100 ,left=200');
}
