﻿/**
 *IStockFloatBox 右下信息弹出框
 *@author  jianjun.wang@jrj.com.cn
 *@date  2010.3.1
 *@version 1.0
 *根据运营要求，暂时注释关闭按钮
 */
(function($){
	function BlogFloatBox(oSrc){
     this.contentSrc = oSrc;     
     this.init();
	}	
	BlogFloatBox.prototype = {	
     init : function(){
     	  //JRJ.bom.delCookie("istock_floatbox_close");
				
				var html = '<div id="istock_floatbox">';
				html += '<div class="popup2"><!--最小化为<div class="popup2 pop_min">-->';
				html += '<div class="pop_t">';
				html += '	<span title="最小化">最小化</span>';
				html += '	小编推荐';
				html += '</div>';
				html += '          <iframe frameborder="0" scrolling="no" allowTransparency="true" width="100%" height="187px" src="'+this.contentSrc+'"></iframe>';
				html += '	</div>';
				html += '</div>';  
				this.box = $(html);
				this.box.appendTo("body");
			
				this.smallBtn = this.box.find(".pop_t");
				this.smallBtn.bind("click",{obj:this},this.minify);
			  
			  if( $.browser.msie && parseInt($.browser.version) <= 6 ){
					this.box.css("position","absolute");
//					this.smallIcon.css("position","absolute");
					$(window).bind("scroll",{obj:this},function(event){
						var thisObj = event.data.obj;
						thisObj.box[0].className = thisObj.box[0].className;
//						thisObj.smallIcon[0].className = thisObj.smallIcon[0].className;
					});
					$(window).bind("resize",{obj:this},function(event){
						var thisObj = event.data.obj;
						thisObj.box[0].className = thisObj.box[0].className;
//						thisObj.smallIcon[0].className = thisObj.smallIcon[0].className;
					});
				}
								
			  
		    	this.box.animate({"bottom":1},
		     	  {"duration":2000,
			       "complete":function(){}
	          });
     },
     minify : function(event){
     	  var thisObj = event.data.obj;
		  var tmp = thisObj.box.find(".popup2");
		  tmp.addClass('pop_min');
		  thisObj.smallBtn.unbind("click");
		  thisObj.smallBtn.bind("click",{obj:thisObj},thisObj.maximize);
     },
     
     maximize : function(event){     
     	  var thisObj = event.data.obj;
     	  var tmp = thisObj.box.find(".popup2");
		  tmp.removeClass('pop_min');
		  thisObj.smallBtn.unbind("click");
		  thisObj.smallBtn.bind("click",{obj:thisObj},thisObj.minify);
     }
	}
	window.BlogFloatBox = BlogFloatBox;
})(jQuery);
