/**
* $.ADA.init({id:"#div_zclalert",width:400});
* #div_zclalert -- the id for div,but add '#' before
* width:400 the alert window's width
* showTime  after the time alert window auto hide 
* title     the alert window's title
*/
jQuery.extend({ADA:{
   adID : null,
   obj : null,
   init: function(obj){
	   $.ADA.adID = obj.id;
       obj.width = typeof(obj.width)=="undefined"?400:obj.width;
       //obj.height = typeof(obj.height)=="undefined"?200:obj.height;
	   obj.showTime = typeof(obj.showTime)=="undefined"?2000:obj.showTime;
       obj.title = typeof(obj.title)=="undefined"?"北京移动彩铃":obj.title;
       $.ADA.obj = obj;

	  
		
	   $($.ADA.adID).css(
	      {
			position:"absolute",
			width:obj.width,
			height:"auto",//200
			border:"1px solid #000",
			fontSize:"12px",
			marginLeft:"0px",//10
			top:"10px",
			right:"10px",
			"background-color":"white",
			display:"none",
			//padding:"0px",//10
		    "z-index":"200"
	      }   
	   ).html('<div class="title">'+
	     '<ul style="width:100%;height:auto;background:#E12B0B;height:24px;color:#fff;font-weight:bold;">'+
		'<li style="float:left;padding-left:6px;vertical-align:center;">'+obj.title+'<span class="timeout"></span></li>'+
		'<li style="float:right;width:15px;height:17px;cursor:pointer;" onclick="$.ADA.hide()">X</li>'+
		'<li class="sign" style="float:right;width:21px;height:21px;cursor:pointer;" onclick="$.ADA.toggle()">_</li>'+
	    '</ul>'+
	    '</div><div class="content" style="padding:6px;">'+$($.ADA.adID).html()+"</div>");
     
       window.setTimeout(function(){
		  $.ADA.show($.ADA.chMove);
	   },obj.showTime);
	   
	   if(typeof(obj.closeTime)!="undefined")
	   {
		   window.setTimeout(function(){
			  $.ADA.min();
		   },parseInt(obj.closeTime));
	   }
   },
   chMove : function(){
	  
	  var doc = document.documentElement.scrollHeight >= document.body.scrollHeight ? 
			 document.documentElement : document.body;
      var tt = 10;

	  if(navigator.userAgent.indexOf("Safari")!=-1)
	  {
		  doc = document.body;
	  }
	  
	  //body for chrome ;element for ie6 ff
      $.ADA.mid = window.setInterval(function(){
		  tt = doc.clientHeight-$($.ADA.adID).height()-6;
		  $($.ADA.adID).stop().animate({top:doc.scrollTop+tt},500);
	  },500);
   },
   show : function(call){
	  $($.ADA.adID).slideDown(500,function(){
	     call();
	  });
   },
   hide : function(){
	 window.clearInterval($.ADA.mid);
	 $($.ADA.adID).fadeOut(300);
   },
   toggle : function ()
   {
	 if($($.ADA.adID).height()==24)
	 {
	   $($.ADA.adID+" .sign").html("_");
       $($.ADA.adID+" .content").slideDown(500); 
	 }
	 else
	 {
	   $.ADA.min();
	 }
   },
   min : function(){
      $($.ADA.adID+" .sign").html("口");
      $($.ADA.adID+" .content").slideUp(500); 
   }
}});
