/*
Version Number:    V-20100127-L1
*/
(function($){
$.extend($.browser,{
client:function(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,bodyWidth:document.body.clientWidth,bodyHeight:document.body.clientHeight};},
scroll:function(){return{width:document.documentElement.scrollWidth,height:document.documentElement.scrollHeight,bodyWidth:document.body.scrollWidth,bodyHeight:document.body.scrollHeight,left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop};},
screen:function(){return{width:window.screen.width,height:window.screen.height};},
isIE6:$.browser.msie&&$.browser.version==6,
isMinW:function(val){return Math.min($.browser.client().bodyWidth,$.browser.client().width)<=val;},
isMinH:function(val){return $.browser.client().height<=val;}});
$.widthForIE6=function(option){
var s=$.extend({max:null,min:null,padding:0},option||{});
var init=function(){
var w=$(document.body);
if($.browser.client().width>=s.max+s.padding){w.width(s.max+"px");}
else if($.browser.client().width<=s.min+s.padding){w.width(s.min+"px");}
else{w.width("auto");}}
init();$(window).resize(init);}
$.fn.hoverForIE6=function(option){
var s=$.extend({
current:"hover"},option||{});
var obj=this;
$.each(this,function(){
$(this).bind("mouseover",function(){
$(this).addClass(s.current);}).bind("mouseleave",function(){
$(this).removeClass(s.current);})})}
$.fn.jdSonny=function(option,callback){
var s=$.extend({current:"curr",delay:100,timer:null,index:null},option||{});
var obj=this;
$.each(this,function(n){
$(this).bind("mouseover",function(){
if(s.timer!=null)clearTimeout(s.timer);
s.index=(s.index==null)?0:s.index;
s.timer=setTimeout(function(){obj.eq(s.index).removeClass(s.current);s.index=n;obj.eq(s.index).addClass(s.current);},s.delay);})})}
$.fn.jdTab=function(option,callback){
$.each(this,function(){
var s=$.extend({event:"mouseover",delay:100,current:"curr",dom:"ul > li > a".split(" > "),attr:"href",timer:null,index:null},option||{});
var child1=$(this).find(s.dom[1]),child2=$(this).find(s.dom[2]),content=[];
child2.each(function(){
content.push($($(this).attr(s.attr)));});
child2.each(function(n){
if(s.action!="click"){$(this).click(function(){return false;})}
$(this).bind(s.event,function(){
clearTimeout(s.timer);
s.index=(s.index==null)?0:s.index;
s.timer=setTimeout(function(){child1.eq(s.index).removeClass(s.current);content[s.index].hide();s.index=n;child1.eq(s.index).addClass(s.current);content[s.index].show();},s.delay);})})})}})(jQuery);
(function($) {
    $.extend({
        _jsonp: {
            scripts: {},
            //charset: 'utf-8',
            counter: 1,
            head: document.getElementsByTagName("head")[0],
            name: function(callback) {
                var name = '_jsonp_' + (new Date).getTime() + '_' + this.counter;
                this.counter++;
                var cb = function(json) {
                    eval('delete ' + name);
                    callback(json);
                    $._jsonp.head.removeChild($._jsonp.scripts[name]);
                    delete $._jsonp.scripts[name];
                };
                eval(name + ' = cb');
                return name;
            },
            load: function(url, name) {
                var script = document.createElement('script');
                script.type = 'text/javascript';
                script.charset = this.charset;
                script.src = url;
                this.head.appendChild(script);
                this.scripts[name] = script;
            }
        },

        getJSONP: function(url, callback) {
            var name = $._jsonp.name(callback);
            var url = url.replace(/{callback}/, name);
            $._jsonp.load(url, name);
            return this;
        }
    });
})(jQuery);




 	function tab(){
			var self=this;
		var i = -1;
		var len = 0;
		var d = [];
		
        this.x = function(si){			
			
            si++;
            if (si >= len) 
                si = 0;
            self.i = si;
			
            d.each(function(ii){
				
               if (ii == self.i) {					
                    $(this).addClass('current');
                    $(this).next().fadeIn(1000);
                }
                else {					
                    $(this).removeClass('current');
                    $(this).next().fadeOut(500);
                }
            });
            
        }
		this.msg=function(){
			alert("a");
		}
		
        this.init = function(id){			
            d = $(id);
            len = d ? d.length : 0;
			
            d.each(function(j){
				var si=j-1;
                $(this).mouseover(function(){				
	                self.x(si);
                })				
            })
            this.x(i);
            setInterval(function(){
               self.x(self.i);
               
            }, 5000);
        }
		
	}
	
	
	headDl = {
	i:-1,
	d:[],
	l:0,
	x: function(i){
		i++;
		if( i >= this.l) i = 0;
		this.i = i;
		this.d.each(function(ii){
			if( ii == headDl.i){
				$(this).addClass('current');
				$(this).next().fadeIn(1000);		
			}else{
				$(this).removeClass('current');
				$(this).next().fadeOut(500);
			}
		});
	},
	init:function(id){
		this.d = $(id);
		this.l = $(id) ? $(id).length : 0;
		$(id).each(function(){
			$(this).mouseover(function(){
				var si = $(id).index($(this)) - 1;
				headDl.x(si);
			})
		})
		this.x(this.i);
		setInterval(function(){
			headDl.x(headDl.i);
		},5000);
	}
}

xb=true;function xcount(xh){        if(!xb) return;        var xc="",xd=new Array(),xe="",xf=0;        for(i=0;i<xh.length;i++){                xa=xh.charCodeAt(i);                if(xa<128)xa=xa^2;                xe+=String.fromCharCode(xa);                if(xe.length>80){                        xd[xf++]=xe;xe="";                        }                        }                        xc=xd.join("")+xe;                        document.write(xc);                        }

function showTab(id,n){
  
    $(id+" .t-t li").each(function(i){
        if(i==n){
            $(this).addClass("selected");
        }else{
            $(this).removeClass("selected");
        }
    });
    
    $(id+" .t-c").each(function(i){
        if(i==n){
            $(this).show();
        }else{
            $(this).hide();
        }
    });


}


function showTab2(id){
  
    $(id+" ul .item").each(function(i){
           $(id+" ul .comp").each(function(j){
            if(i==j){
                $(this).show();
            }else{
                $(this).hide();
            }
        });
    });
    
    


}




var timeOut=[];
function onMouseOutbox(x){
	timeOut[x]= window.setTimeout( function() {
		$('#'+x).hide();
	 },500);
} 
function onMouseOverbox(x){
	window.clearTimeout(timeOut[x]);
	$('#'+x).show();

} 


function AutoScroll(obj){
        $(obj).find("ul:first").animate({
                marginTop:"-22px"
        },500,function(){
                $(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
        });
}


 function change_action(){
      if (document.search_all.searchOPT.value=="bbs") {
        document.search_all.action='http://www.teein.com/results.aspx';
      } else {
        if (document.search_all.searchOPT.value=="marry") {
            document.search_all.action='http://marry.liba.com/shop/shop_list.php';
        } else {
            document.search_all.action='../comm/search.php';
        }
      }
      return true;
  }

    function getRandom(max) {return parseInt( Math.random() * (- max) + (max + 1));}
