;(function($) { 

var expr = (function() {
    var div = document.createElement('div');
    try { div.style.setExpression('width','0+0'); }
    catch(e) { return false; }
    return true;
})();
    
function sz(el, p) { 
    return parseInt($.css(el,p))||0; 
};
function hex2(s) {
    var s = parseInt(s).toString(16);
    return ( s.length < 2 ) ? '0'+s : s;
};
function gpc(node) {
    for ( ; node && node.nodeName.toLowerCase() != 'html'; node = node.parentNode ) {
        var v = $.css(node,'backgroundColor');
        if ( v.indexOf('rgb') >= 0 ) { 
            if ($.browser.safari && v == 'rgba(0, 0, 0, 0)')
                continue;
            var rgb = v.match(/\d+/g); 
            return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
        }
        if ( v && v != 'transparent' )
            return v;
    }
    return '#ffffff';
};

function getWidth(fx, i, width) {
    switch(fx) {
    case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
    }
};

$.fn.corner = function(o) {
    // in 1.3+ we can fix mistakes with the ready state
	if (this.length == 0) {
        if (!$.isReady && this.selector) {
            var s = this.selector, c = this.context;
            $(function() {
                $(s,c).corner(o);
            });
        }
        return this;
	}

    o = (o||"").toLowerCase();
    var keep = /keep/.test(o);                       // keep borders?
    var cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);  // corner color
    var sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);  // strip color
    var width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10; // corner width
    var re = /round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;
    var fx = ((o.match(re)||['round'])[0]);
    var edges = { T:0, B:1 };
    var opts = {
        TL:  /top|tl/.test(o),       TR:  /top|tr/.test(o),
        BL:  /bottom|bl/.test(o),    BR:  /bottom|br/.test(o)
    };
    if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
        opts = { TL:1, TR:1, BL:1, BR:1 };
    var strip = document.createElement('div');
    strip.style.overflow = 'hidden';
    strip.style.height = '1px';
    strip.style.backgroundColor = sc || 'transparent';
    strip.style.borderStyle = 'solid';
    return this.each(function(index){
        var pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };

        if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        var cssHeight = $.curCSS(this, 'height');

        for (var j in edges) {
            var bot = edges[j];
            // only add stips if needed
            if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
                var d = document.createElement('div');
                $(d).addClass('jquery-corner');
                var ds = d.style;

                bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

                if (bot && cssHeight != 'auto') {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.bottom = ds.left = ds.padding = ds.margin = '0';
                    if (expr)
                        ds.setExpression('width', 'this.parentNode.offsetWidth');
                    else
                        ds.width = '100%';
                }
                else if (!bot && $.browser.msie) {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
                    
                    // fix ie6 problem when blocked element has a border width
                    if (expr) {
                        var bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
                        ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
                    }
                    else
                        ds.width = '100%';
                }
                else {
                    ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                        (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
                }

                for (var i=0; i < width; i++) {
                    var w = Math.max(0,getWidth(fx,i, width));
                    var e = strip.cloneNode(false);
                    e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                    bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                }
            }
        }
    });
};

$.fn.uncorner = function() { return $('.jquery-corner', this).remove(); };
    
})(jQuery);



