
/**
 * @author kevin_li
 */
if(typeof Lcp == "undefined"){
   var Lcp = new Object();
}

/**
 * msg box class
 */
Lcp.winMsgBox = new Object();
jQuery.extend(Lcp.winMsgBox,
  {	oPopup:($.browser.msie)?window.createPopup():"",
    popTop:50,
	popMsg:function(msgStr){		
		 var winStr = ('<div id="popMsg">');
         winStr += ('<h2>msg</h2>');
         winStr += ('<div class="content">' + msgStr + '</div></div>');
		 this.oPopup.document.body.innerHTML = winStr;
         this.popShow();	
	},
	popShow:function(){
	  window.status = this.popTop;	  
      if(this.popTop > 1720){
        clearTimeout(mytime);
        this.oPopup.hide();
        return;
      }
      else if(this.popTop > 1520 && this.popTop < 1720){	  	
        this.oPopup.show(screen.width - 250, screen.height, 241, 1720 - this.popTop);
      }
      else if(this.popTop > 1500 && this.popTop < 1520){	  	
        this.oPopup.show(screen.width - 250, screen.height + (this.popTop - 1720), 241, 172);
      }
      else if(this.popTop < 180){	  
         this.oPopup.show(screen.width - 250, screen.height, 241, this.popTop);
      }
      else if(this.popTop < 220){	  	
        this.oPopup.show(screen.width - 250, screen.height - this.popTop, 241, 172);
      }
      this.popTop += 10;
      var mytime = setTimeout("Lcp.winMsgBox.popShow();", 60);	
	}
  }
);


/**
 * 
 */
Lcp.clipBoardData=function(txt,msg)
{
   if(msg==''){
   	msg="ok";
   }
   if(window.clipboardData)
   {
      window.clipboardData.clearData();
      window.clipboardData.setData("Text", txt);
	  alert(msg);
   }
   else if (window.netscape)
   {
      try
      {
         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
      }
      catch (e)
      {
         alert("firefoxabout:configsigned.applets.codebase_principal_support");
         return false;
      }
      var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
      if ( ! clip)
      return;
      var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
      if ( ! trans)
      return;
      trans.addDataFlavor('text/unicode');
      var str = new Object();
      var len = new Object();
      var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
      var copytext = txt;
      str.data = copytext;
      trans.setTransferData("text/unicode", str, copytext.length * 2);
      var clipid = Components.interfaces.nsIClipboard;
      if ( ! clip)
      return false;
      clip.setData(trans, null, clipid.kGlobalClipboard);
	  alert(msg);
   }
}

/**
 * delect link
 */
Lcp.deleteLinkMsg="delete from";
Lcp.deleteLink=function(){
  	$(function(){
	  var jObj=$("a.delete");
	  if(jObj!=null){
	   jObj.each(function(i,n){
	 	var url=this.href;		
		this.href="javascript:void(0);";
		$(this).bind("click",function(){
		  if(confirm(Lcp.deleteLinkMsg)){
		  	self.location = url;
		  }
	  });
	 });
	 }
	});
}
Lcp.deleteLink();


/**
 * sellect all
 */
$(function(){
 var jObj=$("input[@type=checkbox].selectAll");
 if(jObj!=null){
 jObj.bind("click",function(){
 	$("table input[@type=checkbox]").fcheck(($(jObj).get(0).checked)?"on":"off");	
 });	
 }
});

function showmenu(menuinfo,obj){
  $("div").remove("#menudiv");
	$(".box").unbind();
	$(".box").append('<div id="menudiv">'+menuinfo+'</div>');
  offs=$(obj).offset();	
	$("#menudiv").css("left",offs.left+10);
	$("#menudiv").css("top",offs.top);   
	
	$("#menudiv").unbind();	
}





