jQuery.noConflict();

jQuery(document).ready(function(){



        jQuery('#ajaxTerm').scroll(function(){
                termHeight = jQuery('#ajaxTerm .ajaxTermInner').height();
                termScroll = document.getElementById('ajaxTerm').scrollTop;
                termNum = termHeight - termScroll;

                if(jQuery.browser.msie){
                        if(termNum <= 140){ jQuery('#termCheck').removeAttr("disabled"); }
                } else {
                        if(termNum <= 165){ jQuery('#termCheck').removeAttr("disabled"); }
                }
        });

jQuery('#subBanner li').each(function(){
contentText = jQuery(this).html();
if (contentText == ''){jQuery(this).remove();}
jQuery(this).children('a').attr('target','_blank');
});
jQuery('.e3Banner').removeAttr('target');

jQuery('#banner a, #catBanner a, #ajax_head_banner a').attr('target','_blank');

jQuery('#renewBtn').click(function(){
jQuery('.renewHide').hide();
jQuery('.renewShow').show();
});

bannerNull = jQuery('#header #banner').html();
if (bannerNull == ''){jQuery('#header #banner').remove();}

categoryNull = jQuery('#maker_result').html();
if (categoryNull == ''){
} else { jQuery('#maker_result').wrap('<div>');}

jQuery('.stripeWrapper tr:odd, .resultTable tr:odd').addClass('odd');
jQuery('.resultTable tr').mouseover( function(){
        jQuery(this).addClass('active');
});

jQuery('.resultTable tr').mouseout( function(){
        jQuery(this).removeClass('active');
                                                                  });

jQuery('.resultTable input').addClass('false');
jQuery('.resultTable tr').click( function(){
        thisID = jQuery(this).children().children('input').attr('id');
        thisClass = jQuery('#'+thisID).attr('class');
        if( thisClass == 'false'){
        jQuery('#'+thisID).addClass('true').removeClass('false');
        }
        if( thisClass == 'true'){
        jQuery('#'+thisID).addClass('false').removeClass('true');
        }
});




PEPS.rollover.init();

//a { display:block; overflow: hidden; text-align: center; vertical-align: middle; width: 90px; height: 90px; }
/*
jQuery('.item .pic .thumb').each(function(){
        imgHeight = jQuery(this).height();
        imgWidth = jQuery(this).width();
        MarginH = -(imgHeight - 170) / 2+'px 0 0 '+ -(imgWidth - 170) / 2+'px';
        MarginW = -(imgHeight - 170) / 2+'px 0 0 '+ -(imgWidth - 170) / 2+'px';

        if (imgHeight > imgWidth){
        jQuery(this).css( 'margin',MarginH);
        } else {
        jQuery(this).css( 'margin',MarginW);
        }
});
*/

        CHight = jQuery('#wrapper').height();
        WHight = jQuery(window).height();
        if(CHight <= WHight){
        jQuery('#pageTop').css('display','none');
        }
        jQuery(window).resize(function(){
        CHight = jQuery('#wrapper').height();
        WHight = jQuery(window).height();
        if(CHight <= WHight){ jQuery('#pageTop').fadeOut(); }
        else { jQuery('#pageTop').fadeIn(); }
        });

});


//jQueryRolloverIMG////////////////////////////////////////

PEPS = {};
PEPS.rollover = {
init: function(){
this.preload();

jQuery(".over").hover(
function () { jQuery(this).attr( 'src', PEPS.rollover.newimage(jQuery(this).attr('src')) ); },
function () { jQuery(this).attr( 'src', PEPS.rollover.oldimage(jQuery(this).attr('src')) ); }
);},

preload: function(){
jQuery(window).bind('load', function() {
jQuery('.over').each( function( key, elm ) { jQuery('<img>').attr( 'src', PEPS.rollover.newimage( jQuery(this).attr('src') ) ); });
});},

newimage: function( src ){
return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_over' + src.match(/(\.[a-z]+)$/)[0];
},

oldimage: function( src ){
return src.replace(/_over\./, '.');
}
};



//smoothscroll////////////////////////////////////////
Scroller = {
        speed:5,
        gy: function (d) {
                gy = d.offsetTop
                if (d.offsetParent) while (d = d.offsetParent) gy += d.offsetTop
                return gy
        },
        scrollTop: function (){
                body=document.body
            d=document.documentElement
            if (body && body.scrollTop) return body.scrollTop
            if (d && d.scrollTop) return d.scrollTop
            if (window.pageYOffset) return window.pageYOffset
            return 0
        },
        add: function(event, body, d) {
            if (event.addEventListener) return event.addEventListener(body, d,false)
            if (event.attachEvent) return event.attachEvent('on'+body, d)
        },
        end: function(e){
                if (window.event) {
                        window.event.cancelBubble = true
                        window.event.returnValue = false
                return;
        }
            if (e.preventDefault && e.stopPropagation) {
              e.preventDefault()
              e.stopPropagation()
            }
        },
        scroll: function(d){
                i = window.innerHeight || document.documentElement.clientHeight;
                h=document.body.scrollHeight;
                a = Scroller.scrollTop()
                if(d>a)
                        if(h-d>i)
                                a+=Math.ceil((d-a)/Scroller.speed)
                        else
                                a+=Math.ceil((d-a-(h-d))/Scroller.speed)
                else
                        a = a+(d-a)/Scroller.speed;
                window.scrollTo(0,a)
                if(a==d || Scroller.offsetTop==a)clearInterval(Scroller.interval)
                Scroller.offsetTop=a
        },
        init: function(){
                Scroller.add(window,'load', Scroller.render)
        },
        render: function(){
                a = document.getElementsByTagName('a');
                Scroller.end(this);
                window.onscroll
            for (i=0;i<a.length;i++) {
              l = a[i];
              if(l.href && l.href.indexOf('#') != -1 && ((l.pathname==location.pathname) || ('/'+l.pathname==location.pathname)) ){
                Scroller.add(l,'click',Scroller.end)
                        l.onclick = function(){
                                Scroller.end(this);
                                l=this.hash.substr(1);
                                 a = document.getElementsByTagName('a');
                                     for (i=0;i<a.length;i++) {
                                        if(a[i].name == l){
                                                clearInterval(Scroller.interval);
                                                Scroller.interval=setInterval('Scroller.scroll('+Scroller.gy(a[i])+')',10);
                                                }
                                        }
                                }
                }
                }
        }
}
Scroller.init();