jQuery.extend({
	easing: {
		easein: function(x, t, b, c, d) {
			return c*(t/=d)*t + b; // in
		},
		easeinout: function(x, t, b, c, d) {
			if (t < d/2) return 2*c*t*t/(d*d) + b;
			var ts = t - d/2;
			return -2*c*ts*ts/(d*d) + 2*c*ts/d + c/2 + b;		
		},
		easeout: function(x, t, b, c, d) {
			return -c*t*t/(d*d) + 2*c*t/d + b;
		},
		expoin: function(x, t, b, c, d) {
			var flip = 1;
			if (c < 0) {
				flip *= -1;
				c *= -1;
			}
			return flip * (Math.exp(Math.log(c)/d * t)) + b;		
		},
		expoout: function(x, t, b, c, d) {
			var flip = 1;
			if (c < 0) {
				flip *= -1;
				c *= -1;
			}
			return flip * (-Math.exp(-Math.log(c)/d * (t-d)) + c + 1) + b;
		},
		expoinout: function(x, t, b, c, d) {
			var flip = 1;
			if (c < 0) {
				flip *= -1;
				c *= -1;
			}
			if (t < d/2) return flip * (Math.exp(Math.log(c/2)/(d/2) * t)) + b;
			return flip * (-Math.exp(-2*Math.log(c/2)/d * (t-d)) + c + 1) + b;
		},
		bouncein: function(x, t, b, c, d) {
			return c - jQuery.easing['bounceout'](x, d-t, 0, c, d) + b;
		},
		bounceout: function(x, t, b, c, d) {
			if ((t/=d) < (1/2.75)) {
				return c*(7.5625*t*t) + b;
			} else if (t < (2/2.75)) {
				return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
			} else if (t < (2.5/2.75)) {
				return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
			} else {
				return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
			}
		},
		bounceinout: function(x, t, b, c, d) {
			if (t < d/2) return jQuery.easing['bouncein'] (x, t*2, 0, c, d) * .5 + b;
			return jQuery.easing['bounceout'] (x, t*2-d,0, c, d) * .5 + c*.5 + b;
		},
		elasin: function(x, t, b, c, d) {
			var s=1.70158;var p=0;var a=c;
			if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
			if (a < Math.abs(c)) { a=c; var s=p/4; }
			else var s = p/(2*Math.PI) * Math.asin (c/a);
			return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		},
		elasout: function(x, t, b, c, d) {
			var s=1.70158;var p=0;var a=c;
			if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
			if (a < Math.abs(c)) { a=c; var s=p/4; }
			else var s = p/(2*Math.PI) * Math.asin (c/a);
			return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
		},
		elasinout: function(x, t, b, c, d) {
			var s=1.70158;var p=0;var a=c;
			if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
			if (a < Math.abs(c)) { a=c; var s=p/4; }
			else var s = p/(2*Math.PI) * Math.asin (c/a);
			if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
			return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
		},
		backin: function(x, t, b, c, d) {
			var s=1.70158;
			return c*(t/=d)*t*((s+1)*t - s) + b;
		},
		backout: function(x, t, b, c, d) {
			var s=1.70158;
			return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
		},
		backinout: function(x, t, b, c, d) {
			var s=1.70158;
			if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
			return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
		},
		linear: function(x, t, b, c, d) {
			return c*t/d + b; //linear
		}
	}
});



$(document).ready(function(){
	
	//Fix Errors - http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-queue-buildup/
	
	//Remove outline from links
	$("a").click(function(){
		$(this).blur();
	});
	
	//When mouse rolls over
	$(".menuSetL .toggle").mouseover(function(){
		$('ul',this).stop().animate({height:'400px'},{queue:false, duration:500})
		$('.catagory',this).addClass('on');
	});
	
	//When mouse is removed
	$(".menuSetL .toggle").mouseout(function(){
		$('ul',this).stop().animate({height:'0px'},{queue:false, duration:200})
		$('.catagory',this).removeClass('on');
	});
	$(".menuSetR .toggle").mouseover(function(){
		$('ul',this).stop().animate({height:'400px'},{queue:false, duration:500})
		$('.catagory',this).addClass('on');
	});
	
	//When mouse is removed
	$(".menuSetR .toggle").mouseout(function(){
		$('ul',this).stop().animate({height:'0px'},{queue:false, duration:200})
		$('.catagory',this).removeClass('on');
	});
	$(".topToggle").mouseover(function(){
		$('ul',this).stop().animate({height:'190px',width:'150px'},{queue:false, duration:500});
		$('.topTitle',this).addClass('on');
	});
	
	//When mouse is removed
	$(".topToggle").mouseout(function(){
		$('ul',this).stop().animate({height:'0px',width:'50px'},{queue:false, duration:200});
		$('.topTitle',this).removeClass('on');
	});
	$("#mylistBt").toggle(function(){
    $('#container-4').stop().animate({height:'148px'},{queue:false, duration:200});
	$('#mylistBt').addClass('open');},
    function(){
    $('#container-4').stop().animate({height:'28px'},{queue:false, duration:200});
	$('#mylistBt').removeClass('open');
    });   
	$('.tip').hide();
	$(".input,.tipTd").click(function(){
		$('.tip').hide();
		$('.tip',this).show();
	});
});

	
	
