// JavaScript Document

$(document).ready(function(){
		$('#container').append($('<span class="bottom"><!----></span>'));
		
		$('#notes').prepend($('<span class="top"><!----></span>'));
		$('#notes').append($('<span class="bottom"><!----></span>'));
		
		//$('#header img:last-child').attr("style", "left:656px");
		$('.topNav li:first-child').css({'background': 'none'});
		
		/* Start: Search Field focus*/
		$('#searchfld').focus(function() {
			$(this).css({'color': '#000'});
			if ($(this).val() == this.defaultValue) 
			  {
				$(this).val("");
			  }; 
		});
		$('#searchfld').blur(function() {
			if ($(this).val() == '') 
			  {
				$(this).val("Search Product, Item or Brand ...");
				$(this).css({'color': '#a5a5a5'});
			  }; 
		});
		/* End: Search Field focus*/
		
		// Drop Down Siblings added for rounded corners and shadow
		$('.mainNav li').find("div.drop").prepend($('<div class="topBg"><!----></div>'));
		$('.mainNav li').find("div.drop").append($('<div class="bottomBg"><!----></div>'));
		$('.mainNav li').find("div.drop div.content").append($('<div class="spacer"><!----></div>'));
		
		/* Start: Adding Class for ain Navigation*/
		$('.mainNav li').hover(function () {
                   $(this).addClass("current");
				   $(this).find("div.drop").show();
				   //$(document).pngFix();					
                }, function () {
                     $(this).removeClass("current");
					 $(this).find("div.drop").hide();
                });
		$('.mainNav li:first-child').hover(function () {
                   $(this).removeClass("current");
				   $(this).addClass("currentfirst");
					
                }, function () {
                     $(this).removeClass("currentfirst");
                });
		$('.mainNav li:last-child').hover(function () {
                   $(this).removeClass("current");
				   $(this).addClass("currentlast");
					
                }, function () {
                     $(this).removeClass("currentlast");
                });

		//$(".mainNav div.drop").prepend($('<img src="images/topmenu-drop-bgT.png" alt="" />'));

		/* End: Main Navigation*/
		
		/* Start: Adding elements in the Col2*/
		$('.col2').prepend($('<span class="top"><!----></span>'));
		$('.col2').append($('<span class="bottom"><!----></span>'));
			$('.shopBy, .whyChoose').prepend($('<span class="top"><!----></span>'));
			$('.shopBy, .whyChoose').append($('<span class="bottom"><!----></span>'));
				$('.shopBy li:last-child').attr("style", "border:0;");
		/* End: Adding elements in the Col2*/
		
		/* Start: RollOver Image*/
		//$('.col2 img[alt="Join the brace shop club and save"]').parent().addClass("join");
		//$('.col2 a.join').append($('<span><!----></span>'));
		/* End: RollOver Image*/
		
		/* Start: 3 Boxes in Right Column*/
		$('.boxes li').prepend($('<span class="top"><!----></span>'));
		$('.boxes li').append($('<span class="bottom"><!----></span>'));
		$('.boxes li:last-child').attr("style", "margin-right:0;");
		
		/*$(".boxes li").click(function(){
    			window.location=$(this).find("a").attr("href");return false;
		});*/
		//added June6,2010 1:13AM GMT+8
		$(".box").click(function(){
    			window.location=$(this).find("a").attr("href");return false;
		});
		//added June6,2010 1:13AM GMT+8
		
			$('.boxes li').hover(function () {
                    $(this).children('h3').css({
                        'color': '#7ba023'
                    });
					
                }, function () {
                     $(this).children('h3').css({
                        'color': '#0d60a2'
                    });
                });
			
		/* End: 3 Boxes in Right Column*/
		
		/* Start: Col2 - Drop Down*/
		$("div.drop").parent().addClass("dropdown");
		$(".shopBy div.drop").prepend($('<div class="topBg"><em class="middle"><!----></em><em class="right"><!----></em></div>'));
		$(".shopBy div.drop").append($('<div class="bottomBg"><em class="left"><!----></em><em class="middle"><!----></em><em class="right"><!----></em></div>'));
		$(".shopBy ul li.dropdown").hover(function(){
			$(this).find("div.drop").css('visibility', 'visible');
			$(this).addClass("activeMenu");
			//$(document).pngFix();
			$(this).hover(function() {
				}, function(){
					$(this).find("div.drop").css('visibility', 'hidden'); //When the mouse hovers out of the subnav, move it back up
					$(this).removeClass("activeMenu");
				}); 
		});
		/* End: Col2 - Drop Down*/
		
		/* Start: Footer */
		$('#footer').prepend($('<span class="top"><!----></span>'));
		$("#footer img:first-child").attr("style", "margin-right:7px;");
		$("#footer img:last-child").attr("style", "margin-left:7px;");
		$('#footer').append($('<span class="bottom"><!----></span>'));
		/* End: Footer */
});
