//--bof picture scroll code
(function(A){A.fn.slides=function(B){B=A.extend({},A.fn.slides.option,B);return this.each(function(){A("."+B.container,A(this)).children().wrapAll('<div class="slides_control"/>');var V=A(this),J=A(".slides_control",V),Z=J.children().size(),Q=J.children().outerWidth(),M=J.children().outerHeight(),D=B.start-1,L=B.effect.indexOf(",")<0?B.effect:B.effect.replace(" ","").split(",")[0],S=B.effect.indexOf(",")<0?L:B.effect.replace(" ","").split(",")[1],O=0,N=0,C=0,P=0,U,H,I,X,W,T,K,F;function E(c,b,a){if(!H&&U){H=true;B.animationStart(P+1);switch(c){case"next":N=P;O=P+1;O=Z===O?0:O;X=Q*2;c=-Q*2;P=O;break;case"prev":N=P;O=P-1;O=O===-1?Z-1:O;X=0;c=0;P=O;break;case"pagination":O=parseInt(a,10);N=A("."+B.paginationClass+" li."+B.currentClass+" a",V).attr("href").match("[^#/]+$");if(O>N){X=Q*2;c=-Q*2;}else{X=0;c=0;}P=O;break;}if(b==="fade"){if(B.crossfade){J.children(":eq("+O+")",V).css({zIndex:10}).fadeIn(B.fadeSpeed,B.fadeEasing,function(){if(B.autoHeight){J.animate({height:J.children(":eq("+O+")",V).outerHeight()},B.autoHeightSpeed,function(){J.children(":eq("+N+")",V).css({display:"none",zIndex:0});J.children(":eq("+O+")",V).css({zIndex:0});B.animationComplete(O+1);H=false;});}else{J.children(":eq("+N+")",V).css({display:"none",zIndex:0});J.children(":eq("+O+")",V).css({zIndex:0});B.animationComplete(O+1);H=false;}});}else{J.children(":eq("+N+")",V).fadeOut(B.fadeSpeed,B.fadeEasing,function(){if(B.autoHeight){J.animate({height:J.children(":eq("+O+")",V).outerHeight()},B.autoHeightSpeed,function(){J.children(":eq("+O+")",V).fadeIn(B.fadeSpeed,B.fadeEasing);});}else{J.children(":eq("+O+")",V).fadeIn(B.fadeSpeed,B.fadeEasing,function(){if(A.browser.msie){A(this).get(0).style.removeAttribute("filter");}});}B.animationComplete(O+1);H=false;});}}else{J.children(":eq("+O+")").css({left:X,display:"block"});if(B.autoHeight){J.animate({left:c,height:J.children(":eq("+O+")").outerHeight()},B.slideSpeed,B.slideEasing,function(){J.css({left:-Q});J.children(":eq("+O+")").css({left:Q,zIndex:5});J.children(":eq("+N+")").css({left:Q,display:"none",zIndex:0});B.animationComplete(O+1);H=false;});}else{J.animate({left:c},B.slideSpeed,B.slideEasing,function(){J.css({left:-Q});J.children(":eq("+O+")").css({left:Q,zIndex:5});J.children(":eq("+N+")").css({left:Q,display:"none",zIndex:0});B.animationComplete(O+1);H=false;});}}if(B.pagination){A("."+B.paginationClass+" li."+B.currentClass,V).removeClass(B.currentClass);A("."+B.paginationClass+" li:eq("+O+")",V).addClass(B.currentClass);}}}function R(){clearInterval(V.data("interval"));}function G(){if(B.pause){clearTimeout(V.data("pause"));clearInterval(V.data("interval"));K=setTimeout(function(){clearTimeout(V.data("pause"));F=setInterval(function(){E("next",L);},B.play);V.data("interval",F);},B.pause);V.data("pause",K);}else{R();}}if(Z<2){return ;}if(D<0){D=0;}if(D>Z){D=Z-1;}if(B.start){P=D;}if(B.randomize){J.randomize();}A("."+B.container,V).css({overflow:"hidden",position:"relative"});J.children().css({position:"absolute",top:0,left:J.children().outerWidth(),zIndex:0,display:"none"});J.css({position:"relative",width:(Q*3),height:M,left:-Q});A("."+B.container,V).css({display:"block"});if(B.autoHeight){J.children().css({height:"auto"});J.animate({height:J.children(":eq("+D+")").outerHeight()},B.autoHeightSpeed);}if(B.preload&&J.find("img:eq("+D+")").length){A("."+B.container,V).css({background:"url("+B.preloadImage+") no-repeat 50% 50%"});var Y=J.find("img:eq("+D+")").attr("src")+"?"+(new Date()).getTime();if(A("img",V).parent().attr("class")!="slides_control"){T=J.children(":eq(0)")[0].tagName.toLowerCase();}else{T=J.find("img:eq("+D+")");}J.find("img:eq("+D+")").attr("src",Y).load(function(){J.find(T+":eq("+D+")").fadeIn(B.fadeSpeed,B.fadeEasing,function(){A(this).css({zIndex:5});A("."+B.container,V).css({background:""});U=true;B.slidesLoaded();});});}else{J.children(":eq("+D+")").fadeIn(B.fadeSpeed,B.fadeEasing,function(){U=true;B.slidesLoaded();});}if(B.bigTarget){J.children().css({cursor:"pointer"});J.children().click(function(){E("next",L);return false;});}if(B.hoverPause&&B.play){J.bind("mouseover",function(){R();});J.bind("mouseleave",function(){G();});}if(B.generateNextPrev){A("."+B.container,V).after('<a href="#" class="'+B.prev+'">Prev</a>');A("."+B.prev,V).after('<a href="#" class="'+B.next+'">Next</a>');}A("."+B.next,V).click(function(a){a.preventDefault();if(B.play){G();}E("next",L);});A("."+B.prev,V).click(function(a){a.preventDefault();if(B.play){G();}E("prev",L);});if(B.generatePagination){if(B.prependPagination){V.prepend("<ul class="+B.paginationClass+"></ul>");}else{V.append("<ul class="+B.paginationClass+"></ul>");}J.children().each(function(){A("."+B.paginationClass,V).append('<li><a href="#'+C+'">'+(C+1)+"</a></li>");C++;});}else{A("."+B.paginationClass+" li a",V).each(function(){A(this).attr("href","#"+C);C++;});}A("."+B.paginationClass+" li:eq("+D+")",V).addClass(B.currentClass);A("."+B.paginationClass+" li a",V).click(function(){if(B.play){G();}I=A(this).attr("href").match("[^#/]+$");if(P!=I){E("pagination",S,I);}return false;});A("a.link",V).click(function(){if(B.play){G();}I=A(this).attr("href").match("[^#/]+$")-1;if(P!=I){E("pagination",S,I);}return false;});if(B.play){F=setInterval(function(){E("next",L);},B.play);V.data("interval",F);}});};A.fn.slides.option={preload:false,preloadImage:"/img/loading.gif",container:"slides_container",generateNextPrev:false,next:"next",prev:"prev",pagination:true,generatePagination:true,prependPagination:false,paginationClass:"pagination",currentClass:"current",fadeSpeed:350,fadeEasing:"",slideSpeed:350,slideEasing:"",start:1,effect:"slide",crossfade:false,randomize:false,play:0,pause:0,hoverPause:false,autoHeight:false,autoHeightSpeed:350,bigTarget:false,animationStart:function(){},animationComplete:function(){},slidesLoaded:function(){}};A.fn.randomize=function(C){function B(){return(Math.round(Math.random())-0.5);}return(A(this).each(function(){var F=A(this);var E=F.children();var D=E.length;if(D>1){E.hide();var G=[];for(i=0;i<D;i++){G[G.length]=i;}G=G.sort(B);A.each(G,function(I,H){var K=E.eq(H);var J=K.clone(true);J.show().appendTo(F);if(C!==undefined){C(K,J);}K.remove();});}}));};})(jQuery);
//--eof--picture scroll code
//--bof--top nav
var $pc=jQuery;
var agt=navigator.userAgent.toLowerCase();
var pcj_isIe=agt.indexOf("msie")!=-1;
var pcj_isIe6under=false;
if(pcj_isIe){pcj_isIe6under=(agt.indexOf("msie 6")!=-1||agt.indexOf("msie 5")!=-1||agt.indexOf("msie 4")!=-1)}
var pcj_isSaf=agt.indexOf("safari")!=-1;
var pcj_isFf=agt.indexOf("firefox")!=-1;
var pcj_isMac=agt.indexOf("mac")!=-1;
var pcj_isOpera=agt.indexOf("opera")!=-1;
var pcj_pageready=false;
var pcj_dataready=false;
var pcj_processed=false;
var pcShopperId;
var pcIsTrusted;
var pcFirstName;
var pcRepName;
var pcRepExt;
var pcRepEmail;
var pcCartCt;
var pcExpDomCt;
var pcIsDiscount;
var pcj_date=new Date();
(function(a){a.fn.hoverIntent=function(j,k){
	var b={sensitivityX:28,sensitivityY:7,interval:100,timeout:0};b=a.extend(b,k?{over:j,out:k}:j);
	var d,e,m,n;
	var o=function(f){d=f.pageX;e=f.pageY};
	var c=function(f,g){g.hoverIntent_t=clearTimeout(g.hoverIntent_t);
	if((Math.abs(m-d)<b.sensitivityX)&&(Math.abs(n-e)<b.sensitivityY)){a(g).unbind("mousemove",o);g.hoverIntent_s=1;return b.over.apply(g,[f])}
	else{m=d;n=e;g.hoverIntent_t=setTimeout(function(){c(f,g)},b.interval)}};
	var h=function(f,g){g.hoverIntent_t=clearTimeout(g.hoverIntent_t);g.hoverIntent_s=0;return b.out.apply(g,[f])};
	var l=function(f){
	var r=(f.type=="mouseover"?f.fromElement:f.toElement)||f.relatedTarget;while(r&&r!=this){try{r=r.parentNode}catch(f){r=this}}
	if(r==this){return false}
	var g=jQuery.extend({},f);
	var q=this;
	if(q.hoverIntent_t){q.hoverIntent_t=clearTimeout(q.hoverIntent_t)}
	if(f.type=="mouseover"){m=g.pageX;n=g.pageY;a(q).bind("mousemove",o);
	if(q.hoverIntent_s!=1){q.hoverIntent_t=setTimeout(function(){c(g,q)},b.interval)}}
	else{a(q).unbind("mousemove",o);
	if(q.hoverIntent_s==1){q.hoverIntent_t=setTimeout(function(){h(g,q)},b.timeout)}}};return this.mouseover(l).mouseout(l)}})(jQuery);
