$(function() {
	$(".brand_view").colorbox({width:"520px"});
	if(navigator.userAgent.match(/iPad/i) != null || navigator.userAgent.match(/iPod/i) != null || navigator.userAgent.match(/iPhone/i) != null){
		phone = "left";
	}else{
		phone = "right";
	}
	
	var options2 = {
		zoomWidth: 440,
		zoomHeight: 450,
		title:false,
		position : phone,
        xOffset :40
	}

	$(".jqzoom").jqzoom(options2);
	
	$('#productPageImages').after('<div id="productNav"><div class="itemsThumb">').cycle({
		fx:     'fade',
		speed:  'fast',
		timeout: 0,
		pager:  '.itemsThumb',
		pagerAnchorBuilder: function(idx, slide) {
			return '<div class="tborder"><a href="#"><img src="' + slide.children[0].src + '" width="59" height="89" /></a></div>';
		}
	});
	
	$("#productNav").scrollable();
	$('.browse1').show();
	
	$("#cc").click(function(){
		$("#cc_submit").slideUp({
			complete:function(){
				document.getElementById("cc_submit").innerHTML = "processing...";
				$("#cc_submit").slideDown();
			}
		});
	});
	
});
function shipping(v,t){
	$('.lp').show();$('.f_Total').hide();
	$.post("index.php", { update_shipping: v },
	function(data) {
		$('.lp').hide();
		v = parseFloat(v);
		$('.f_Total').html('$'+(parseFloat(t)+v).toFixed(2)).show();
	});
}

function subscribe(in1, in2){
	if(in1 == "" || in2 == ""){
		alert("* required");
		return;
	}
	document.getElementById('btnLoading').innerHTML = 'processing...';
	$.post("../includes/shop_subscribe.php", { name: in1, eml: in2 },
	   function(data){
		$("#subscribe").slideUp({
			complete:function(){
				document.getElementById('subscribe').innerHTML = data;
				$("#subscribe").slideDown();
			}
		});
		 
	});
}
function copy_address(f){
	var chckbox = document.getElementById("copy_add");
	var delivery = new Array(f.Daddress,f.Dcity,f.Dstate,f.Dsuburb,f.Dzip);
	var billing = new Array(f.address,f.city,f.state,f.suburb,f.zip);

	if(chckbox.checked){
		for(i = 0; i < delivery.length; i++){
			billing[i].value = delivery[i].value;
		}
		for(x=f.Dcountry.options.length-1;x>=0;x--){
			if(f.Dcountry.options[x].selected)
			f.country.options[x].selected=true;
		}
		//$("#hide_show").hide();

	}else{
		for(i = 0; i < delivery.length; i++){
			billing[i].value = "";
		}
		f.country.options[0].selected=true;
		//$("#hide_show").show();
	}
}
