// JavaScript Document

//
/*
* homeAutoPlay 1.0
* 2010-11-09 Tanhuihuang 
* 大首页图片自动播放js
* 
* labelStyle:dot|Num  序号样式，默认为 dot右中部圆点；　.homeAutoPlay({labelStyle:'Num'})右下角序号
*/
(function($) {       
    $.fn.popUpSelect = function(options) {       
        var opts = $.extend({}, $.fn.popUpSelect.defaults, options);      
        return this.each(function(i) { 
            $this = $(this);    
			$this.wrap("<div class='selectTextWrap'></div>"); 
			$wrap = $this.parent();
            var _img = $this.find('img');
            var o = $.meta ? $.extend({}, opts, $this.data()) : opts;		
			var _html = '<table class="popSelect_Table '+o.cls+'" style="width:'+o.width+'px;top:'+o.top+'px;left:'+o.left+'px;right:'+o.right+'px;"><tr class="popSelect_TopTr"><td></td><td></td><td></td></tr><tr><td class="popSelect_LTd"></td><td class="selectCityWrap">';
				_html+=	o.html;
				_html+=	'</td><td class="popSelect_RTd"></td></tr><tr class="popSelect_BotTr"><td></td><td></td><td></td></tr></table>';
			$wrap.click(function(event){
				var $table = $(this).find('.popSelect_Table');
				//event.stopPropagation();
				if($table.length==0){
					$(this).append(_html);
					$(this).find('.popSelect_Table').click(function(e){e.stopPropagation();});
					$(this).find('.winCloseBtn').click(function(){$(this).parents('.popSelect_Table').hide();});
					if(o.initFun!=null){o.initFun($(this),$(this).find('.popSelect_Table'));};
				//	$(this).find('.popSelect_Table').show(200);
				}else{
					   
					if($table.css('display')=='none'){
						if(options.showcb)
							options.showcb();
						$table.show();	
					}else{
						$table.hide();	
					}
				}					
			});
			if(o.loadCb)
				o.loadCb($wrap);
			$this.change(function(){if(o.callBackFun!=null){o.callBackFun($('#'+options.key).attr("sv"));};}); 
        });     
    }; 
    
    $.fn.popUpSelectHide = function(){
    	$(this).parent().find('.popSelect_Table').hide();
    };

    $.fn.popUpSelect.defaults = {
        cls:'',
		width:'' ,
		top:'',
		left:'',
		right:'',
		html:''	
			
    };           
})(jQuery);