function pcj_showElement(a){
	for(i=0;i<document.getElementsByTagName(a).length;i++){obj=document.getElementsByTagName(a)[i];
	if(!obj||!obj.offsetParent){continue}
	if(pcj_isIe&&(obj.readyState==4)&&(obj.tagName.toUpperCase()=="OBJECT")){continue}
	if((obj.id.toLowerCase().indexOf("apollo")>0)&&(obj.tagName.toUpperCase()=="OBJECT")){continue}obj.style.visibility=""}}
function pcj_hideDDs(a){
	pcj_showElement("SELECT");
	pcj_showElement("OBJECT");
	pcj_showElement("EMBED")}


$pc(document).ready(function(){
	pcj_pageready=true;
	$pc(".nav_bar_meun_gd-dropdown-list li, .td-ul li").hover(function(){
	$pc(this).addClass("dd-h")},function(){
	$pc(this).removeClass("dd-h")})});


var pcj_inMenuHeader = false;
var pcj_inMenuDrop = false;

$pc(document).ready(function () {
    $pc("#nav_bar_meun_gd-navbar li").hoverIntent(
        function (event) {
            pcj_hideDDs("");
            var headerId = this.id;
            if (headerId.length > 0) {
                var dropId = headerId + "-dropdown";
                var hoverClass = headerId + "-hover";
                pcj_inMenuHeader = true;
                $pc("#" + headerId + " a").addClass(hoverClass);
                $pc("#" + dropId).show();
            }
        },
        function (event) {
            if (!pcj_inMenuDrop) {
                var headerId = this.id;
                if (headerId.length > 0) {
                    var dropId = headerId + "-dropdown";
                    var hoverClass = headerId + "-hover";
                    $pc("#" + headerId + " a").removeClass(hoverClass);
                    $pc("#" + dropId).hide();
                }
            }
            pcj_inMenuHeader = false;
        });

    $pc("#nav_bar_meun_gd-dds div.dropdowns").hover(
        function (event) {
            pcj_hideDDs("");
            var dropId = this.id;
            if (dropId.length > 0) {
                var headerId = dropId.replace("-dropdown", "");
                var hoverClass = headerId + "-hover";
                pcj_inMenuDrop = true;
                $pc("#" + headerId + " a").addClass(hoverClass);
                $pc("#" + dropId).show();
            }
        },
        function (event) {
            var dropId = this.id;
            if (dropId.length > 0) {
                var headerId = dropId.replace("-dropdown", "");
                var hoverClass = headerId + "-hover";
                $pc("#" + headerId + " a").removeClass(hoverClass);
                $pc("#" + dropId).hide();
            }
            pcj_inMenuDrop = false;
        });
});
//--eof--top nav
//--bof--home tab menu
function tab(obj) {
    document.getElementById('div1').className = 'nodisplay'
    document.getElementById('div2').className = 'nodisplay'
    document.getElementById('div3').className = 'nodisplay'
    document.getElementById(obj).className = 'contentbox'
}
function bgtab(obj_bg) {
    document.getElementById('tab_1').className = 'off'
    document.getElementById('tab_2').className = 'off'
    document.getElementById('tab_3').className = 'off '
    if (obj_bg == 'tab_3') {
        flag = document.getElementById(obj_bg).className = 'on , border_right'
    }
    else
    {
        document.getElementById(obj_bg).className = 'on'
    }
}
function showddiv() {

    document.getElementById('tab_1').className = 'off'
    document.getElementById('tab_2').className = 'off'
    document.getElementById('tab_3').className = 'off '

}