$(function() {
    $('#adshow').cycle({
		fx:     'scrollVert',
        speed:       400,
        timeout:     5000,
        pager:      '#nav',
        pagerEvent: 'mouseover',
		pauseOnPagerHover: true
    });
	
    $('#adshow_b').cycle({
		fx:     'scrollVert',
        speed:       400,
        timeout:     5000,
        pager:      '#nav',
        pagerEvent: 'mouseover',
		pauseOnPagerHover: true
    });
	
	$('#adshow_c').cycle({
		fx:     'scrollVert',
        speed:       400,
        timeout:     5000,
        pager:      '#nav',
        pagerEvent: 'mouseover',
		pauseOnPagerHover: true
    });
	
	$('#adshow_d').cycle({
		fx:     'scrollVert',
        speed:       400,
        timeout:     5000,
        pager:      '#nav',
        pagerEvent: 'mouseover',
		pauseOnPagerHover: true
    });
	$('#adshow_e').cycle({
		fx:     'scrollVert',
        speed:       400,
        timeout:     5000,
        pager:      '#nav',
        pagerEvent: 'mouseover',
		pauseOnPagerHover: true
    });

//	$('#hotLink').cycle({
//    fx:     'scrollUp',
//    speed:   400,
//    timeout: 5000,
//    pause:   1
//});
//	$('#dailySlider').cycle({ 
//    fx:     'fade', 
//    speed:  'fast', 
//    timeout: 10000, 
//	pause:   1,
//    next:   '#next', 
//    prev:   '#prev' 
//});
//	$('#addB').cycle({
//    fx:      'scrollDown',
//	speed:   500,
//    timeout: 10000, 
//	pause:   1,
//	easing:  'backinout'
//});
//	$('#mainAddB').cycle({
//    fx:      'scrollDown',
//	speed:   500,
//    timeout: 5000, 
//	pause:   1,
//	easing:  'backinout'
});
//	
//	$('#container-1').tabs();
//	$('#container-2').tabs();
//	$('#container-3').tabs();
//	$('#container-4').tabs();
//	$('#container-5').tabs();
//	$('.corner').corner();
//	$('.purchase li').corner();
//
//});

//$(document).ready(function(){
//  $('a[href*=#top]').click(function() {
// if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
// && location.hostname == this.hostname) {
//   var $target = $(this.hash);
//   $target = $target.length && $target
//   || $('[name=' + this.hash.slice(1) +']');
//   if ($target.length) {
//  var targetOffset = $target.offset().top;
//  $('html,body')
//  .animate({scrollTop: targetOffset}, 500);
//    return false;
//   }
// }
//  });
//});
//$(document).ready(function(){
//  $('a[href*=#anchor]').click(function() {
// if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
// && location.hostname == this.hostname) {
//   var $target = $(this.hash);
//   $target = $target.length && $target
//   || $('[name=' + this.hash.slice(1) +']');
//   if ($target.length) {
//  var targetOffset = $target.offset().top;
//  $('html,body')
//  .animate({scrollTop: targetOffset}, 500);
//    return false;
//   }
// }
//  });
//});
//$(document).ready(function(){
//	$('#orderList tr:odd').addClass('odd');
//	});
//var popupStatus = 0;

//loading popup with jQuery magic!
//function loadPopup(){
//	//loads popup only if it is disabled
//	if(popupStatus==0){
//		$("#backgroundPopup").css({
//			"opacity": "0.7"
//		});
//		$("#backgroundPopup").fadeIn("normal");
//		$("#newsBox").fadeIn("normal");
//		popupStatus = 1;
//	}
//}
//
////disabling popup with jQuery magic!
//function disablePopup(){
//	//disables popup only if it is enabled
//	if(popupStatus==1){
//		$("#backgroundPopup").fadeOut("normal");
//		$("#newsBox").fadeOut("normal");
//		popupStatus = 0;
//	}
//}

//centering popup
//function centerPopup(){
//	//request data for centering
//	var windowWidth = document.documentElement.clientWidth;
//	var windowHeight = document.documentElement.clientHeight;
//	var popupHeight = $("#newsBox").height();
//	var popupWidth = $("#newsBox").width();
//	//centering
//	$("#newsBox").css({
//		"position": "absolute",
//		"top": windowHeight/2-popupHeight/2,
//		"left": windowWidth/2-popupWidth/2
//	});
//	//only need force for IE6
//	
//	$("#backgroundPopup").css({
//		"height": windowHeight
//	});
//	
//}


//$(document).ready(function(){
//	$(".acNews a").click(function(){
//		centerPopup();
//		loadPopup();
//	});
//	$("#close").click(function(){
//		disablePopup();
//	});
//	$("#backgroundPopup").click(function(){
//		disablePopup();
//	});
//	$(document).keypress(function(e){
//		if(e.keyCode==27 && popupStatus==1){
//			disablePopup();
//		}
//	});
//
//});
