﻿//改变内容字体大小
function doZoom(obj,size){
    var h = parseInt(size)+parseInt(4);
	document.getElementById(obj).style.fontSize = size+'px';
	document.getElementById(obj).style.lineHeight = h+'px';
}

//改变显示状态
function OpenCloseDv(e,obj,showtype,mywidth,myheight,FID)
{
  e=e||event;
  if(showtype != "none")
  {
       if(e != null)
       {
           if(e.clientX + mywidth >window.screen.width)
           {
             document.getElementById(obj).style.left = (e.clientX-mywidth)+"px";
           }
           else
           {
            document.getElementById(obj).style.left = e.clientX+"px";
           }
           
           document.getElementById(obj).style.top = e.clientY+"px";
       }
      
      //document.getElementById(obj).style.top = (window.screen.width-myheight)/2;
      //document.getElementById(obj).style.left = (document.body.offsetWidth-mywidth)/2;
      //document.getElementById(obj).style.top = event.offsetY;
      //document.getElementById(obj).style.left = event.offsetX;
      if(FID != "")
      {
        document.getElementById("hidFID").value = FID;
      }
  }
  
  document.getElementById("backloading").style.height = document.body.offsetHeight+"px";
  document.getElementById("backloading").style.display = showtype;
  document.getElementById(obj).style.display = showtype;
}

//选中
function selSkin(skinid,hid)
{
   var obj = "skinImg"+skinid; 
   var imgAll = document.getElementsByName("skinImg");
   for (var i=0; i< imgAll.length;i++)
   {
    if(imgAll[i].id == obj)
    {
       imgAll[i].style.border= "solid 2px #000000";
    }
    else
    {
       imgAll[i].style.border= 0;
    }
   }
   
   
   var h = document.getElementById(hid);

   h.value = skinid;
   
   document.getElementById("skin").href = "skin/" + skinid + "/style.css";
}

//不保存模版
function skinCannel()
{
  document.getElementById("skin").href = document.getElementById("oldskin").value;
}

//////////////拖动////////////////////
//可以打包为js文件; 
 var x0=0,y0=0,x1=0,y1=0; 
 var offx=6,offy=6; 
 var moveable=false; 
 var hover='orange',normal='#336699';//color; 
 var index=10000;//z-index; 
 //开始拖动; 
 function startdrag(e,obj) 
 { 
   e = e|| event;
  if(e.button==1) 
  { 
   //锁定标题栏; 
   obj.setCapture(); 
   //定义对象; 
   var win = obj.parentNode; 
   var sha = win.nextSibling; 
   //记录鼠标和层位置; 
   x0 = e.clientX; 
   y0 = e.clientY; 
   x1 = parseInt(win.style.left); 
   y1 = parseInt(win.style.top); 
   //记录颜色; 
   normal = obj.style.backgroundColor; 
   //改变风格; 
   obj.style.backgroundColor = hover; 
   win.style.borderColor = hover; 
   obj.nextSibling.style.color = hover; 
   sha.style.left = (x1 + offx)+"px"; 
   sha.style.top = (y1 + offy)+"px"; 
   moveable = true; 
  } 
 } 
 //拖动; 
 function drag(e,obj) 
 { 
   e = e|| event;
  if(moveable) 
  { 
   var win = obj.parentNode; 
   var sha = win.nextSibling; 
   win.style.left = (x1 + e.clientX - x0)+"px"; 
   win.style.top = (y1 + e.clientY - y0)+"px"; 
   sha.style.left = (parseInt(win.style.left) + offx)+"px"; 
   sha.style.top = (parseInt(win.style.top) + offy)+"px"; 
  } 
 } 
 //停止拖动; 
 function stopdrag(obj) 
 { 
  if(moveable) 
   { 
    var win = obj.parentNode; 
    var sha = win.nextSibling; 
    var msg = obj.nextSibling; 
    win.style.borderColor = normal; 
    obj.style.backgroundColor = normal; 
    msg.style.color = normal; 
    sha.style.left = obj.parentNode.style.left; 
    sha.style.top = obj.parentNode.style.top; 
    obj.releaseCapture(); 
    moveable = false; 
   } 
 } 
 //获得焦点; 
 function getFocus(obj) 
 { 
  if(obj.style.zIndex!=index) 
  { 
   index = index + 2; 
   var idx = index; 
   obj.style.zIndex=idx; 
   obj.nextSibling.style.zIndex=idx-1; 
  } 
 } 
 //最小化; 
 function min(obj) 
 { 
  var win = obj.parentNode.parentNode; 
  var sha = win.nextSibling; 
  var tit = obj.parentNode; 
  var msg = tit.nextSibling; 
  var flg = msg.style.display=="none"; 
  if(flg) 
  { 
   win.style.height = (parseInt(msg.style.height) + parseInt(tit.style.height) + 2*2)+"px"; 
   sha.style.height = win.style.height+"px"; 
   msg.style.display = "block"; 
   obj.innerHTML = "0"; 
  } 
  else 
  { 
   win.style.height = (parseInt(tit.style.height) + 2*2)+"px"; 
   sha.style.height = win.style.height+"px"; 
   obj.innerHTML = "2"; 
   msg.style.display = "none"; 
  } 
 } 
 //创建一个对象; 
 function xWin(id,w,h,l,t,tit,msg) 
 { 
  index = index+2; 
  this.id = id; 
  this.width = w; 
  this.height = h; 
  this.left = l; 
  this.top = t; 
  this.zIndex = index; 
  this.title = tit; 
  this.message = msg; 
  this.obj = null; 
  this.bulid = bulid; 
  this.bulid(); 
 } 
 /////////////////////////拖动结束////////////////////////////////
 
 function ShowAlert(msg)
{
///提示
    var pop=new Popup({ contentType:4,isReloadOnClose:false,width:340,height:80});
    pop.setContent("title","提示");
    pop.setContent("alertCon",msg);
    pop.build();
    pop.show();
 }
 
 function ShowConfirm(content)
{
   var pop=new Popup({ contentType:3,isReloadOnClose:true,width:340,height:80});
   pop.setContent("title","提示");
   pop.setContent("confirmCon",content);
   pop.setContent("callBack",ShowCallBack);
   pop.setContent("parameter",{id:"divCall",str:"点击确定后显示的字符串",obj:pop});
   pop.build();
   pop.show();
}

function ShowHtmlString(strHtml)
{
    var pop=new Popup({ contentType:2,isReloadOnClose:false,width:340,height:300});
    pop.setContent("contentHtml",strHtml);
    pop.setContent("title","提示");
    pop.build();
    pop.show();
}

function ShowIframe(Url,Tit,W,H)
{
    var pop=new Popup({ contentType:1,scrollType:'yes',isReloadOnClose:false,width:W,height:H});
    pop.setContent("contentUrl",Url);
    pop.setContent("title",Tit);
    pop.build();
    pop.show();
}