//--eof--home tab menu
//--bof--home picture scroll
$(function(){
	$('#slides').slides({
		preload: true,
		preloadImage: 'http://www.undirect.com/includes/templates/pure_blue/images/loading.gif',
		play: 5000,
		pause: 2500,
		hoverPause: true
	});
});
//--eof--home picture scroll

//bof---commit comment
$(function(){
	$("#js_reviewForm").submit(function(){

		if($("#review_text").get(0).value.length<3){
			alert("Please add a few more words to your comments. The review needs to have at least 3 characters");			return false;
		}
		
		return true;	
  	});
});
//eof---commit comment

//bof---Customers Ultimately Buy
$(function(){

    var $cur = 1;
    var $i = 5;
    var $len = $('#crossSell1 .elementbox>ul>li').length;
    var $pages = Math.ceil($len / $i);
    var $w = $('.vier_scroll').width();
    var $showbox = $('.elementbox');
    var $pre = $('a.scroll_leftbtn')
    var $next = $('a.scroll_rightbtn');
 	//***left button
    $pre.click(function(){
        if (!$showbox.is(':animated')) { 
            if ($cur == 1) {   
                $showbox.animate({
                    left: '-=' + $w * ($pages - 1)
                }, 500);
                $cur = $pages; 
            }
            else { 
                $showbox.animate({
                    left: '+=' + $w
                }, 500); 
                $cur--; 
            }
           
        }
		return false;
    });
    //***right button
    $next.click(function(){
        if (!$showbox.is(':animated')) { 
            if ($cur == $pages) {  
                $showbox.animate({
                    left: 0
                }, 500); 
                $cur = 1; 
            }
            else {
                $showbox.animate({
                    left: '-=' + $w
                }, 500);
                $cur++; 
            }
           
        }
		return false;
    });
   
})
//eof---Customers Ultimately Buy
