$(document).ready(function(){
var sbDefault=$("#livesearch").html();


	$(".qtyBox").click(function() {
		$(this).attr("value", ""); 
	});
	$(".qtyBox").blur(function() {
		if($(this).val()=="") { $(this).attr("value", "qty"); }
	});
	$(".searchBar").click(function() {
		if($(this).val()=="product search") { $(this).attr("value", ""); }
	});
	$(".searchBar").blur(function() {
		if($(this).val()=="") { 
			$(this).attr("value", "product search"); 
			$("#livesearch").html(sbDefault);
		}
	});
	
	$("#shop").click(function(){
		$("#catDropDown").slideToggle();
		return false;	
	});
	$("#closeBox").click(function(){
		$("#catDropDown").slideToggle();
		return false;	
	});
	
	
	$("#q").keyup(function(event){
	var searchval = $("#q").val();
		if($("#q").val().length==0) {
			$("#livesearch").html(sbDefault);
		}
		else {
			$.get("livesearch.php", { q: searchval },
				function(data){
					$("#livesearch").html(data);
				}
			);
		}
	});
	
	
	//login tab at top
	var x = 0;
	var y = 0;
	$("#loginOpen").click(function(){
		if(y==0) {
			$("#userBar").animate({ 
			height: "410px"
			}, 1500 );
			x=1;
		}
		if(y==1) {
			$("#userBar").animate({ 
			height: "0px"
			}, 1500 );
				x=0;
		}
		if(x==1) y=1;
		if(x==0) y=0;
		return false;
	});

	
	
	
	//register tab at top
		var x = 0;
	var y = 0;
	$("#registerOpen").click(function(){
		if(y==0) {
			$("#userBar").animate({ 
			height: "410px"
			}, 1500 );
			x=1;
		}
		if(y==1) {
			$("#userBar").animate({ 
			height: "0px"
			}, 1500 );
				x=0;
		}
		if(x==1) y=1;
		if(x==0) y=0;
		return false;
	});
	
	
	//shopping cart
	var q = 0;
	var r = 0;
	
	$("#cartToggle").click(function(){
		
		if(q==0) {
			$("#shoppingCart").animate({ 
			top: "0px"
			}, 1500 );
			r=1;
		}
		if(q==1) {
			$("#shoppingCart").animate({ 
			top: "-180px"
			}, 1500 );
				r=0;
		}
		if(r==1) q=1;
		if(r==0) q=0;
		return false;
	});
	
	
	//newsletter signup
	$("#name").click(function(){
		if($("#name").val() == 'Name')
			$("#name").val('');
	});
	$("#driuid-driuid").click(function(){
		if($("#driuid-driuid").val() == 'Email')
			$("#driuid-driuid").val('');
	});
	$("#name").blur(function(){
		if($("#name").val() == '')
			$("#name").val('Name');
	});
	$("#driuid-driuid").blur(function(){
		if($("#driuid-driuid").val() == '')
			$("#driuid-driuid").val('Email');
	});
	 //$('#simpleGallery a').lightBox();
	 
	 
	 
	 if ($.browser.msie) {
$('input:radio').click(function () {
this.blur();
this.focus();
});
}



	 $("input[name='shipping']").change(function(){
		if($("input[name='shipping']:checked").val() == 'a'){
			$("#newShipping").hide("slow",function(){ $("#accountShipping").show("slow"); });
		}
		else {
			
			$("#accountShipping").hide("slow",function(){ $("#newShipping").show("slow"); });
		}
		
		
	});
	
	
	$(".pop").hover(function() {
	$(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
	$(this).css("overflow", "visible");
	$(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
		.animate({
			marginTop: '-70px', /* The next 4 lines will vertically align this image */ 
			marginLeft: '-100px',
			top: '50%',
			left: '50%',
			width: '250px', /* Set new width */
			borderWidth:'10px'
		
		}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */

	} , function() {
	$(this).css({'z-index' : '0'}); /* Set z-index back to 0 */

	$(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
		.animate({
			marginTop: '0', /* Set alignment back to default */
			marginLeft: '0',
			top: '0',
			left: '0',
			width: '100%', /* Set width back to default */
			borderWidth: '0px'
		}, 400);
			$(this).css("overflow", "hidden");
});





});