// JavaScript Document
$(document).ready(function(){
	$(".jqzoom").jqueryzoom({
		xzoom:333,  // 放大图的宽
		yzoom:475,  // 放大图的高
		offset:10,   // 放大图距离原图的位置
		position:'right'  // 放大图在原图的右边(默认为right)
	});
});

$(document).ready(function(){
	$("#top_search_button").click(function(){
		document.getElementById('top_search_frm_id').submit();									 
	});
});

$(document).ready(function(){
	$(".introPicList a").click(function(event){
		$(".introPicList a").removeClass();
		$(this).addClass("on");
		var currentImg = $(this).html();
		$("p.introPicShow").empty();
		$("p.introPicShow").append(currentImg);
	});
});

$(document).ready(function(){
	$("label.attribsRadioButton").click(function(event){
		var tmp_attribute_id = $(this).attr("for");
		document.getElementById(tmp_attribute_id).checked = true;
		$("a.product_attribute_color_options").removeClass("on");
		$("#aid-"+tmp_attribute_id).addClass("on");
	});
});

$(document).ready(function(){
	$("a.reduce_item_button").click(function(event){
		$(".tableNumTxt1_sub > input").each(function(i){
			if(this.name == 'cart_quantity[]'){
				if(this.value > 0){
					this.value = parseInt(this.value) - 1;
				}else{
					this.value = 0;
				}
			}
		});
		document.getElementById('cart_form_id_chamgoo').submit();
	});
	
	$("a.add_item_button").click(function(event){
		$(".tableNumTxt1_sub > input").each(function(i){
			if(this.name == 'cart_quantity[]'){
				this.value = parseInt(this.value) + 1;
			}
		});
		document.getElementById('cart_form_id_chamgoo').submit();
	});
	
});

$(document).ready(function(){
	$("#update_items_button_chamgoo").click(function(event){
		document.getElementById('cart_form_id_chamgoo').submit();
	});
});

$(document).ready(function(){
	$("#owner_ship").change(function(event){
		if(this.value == 'other'){
			document.getElementById('owner_ship_other').disabled = false;
		}else{
			document.getElementById('owner_ship_other').value = '';
			document.getElementById('owner_ship_other').disabled = true;
		}
	});						   
});
