
$(document).ready(function(){
	$("dd").hide();
	$("dd ul li ul").hide();
	$("#basketDrop").hide();
	
	$('.leftDropDownBox .leftDropDownBoxButton a').click(function(){
	    if($(this).parent().parent().find('#leftDropDownBoxContents').css('display').match('block')) {
	        
			$(this).removeClass().addClass("leftColumnUP");
			$(this).parent().parent().find('#leftDropDownBoxContents').slideUp(10);
		} else {
			$(this).removeClass().addClass("leftColumnDOWN");
			$(this).parent().parent().find('#leftDropDownBoxContents').slideDown("slow");
		};
		return false;
	});
	$('.leftDropDownBox_2 .leftDropDownBoxButton_2 a').click(function(){
	    if($(this).parent().parent().find('#leftDropDownBoxContents_2').css('display').match('block')) {
			$(this).removeClass().addClass("leftColumnUP");
			$(this).parent().parent().find('#leftDropDownBoxContents_2').slideUp(10);
		} else {
			$(this).removeClass().addClass("leftColumnDOWN");
			$(this).parent().parent().find('#leftDropDownBoxContents_2').slideDown("slow");
		};
		return false;
	});
	$('.leftDropDownBox #leftDropDownBoxIntWithArrow #leftDropDownBoxIntArrowLink a').click(function(){
        if($(this).parent().parent().parent().find('#leftDropDownBoxIntContents').css('display').match('block')) {
			$(this).parent().parent().parent().find('#leftDropDownBoxIntContents').slideUp("slow");	
			
		} else {
			$(this).parent().parent().parent().find('#leftDropDownBoxIntContents').slideDown("slow");
			
		};
		return false;
	});
	$('#leftDropDownImg').click(function(){

		if($('#leftDropDownBoxIntContents2').css('display').match('block')) {
			$('#leftDropDownBoxIntContents2').slideUp("slow");
			$('#leftDropDownBoxIntArrowLink').addClass('arrow_up');
			$('#leftDropDownBoxIntArrowLink').removeClass('arrow_down');
			$(this).removeClass('WithArrowSel');
		} else {
			$('#leftDropDownBoxIntContents2').show(50);
			$('#leftDropDownBoxIntArrowLink').addClass('arrow_down');
			$('#leftDropDownBoxIntArrowLink').removeClass('arrow_up');
			$(this).addClass('WithArrowSel');
		};
		return false;
	});
	
	$('#leftBoxes li').hover(
		function () {
			$(this).css("background-color","yellow");
		},
		function () {
		       $(this).css("background-color","");;
		}
		);
	
	$('.scTopOptions a').click(function() {
		if($(this).attr('id').match('tab1')) {
			$(this).parent().parent().parent().find('#proAvPri').show();
			$(this).parent().parent().parent().find('#proKitInf').hide();
		} else if ($(this).attr('id').match('tab3')) {
			$(this).parent().parent().parent().find('#proAvPri').hide();
			$(this).parent().parent().parent().find('#proKitInf').show();
		};
		return false;
	});
	$('.tab1').click(function(){
		$('.scTopOptions a').removeClass('tab_sel');
		$('.tab1').addClass('tab_sel');
	});
	$('.tab1').click(function(){
		$('.scTopOptions a').removeClass('tab_sel');
		$('.tab1').addClass('tab_sel');
		$('.tab_left').removeClass('tab_left_sel');
		$('#bl1').addClass('tab_left_sel');
		$('.tab_right').removeClass('tab_right_sel');
		$('#br1').addClass('tab_right_sel');
	});
	$('.tab3').click(function(){
		$('.scTopOptions a').removeClass('tab_sel');
		$('.tab3').addClass('tab_sel');
		$('.tab_left').removeClass('tab_left_sel');
		$('#bl3').addClass('tab_left_sel');
		$('.tab_right').removeClass('tab_right_sel');
		$('#br3').addClass('tab_right_sel');
	});
	$('#clickDown a').click(function() {
		var k = $(this).parent().parent().find('#ct1').scrollTop()+90;
		$(this).parent().parent().find('#ct1').animate({scrollTop: k},300);
		return false;
	});
	
	$('#clickUp a').click(function() {
		var k = $(this).parent().parent().find('#ct1').scrollTop()-90;
		$(this).parent().parent().find('#ct1').animate({scrollTop: k},300);
		return false;
	});
		
	$('.spHead a').click(function() {
		if($(this).attr('id').match('showBasicSearch')) {
			$('.spHead').addClass('bsBut');
			$('.spHead').removeClass('asBut');
			$(this).parent().parent().find('#advancedSearchDiv').hide();;
			$(this).parent().parent().find('#basicSearchDiv').show();;
		} else {
			$('.spHead').addClass('asBut');
			$('.spHead').removeClass('bsBut');
			$(this).parent().parent().find('#advancedSearchDiv').show();;
			$(this).parent().parent().find('#basicSearchDiv').hide();;
		}
		return false;
	});
	
	$('#hideShowEl a').click(function() {
		
		if($(this).parent().parent().parent().find('#checkEl').css('display').match('block')) {
			$(this).css('background-image',"url('images/blue_arrow_down.png')");
			$(this).parent().parent().parent().find('#checkEl').slideUp("slow");
		} else {
			$(this).css('background-image',"url('images/blue_arrow_up.png')");
			$(this).parent().parent().parent().find('#checkEl').slideDown("slow");
		}
		return false;
	});
	
	$('#hideShowEl2 a').click(function() {
		
		if($(this).parent().parent().parent().find('#checkEl2').css('display').match('block')) {
			$(this).css('background-image',"url('images/blue_arrow_down.png')");
			$(this).parent().parent().parent().find('#checkEl2').slideUp("slow");
		} else {
			$(this).css('background-image',"url('images/blue_arrow_up.png')");
			$(this).parent().parent().parent().find('#checkEl2').slideDown("slow");
		}
		return false;
	});
	
	$('#hideShowElAll a').click(function() {
		
		if($(this).parent().parent().parent().find('#checkEl').css('display').match('block')) {
			
			$(this).parent().parent().parent().find('#hideShowEl a').css('background-image',"url('images/blue_arrow_down.png')");
			$(this).parent().parent().parent().find('#checkEl').slideUp("slow");
		} else {
			$(this).parent().parent().parent().find('#hideShowEl a').css('background-image',"url('images/blue_arrow_up.png')");
			$(this).parent().parent().parent().find('#checkEl').slideDown("slow");
		}
		return false;
	});
	
	$('#checkAllEl a').click(function() {
		$(this).parent().parent().parent().find('#checkEl img').each(
			function () {
			       $(this).attr('src','images/checkbox_on.gif');
			}
		);
		return false;
	});
	
	$('#uncheckAllEl a').click(function() {
		$(this).parent().parent().parent().find('#checkEl img').each(
			function () {
			       $(this).attr('src','images/checkbox_off.gif');
			}
		);
		return false;
	});
	
	$('.spContent .spTitle ul li a').click(function() {
		if($(this).find('img').attr('src').match('images/checkbox_off.gif')) {
			$(this).find('img').attr('src','images/checkbox_on.gif');
		} else {
			$(this).find('img').attr('src','images/checkbox_off.gif');
		}
		return false;
	});
	
	$('#dropDownDiv div').hover(
		function () {
			$(this).css("background-image","url('images/order_bg_s.gif')");
		},
		function () {
		       $(this).css("background-image","url('images/order_bg.gif')");;
		}
		);
		$('#dropDownDiv2 div').hover(
		function () {
			$(this).css("background-image","url('images/order_bg_s.gif')");
		},
		function () {
		       $(this).css("background-image","url('images/order_bg.gif')");;
		}
		);
	
	
	$('.sortDropDown a').click(function() {
		if($(this).parent().find("#dropDownDiv2").css('display').match('block')) {
			$(this).parent().find("#dropDownDiv2").slideUp("slow");
			$('.sortDropDownLink').removeClass('abs')
		} else {
			$('.sortDropDownLink').addClass('abs');
			$(this).parent().find("#dropDownDiv2").slideDown("slow");
			
		}
		return false;
	});
	
	$('.sortDropDown2 a').click(function() {
		if($(this).parent().find("#dropDownDiv").css('display').match('block')) {
			$(this).parent().find("#dropDownDiv").slideUp("slow");
		} else {
			$(this).parent().find("#dropDownDiv").slideDown("slow");	
		}
		return false;
	});
	
	$("#container").click(function() {
			$('.sortDropDownLink').removeClass('abs')
			$(this).parent().find('#dropDownDiv').slideUp("slow");
	});
	
	$("#container").click(function() {
			$(this).parent().find('#dropDownDiv2').slideUp("slow");
	});
	
	$('.sortDropDown a').click(function() {
		$("#dropDownDiv").hide("fast");
	})
	$('.sortDropDown2 a').click(function() {
		$("#dropDownDiv2").hide("fast");
	});
	
	$('#customizeBut a').click(function() {
		
		if($(this).parent().parent().parent().find("#cusDiv").css('display').match('block')) {
			$(this).attr('class','downArrowID');
			$(this).parent().parent().parent().find("#cusDiv").slideUp(5);
		} else {
			$(this).attr('class','upArrowID');
			$(this).parent().parent().parent().find("#cusDiv").slideDown(5);
		}
		return false;
	});
	
	$('#moreDetails #viewMoreBut a').click(function() {
		if($(this).parent().parent().parent().find("#divDetails").css('display').match('block')) {
			$(this).html('view more');
			$(this).attr('class','downArrowID');
			$(this).parent().parent().parent().find("#divDetails").slideUp("slow");
		} else {
			$(this).html('show less');
			$(this).attr('class','upArrowID');
			$(this).parent().parent().parent().find("#divDetails").slideDown("slow");
		}
		return false;
	});
	
	$("a#sortButton img").click(function() {
		if ($(this).attr('src').match("images/sort_field.gif")) {
			$(this).attr('src','images/sort_field_open.gif');
			$(this).parent().parent().find("#sortDrop").slideDown("slow");
		} else {
			$(this).attr('src','images/sort_field.gif');
			$(this).parent().parent().find("#sortDrop").slideUp("slow");
		}
		return false;
		
	});
	
	$("a#sortButton2 img").click(function() {
		if ($(this).attr('src').match("images/sort_field.gif")) {
			$(this).attr('src','images/sort_field_open.gif');
			$(this).parent().parent().find("#sortDrop2").slideDown("slow");
		} else {
			$(this).attr('src','images/sort_field.gif');
			$(this).parent().parent().find("#sortDrop2").slideUp("slow");
		}
		return false;
		
	});
	
	$("div#sortDropContents div").hover(
					 function () {
						$(this).removeClass().addClass("orderDivHover");
					 },
					 function () {
						$(this).removeClass().addClass("orderDiv");
					 }
					 );
	
	$("#basketBut").click(function() {
		if($(this).attr('href').match('#')){
		if ($(this).attr('class').match("basketUP")) {
			$(this).removeClass().addClass("basketDOWN");
			$("#basketDrop").slideDown("slow");
		} else {
			$(this).removeClass().addClass("basketUP");
			$("#basketDrop").slideUp("slow");
		}
		return false;
		}
		return true;
	});
	$("#c").click(function(){
			$("#basketBut").removeClass().addClass("basketUP");
			$("#basketDrop").slideUp("slow");
	});
	$("#menu").click(function(){
			$("#basketDrop").slideUp("slow");
	});
	$("#basketDrop").click(function(){
			
			$("#basketDrop").slideDown("slow");
	});
	
	$("dd ul li.ulDown").click(function() {
		if ($(this).attr('class').match("ulDown")) {
			$(this).removeClass().addClass("ulUp");
			$(this).children().next().slideDown("slow");
		} else {
			$(this).removeClass().addClass("ulDown");
			$(this).children().next().slideUp("slow");
		}
		return false;
	});

	
	$("dt a").click(function() {
		if($(this).parent().next().attr('style').match('block')) {
			$(this).removeClass().addClass("leftColumnUP");
			$(this).parent().next().slideUp("slow");
		} else {
			$(this).removeClass().addClass("leftColumnDOWN");
			$(this).parent().next().slideDown("slow");
		}
		return false;
	});
	
	$("div#checkButton2 :img").click(function() {
		if ($(this).attr('src').match('images/checkbox_off.gif')) {
			$(this).attr('src','images/checkbox_on.gif');
		} else {
			$(this).attr('src','images/checkbox_off.gif');
		}
		return true;
	});
	
	$('.whiteDropBox a').click(function() {
		if($(this).parent().find('.whiteDrop').css('display').match('block')) {
			$(this).attr('class', 'wdbBut');
			$(this).parent().find('.whiteDrop').slideUp("slow");
		} else {
			$(this).attr('class', 'wdbButUp');
			$('.basePop').slideUp("slow");
			$('#bottomNavDropDown').attr('class','downArrow');
			$('.basePop1').slideUp("slow");
			$('#bottomNavDropDown1').attr('class','downArrow');
			$('.basePop2').slideUp("slow");
			$('#bottomNavDropDown2').attr('class','downArrow');
			$(this).parent().find('.whiteDrop').slideDown("slow");
		}
		return false;
	});
	$("#container").click(function() {
			$('#wdb').attr('class', 'wdbBut');
			$(this).parent().find('.whiteDrop').slideUp("slow");
	});
	
	$('#bottomNavDropDown a').click(function() {
		if($(this).parent().find('.basePop').css('display').match('block')) {
			$(this).parent().parent().find('#bottomNavDropDown').attr('class','downArrow');
			$(this).parent().find('.basePop').slideUp("slow");
		} else {
			$(this).parent().parent().find('#bottomNavDropDown').attr('class','upArrow');
			$('.basePop1').slideUp("slow");
			$('#bottomNavDropDown1').attr('class','downArrow');
			$('.basePop2').slideUp("slow");
			$('#bottomNavDropDown2').attr('class','downArrow');
			$('#wdb').attr('class', 'wdbBut');
			$('.whiteDrop').slideUp("slow");
			$(this).parent().find('.basePop').slideDown("slow");
		}
		return false;
	});
	$("#container").click(function() {
			$('#bottomNavDropDown').attr('class','downArrow');
			$(this).parent().find('.basePop').slideUp("slow");
	});
	
	$('#bottomNavDropDown1 a').click(function() {
		if($(this).parent().find('.basePop1').css('display').match('block')) {
			$(this).parent().parent().find('#bottomNavDropDown1').attr('class','downArrow');
			$(this).parent().find('.basePop1').slideUp("slow");
		} else {
			$(this).parent().parent().find('#bottomNavDropDown1').attr('class','upArrow');
			$('.basePop').slideUp("slow");
			$('#bottomNavDropDown').attr('class','downArrow');
			$('.basePop2').slideUp("slow");
			$('#bottomNavDropDown2').attr('class','downArrow');
			$('#wdb').attr('class', 'wdbBut');
			$('.whiteDrop').slideUp("slow");
			$(this).parent().find('.basePop1').slideDown("slow");
			
		}
		return false;
	});
	$("#container").click(function() {
			$('#bottomNavDropDown1').attr('class','downArrow');
			$(this).parent().find('.basePop1').slideUp("slow");
	});
	
	$('#bottomNavDropDown2 a').click(function() {
		if($(this).parent().find('.basePop2').css('display').match('block')) {
			$(this).parent().parent().find('#bottomNavDropDown2').attr('class','downArrow');
			$(this).parent().find('.basePop2').slideUp("slow");
		} else {
			$(this).parent().parent().find('#bottomNavDropDown2').attr('class','upArrow');
			$('.basePop').slideUp("slow");
			$('#bottomNavDropDown').attr('class','downArrow');
			$('.basePop1').slideUp("slow");
			$('#bottomNavDropDown1').attr('class','downArrow');
			$('#wdb').attr('class', 'wdbBut');
			$('.whiteDrop').slideUp("slow");
			$(this).parent().find('.basePop2').slideDown("slow");
			
		}
		return false;
	});
	$("#container").click(function() {
			$('#bottomNavDropDown2').attr('class','downArrow');
			$(this).parent().find('.basePop2').slideUp("slow");
	});
	
	$("#user").click(function(){
		$("#loginTime").slideDown("slow");
	});

  if ($.browser.msie && $.browser.version.substr(0,1)<7) {
    // search for selectors you want to add hover behavior to
       var head=document.getElementsByTagName("head")[0];
       var cssNode = document.createElement('link');
       cssNode.type = 'text/css';
       cssNode.rel = 'stylesheet';
       cssNode.href = "css/ie6.css";
       head.appendChild(cssNode);
  }
//    alert($.browser.version);
	$("#log").click(function () {
      if ($("#login_info:first").is(":hidden")) {
      	$("#log").addClass("login_up")
      	$("#log").removeClass("login_down")
        $("#login_info").show(5);
      } else {
      	
        $("#login_info").hide();
        $("#log").addClass("login_down")
      	$("#log").removeClass("login_up")
      }
    });
    
    $("#search_more").click(function () {
      if ($("#more_ul").is(":hidden")) {
        $("#more_ul").slideDown("slow");
        $("#search_more").removeClass("moreLinkDown");
        $("#search_more").addClass("moreLinkUp");          
      } else {
        $("#more_ul").hide();
        $("#search_more").removeClass("moreLinkUp");
        $("#search_more").addClass("moreLinkDown");      
      }
    });
    
$("#DD").click(function(){
	 if ($(".cont:first").is(":hidden")) {
        $("#DD").removeClass("topUp");
        $("#DD").addClass("topDown");
        $(".cont").slideDown("slow");
        
      } else {
        $("#DD").removeClass("topDown");
        $("#DD").addClass("topUp");
        $(".cont").hide();
        
      }
});



});
