var baseURL = 'http://www.gourmetexplorer.com.au/';

var oneProductPriceFormHeader = "";
var oneProductPriceForm = "";
var currentNum = 0;
var currentColorNum = 1;

var xmlhttp;

function GetXmlHttpObject(){
	if (window.XMLHttpRequest){
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject){
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

function getSelectedValue(id){
	var selectMenu = document.getElementById(id);
	var selectedOption = selectMenu.options[selectMenu.selectedIndex];
	return selectedOption.value;
}

function getSubcategories(id, div){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "admin/categories/subcategories_list_ajax/" + value;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			getSubcategoriesResponse(value, div);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function getSubcategoriesResponse(id, div){
	if(xmlhttp.responseText != -1){
		document.getElementById(div).innerHTML = xmlhttp.responseText;
		document.getElementById('subcategories').style.display = 'block';
		
		$('#item-list').sortable({
			opacity: '0.5',
			update: function(e, ui){
				serial = $(this).sortable('serialize');
	
				$.ajax({
					url: baseURL + 'admin/position',
					type: "POST",
					data: serial+'&table_name=categories&column_name=id&where_column=parent_id&where_value=' + id,
					success: function(feedback){
						$('#info-message').html(feedback).slideDown("slow", function () {
							$(this).delay(3000).slideUp(500);
						});						
					}
				});
			}
		});
	}else{
		document.getElementById('subcategories').style.display = 'none';
	}
}


function setSubcategoryDropdown(id, div){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "admin/categories/subcategories_dropdown_ajax/" + value;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			setSubcategoryDropdownResponse(id, div);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function setSubcategoryDropdownResponse(id, div){
	document.getElementById('products').style.display = 'none';
	if(xmlhttp.responseText != "" && xmlhttp.responseText != -1){
		if(xmlhttp.responseText.substring(1, 7) == "select"){
			document.getElementById(div).innerHTML = xmlhttp.responseText;
			document.getElementById('subcategories').style.display = 'block';
			getProducts(id, 'products');
		}else if(xmlhttp.responseText.substring(1, 3) == "ul"){
			document.getElementById('subcategories').style.display = 'none';
			getProducts(id, 'products');
		}
	}else{
		document.getElementById('subcategories').style.display = 'none';
		getProducts(id, 'products');
	}
}

function getProducts(id, div){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "admin/products/products_ajax/" + value;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			getProductsResponse(div, value);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function getProductsResponse(div, id){
	if(xmlhttp.responseText != "" && xmlhttp.responseText != -1){
		document.getElementById(div).innerHTML = xmlhttp.responseText;
		document.getElementById('products').style.display = 'block';
		
		$('#item-list').sortable({
			opacity: '0.5',
			update: function(e, ui){
				serial = $(this).sortable('serialize');
	
				$.ajax({
					url: baseURL + 'admin/position',
					type: "POST",
					data: serial+'&table_name=products&column_name=id&where_column=category_id&where_value=' + id,
					success: function(feedback){
						$('#info-message').html(feedback).slideDown("slow", function () {
							$(this).delay(3000).slideUp(500);
						});						
					}
				});
			}
		});
	}else{
		document.getElementById('products').style.display = 'none';
	}
}

function getSubcategoriesSimple(id, div, div2){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "admin/categories/subcategories_ajax_dropdown_simple/" + value + "/" + div2;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			getSubcategoriesSimpleResponse(id, div);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function getSubcategoriesSimpleResponse(id, div){
	if(xmlhttp.responseText != -1 && xmlhttp.responseText != 'no_subcategories'){
		document.getElementById(div).innerHTML = xmlhttp.responseText;
		document.getElementById('subcategories').style.display = 'block';
		document.getElementById('category-error').style.display = 'none';
	}else{
		document.getElementById('subcategories').style.display = 'none';
	}
}
function getSubcategoriesSimple2(id, div, div2){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "admin/categories/subcategories_ajax_dropdown_simple/" + value + "/" + div2;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			getSubcategoriesSimpleResponse2(id, div);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function getSubcategoriesSimpleResponse2(id, div){
	if(xmlhttp.responseText != -1 && xmlhttp.responseText != 'no_subcategories'){
		document.getElementById(div).innerHTML = xmlhttp.responseText;
		document.getElementById('subcategories2').style.display = 'block';
		document.getElementById('category-error2').style.display = 'none';
	}else{
		document.getElementById('subcategories2').style.display = 'none';
	}
}

function getSubcategoriesSimple3(id, div, div2){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "admin/categories/subcategories_ajax_dropdown_simple/" + value + "/" + div2;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			getSubcategoriesSimpleResponse3(id, div);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function getSubcategoriesSimpleResponse3(id, div){
	if(xmlhttp.responseText != -1 && xmlhttp.responseText != 'no_subcategories'){
		document.getElementById(div).innerHTML = xmlhttp.responseText;
		document.getElementById('subcategories3').style.display = 'block';
		document.getElementById('category-error3').style.display = 'none';
	}else{
		document.getElementById('subcategories3').style.display = 'none';
	}
}

function getSubcategoriesSimple4(id, div, div2){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "admin/categories/subcategories_ajax_dropdown_simple/" + value + "/" + div2;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			getSubcategoriesSimpleResponse4(id, div);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function getSubcategoriesSimpleResponse4(id, div){
	if(xmlhttp.responseText != -1 && xmlhttp.responseText != 'no_subcategories'){
		document.getElementById(div).innerHTML = xmlhttp.responseText;
		document.getElementById('subcategories4').style.display = 'block';
		document.getElementById('category-error4').style.display = 'none';
	}else{
		document.getElementById('subcategories4').style.display = 'none';
	}
}

function getSubcategoriesSimple5(id, div, div2){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "admin/categories/subcategories_ajax_dropdown_simple/" + value + "/" + div2;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			getSubcategoriesSimpleResponse5(id, div);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function getSubcategoriesSimpleResponse5(id, div){
	if(xmlhttp.responseText != -1 && xmlhttp.responseText != 'no_subcategories'){
		document.getElementById(div).innerHTML = xmlhttp.responseText;
		document.getElementById('subcategories5').style.display = 'block';
		document.getElementById('category-error5').style.display = 'none';
	}else{
		document.getElementById('subcategories5').style.display = 'none';
	}
}

function goNextProductTabWithCheck(){
	var category = getSelectedValue('parent_category');
	var subcategory = '';
	var subcategoryVisible = false;
	if(document.getElementById('subcategories').style.display == "block"){
		subcategory = getSelectedValue('parent_subcategory');
		subcategoryVisible = true;
	}
	
	var name = document.getElementById('name').value;

	if(category == '-1'){
		document.getElementById('category-error').style.display = 'block';
	}else{
		document.getElementById('category-error').style.display = 'none';
	}
	
	if(subcategoryVisible){
		if(subcategory == '-1'){
			document.getElementById('subcategory-error').style.display = 'block';
		}else{
			document.getElementById('subcategory-error').style.display = 'none';
		}
	}
	
	if(name == ''){
		document.getElementById('name-error').style.display = 'block';
	}else{
		document.getElementById('name-error').style.display = 'none';
	}
	
	if(subcategoryVisible){
		if(category != '-1' && subcategory != '-1' && name != ''){
			document.getElementById('add-more-link').style.display = "block";
			var $tabs = $('#tabs').tabs();
			var selected = $tabs.tabs('option', 'selected');
			$tabs.tabs( "enable" , 1);
			$tabs.tabs('select', selected + 1);
		}
	}else{
		
		if(category != '-1' && name != ''){
			document.getElementById('add-more-link').style.display = "none";
			var $tabs = $('#tabs').tabs();
			var selected = $tabs.tabs('option', 'selected');
			$tabs.tabs( "enable" , 1);
			$tabs.tabs('select', selected + 1);
		}
	}

	return false;
}

function checkFirstEditProductTab(){
	var category = getSelectedValue('parent_category');
	var subcategory = '';
	var subcategoryVisible = false;
	if(document.getElementById('subcategories').style.display == "block"){
		subcategory = getSelectedValue('parent_subcategory_select');
		subcategoryVisible = true;
	}
	
	var name = document.getElementById('name').value;

	if(category == '-1'){
		document.getElementById('category-error').style.display = 'block';
	}else{
		document.getElementById('category-error').style.display = 'none';
	}
	
	if(subcategoryVisible){
		if(subcategory == '-1'){
			document.getElementById('subcategory-error').style.display = 'block';
		}else{
			document.getElementById('subcategory-error').style.display = 'none';
		}
	}
	
	if(name == ''){
		document.getElementById('name-error').style.display = 'block';
	}else{
		document.getElementById('name-error').style.display = 'none';
	}
	
	if(subcategoryVisible){
		if(category != '-1' && subcategory != '-1' && name != ''){
			document.getElementById('add-more-link').style.display = "block";
			return true;
		}
	}else{
		
		if(category != '-1' && name != ''){
			return true;
		}
	}

	return false;
}

function goNextTab(){
	
	var $tabs = $('#tabs').tabs();
	var selected = $tabs.tabs('option', 'selected');
	
	$tabs.tabs("enable" , selected + 1);
	$tabs.tabs('select', selected + 1);
	return false; 
}

function goPreviousTab(){
	var $tabs = $('#tabs').tabs();
	var selected = $tabs.tabs('option', 'selected');
	$tabs.tabs('select', selected - 1);
	return false;
}

function clearError(id, error){
	var value = getSelectedValue(id);
	if(value != '-1'){
		document.getElementById(error).style.display = 'none';
	}else{
		document.getElementById(error).style.display = 'block';
	}
}

function clearHtml(id){
	document.getElementById(id).innerHTML = '';
}

function turnOnOffAttributes(id, div){
	var value = getSelectedValue(id);
	
	if(value == -1 || value == 0){
		document.getElementById(div).style.display = "none";
	}else{
		document.getElementById(div).style.display = "block";
	}
}


function generateAttributeFields(id, fieldsDiv, headerDiv, firstTime, num){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}

	var numValue = currentNum + num;
	var value = getSelectedValue(id);
	var url = baseURL + "admin/categories/attributes_ajax_form_fields/" + value + "/" + numValue;
		
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			generateAttributeFieldsResponse(fieldsDiv, headerDiv, firstTime);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function generateAttributeFieldsResponse(fieldsDiv, headerDiv, firstTime){
	var response = xmlhttp.responseText;
	var array = response.split("DELIMITER");
	oneProductPriceFormHeader = array[0];
	oneProductPriceForm = array[1];
	addNewProductPriceFields(fieldsDiv, headerDiv, firstTime);
}
function addNewProductPriceFields(fieldsDiv, headerDiv, firstTime){
	if(firstTime == 'true'){
		$('#' + headerDiv).append(oneProductPriceFormHeader);
	}
	
	$('#' + fieldsDiv).append(oneProductPriceForm);
	currentNum++;

}

function removeProductPriceForm(num){
	$('#product-price-form-' + num).remove();
}

function goNextProductTabWithCheck2(){
	$inputs = $('.attribute-input');
	
	var $tabs = $('#tabs').tabs();
	var selected = $tabs.tabs('option', 'selected');
	$tabs.tabs( "enable" , 2);
	$tabs.tabs('select', selected + 1);
	
}

function addNewColorForm(){
	var oneProductColorForm = '';
	oneProductColorForm += '<div class="color-form">';
	oneProductColorForm += '<div class="label-tiny">Color:</div>';
	oneProductColorForm += '<div class="input"><input type="text" name="color_'+currentColorNum+'" id="color_'+currentColorNum+'" value=""/></div>';
	oneProductColorForm += '<div class="label-tiny">Image:</div>';
	oneProductColorForm += '<div class="input"><input type="file" name="image_'+currentColorNum+'" id="image_'+currentColorNum+'" size="32"/></div>';
	oneProductColorForm += '<div class="clear"></div>';
	
	$('#color-forms').append(oneProductColorForm);

	currentColorNum++;
}


function changeColor(id, productId){
	var color = getSelectedValue(id);

	var temp = '.iimage_' + productId;
	
	$(temp).removeClass('visible').addClass('hidden');
	
	if(color == 0){
		var temp2 = '#gallery-main-image-' + productId;
		$(temp2).removeClass('hidden').addClass('visible');
	}else{
		var temp3 = '#gallery-color-image-' + color;
		$(temp3).removeClass('hidden').addClass('visible');
		
	}
}


function getGalleries(id, div){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "admin/gallery/get_gallery_users_and_images/" + value;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			getGalleriesResponse(id, div);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function getGalleriesResponse(id, div){
	document.getElementById(div).innerHTML = '';
	document.getElementById("select-message").innerHTML = '';
	
	if(xmlhttp.responseText != '-1'){
		if(xmlhttp.responseText != ""){
			document.getElementById(div).innerHTML = xmlhttp.responseText;	
		}else{
			document.getElementById("select-message").innerHTML = "There are no users in selected gallery";
		}
	}else{
		document.getElementById("select-message").innerHTML = "Please select approved or declined gallery.";
	}
	
}

function editGalleryUser(id, status){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	if(id != ''){
		var url= baseURL + "admin/gallery/edit_gallery_user/" + id + "/" + status;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			window.location.href = baseURL + "admin/gallery";
		}
	};

	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function checkSecondEditProductTab(){
	$inputs = $('.attribute-input');
	var error = true;
	$inputs.each(function() {
	
		if($(this).val() == ''){
			error = error && false;
		}else{
			error = error && true;
		}
	});
	
	if(error == false){
		$('#price-error').css("display", "block").delay(3000).slideUp(500);
		return false;
	}else{
		return true;
	}
}

function updateColor(num, id){
	var color = encodeURIComponent(document.getElementById("color-" + num).value);
	var color_id = num;
	var product_id = id;
	
	var parameters="color="+color+"&color_id="+color_id+"&product_id="+product_id;
	
	
	var doURL= baseURL + "admin/products/update_product_color/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			updateColorResponse(data);					
		}
	});	
	
	return false;
}

function updateColorResponse(data){
	$('#info-message').html('').slideDown(500).html(data).delay(3000).slideUp(500);
}

function deleteColor(num, id){
	var color_id = num;
	var product_id = id;
	
	var parameters="color_id="+color_id+"&product_id="+product_id;
	
	var doURL= baseURL + "admin/products/delete_product_color/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			deleteColorResponse(data, num, id);					
		}
	});	
	
	return false;	
}

function deleteColorResponse(data, num, id){
	if(data == "Product color is successfully deleted."){
		$('#one-color-image-' + num).remove();
	}
	
	window.location.href = baseURL + "admin/products/product_edit/" + id + "/#tabs-4";
	
	$('#info-message').html('').slideDown(500).html(data).delay(3000).slideUp(500);
}

function checkboxlimit(checkgroup, limit){
	var checkgroup=checkgroup
	var limit=limit
	for (var i=0; i<checkgroup.length; i++){
		checkgroup[i].onclick=function(){
		var checkedcount=0
		for (var i=0; i<checkgroup.length; i++)
			checkedcount+=(checkgroup[i].checked)? 1 : 0
		if (checkedcount>limit){
			$("#dialog").dialog({
				show: 'slide',
				hide: 'slide'
			});
	
			this.checked=false
			}
		}
	}
}


function deleteFeaturedProduct(div, id){
	var parameters="product_id="+id;
	
	var doURL= baseURL + "admin/featured/delete_monthly_product/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			deleteFeaturedProductResponse(div, id, data);					
		}
	});	
	
	return false;	
}

function deleteFeaturedProductResponse(div, id, data){
	if(data == 1){
		$('#' + div).remove();
	}
}

function deleteFeaturedBook(div, id){
	var parameters="product_id="+id;
	
	var doURL= baseURL + "admin/featured/delete_featured_book/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			deleteFeaturedBookResponse(div, id, data);					
		}
	});	
	
	return false;	
}

function deleteFeaturedBookResponse(div, id, data){
	if(data == 1){
		$('#' + div).remove();
	}
}

function block(){
	$.ajaxSetup({
   		cache: false
	});
	
	$.blockUI({ 
		message: $('#block-container'), 
		css: { 
			padding:0, 
			margin:0, 
			border:'none', 
			top:  ($(window).height() - 32) /2 + 'px', 
			left: ($(window).width() - 32) /2 + 'px',
			width: 0
		} ,
		fadeIn: 400, 
		fadeOut: 400, 
		overlayCSS:  { 
			backgroundColor:'#000', 
			opacity:0.7
		}
	});
}
function block_in_box(){
	$.ajaxSetup({
   		cache: false
	});
	
	$.blockUI({ 
		message: $('#block-container_in_box'), 
		baseZ: 100000,
		css: { 
			padding:0, 
			margin:0, 
			border:'none', 
			top:  ($(window).height() - 32) /2 + 'px', 
			left: ($(window).width() - 32) /2 + 'px',
			width: 0
		} ,
		fadeIn: 400, 
		
		fadeOut: 400, 
		overlayCSS:  { 
			backgroundColor:'#000', 
			opacity:0.7
		}
	});
}
function changePrice(id, attr1, attr2){
	var val1 = "";
	var val2 = "";
	if(attr1 != "null"){
		val1 = getSelectedValue(attr1+'_'+id);
	}
	if(attr2 != "null"){
		val2 = getSelectedValue(attr2+'_'+id);
	}
	
	var qty = getSelectedValue('qty_'+id);
	
		
	
	if(val1 != "" && val2 != ""){
		if(val1 != -1 && val2 != -1){
			var parameters1 = "product_id="+id+"&"+attr1+"="+val1+"&"+attr2+"="+val2;
	
			var doURL= baseURL + "products/get_price/";
			
			block();
		
			$.ajax({
				url: doURL,
				type: "POST",
				data: parameters1,
				success: function(data){
					changePriceResponse(id, data, qty);					
				}
			});	
		}
		
		return false;	
	
	}else{
		if(val1 != "" && val2 == ""){
			var parameters2 = "product_id="+id+"&"+attr1+"="+val1;
			
			var doURL= baseURL + "products/get_price/";
			
			block();
		
			$.ajax({
				url: doURL,
				type: "POST",
				data: parameters2,
				success: function(data){
					changePriceResponse(id, data, qty);					
				}
			});
			
			return false;	
		}
		
		if(val1 == "" && val2 == ""){
			var parameters3 = "product_id="+id;
			
			var doURL= baseURL + "products/get_only_price/";
			
			block();
		
			$.ajax({
				url: doURL,
				type: "POST",
				data: parameters3,
				success: function(data){
					changePriceResponse(id, data, qty);					
				}
			});
			
			return false;	
		}
	}
}

function changePriceResponse(id, data, qty){
	var price = data * qty;
	var final_price = price.toFixed(2);
	document.getElementById("price_"+id).innerHTML = "$"+ final_price;
	$.unblockUI();
}

function changeBookPrice(id, price){
	block();
	var qty = getSelectedValue('quantity_'+id);
	var final_price = (qty * price).toFixed(2);
	document.getElementById("book_price_"+id).innerHTML = "$"+ final_price;
	setTimeout($.unblockUI, 1000); 
}

function setShippingAddress(id){
	var checked = document.getElementById('different_shipping').checked;
	if(checked == true){
		document.getElementById(id).style.display = 'block';
	}else{
		document.getElementById(id).style.display = 'none';
	}
}

function setState(which){
	var country;
	
	if(which == "billing"){
		
		country = getSelectedValue('billing_country');
		
		if(country == 9){
			document.getElementById('billing-state-input').style.display = 'none';
			document.getElementById('billing-american-select').style.display = 'none';
			document.getElementById('billing-australian-select').style.display = 'block';
			document.getElementById('billing-state-star').style.display = 'inline';
			document.getElementById('error-billing-state-input').style.display = 'none';
			document.getElementById('error-billing-state-american').style.display = 'none';
			document.getElementById('error-billing-state-australian').style.display = 'block';
			
		}else if(country == 186){
			document.getElementById('billing-state-input').style.display = 'none';
			document.getElementById('billing-american-select').style.display = 'block';
			document.getElementById('billing-australian-select').style.display = 'none';
			document.getElementById('billing-state-star').style.display = 'inline';
			document.getElementById('error-billing-state-input').style.display = 'none';
			document.getElementById('error-billing-state-american').style.display = 'block';
			document.getElementById('error-billing-state-australian').style.display = 'none';
		}else{
			document.getElementById('billing-state-input').style.display = 'block';
			document.getElementById('billing-american-select').style.display = 'none';
			document.getElementById('billing-australian-select').style.display = 'none';
			document.getElementById('billing-state-star').style.display = 'none';
			document.getElementById('error-billing-state-input').style.display = 'block';
			document.getElementById('error-billing-state-american').style.display = 'none';
			document.getElementById('error-billing-state-australian').style.display = 'none';
		}
	}else if(which == "shipping"){
		country = getSelectedValue('shipping_country');
		
		if(country == 9){
			document.getElementById('shipping-state-input').style.display = 'none';
			document.getElementById('shipping-american-select').style.display = 'none';
			document.getElementById('shipping-australian-select').style.display = 'block';
			document.getElementById('shipping-state-star').style.display = 'inline';
			document.getElementById('error-shipping-state-input').style.display = 'block';
			document.getElementById('error-shipping-state-american').style.display = 'none';
			document.getElementById('error-shipping-state-australian').style.display = 'none';
			
		}else if(country == 186){
			document.getElementById('shipping-state-input').style.display = 'none';
			document.getElementById('shipping-american-select').style.display = 'block';
			document.getElementById('shipping-australian-select').style.display = 'none';
			document.getElementById('shipping-state-star').style.display = 'inline';
			document.getElementById('error-shipping-state-input').style.display = 'block';
			document.getElementById('error-shipping-state-american').style.display = 'none';
			document.getElementById('error-shipping-state-australian').style.display = 'none';
		}else{
			document.getElementById('shipping-state-input').style.display = 'block';
			document.getElementById('shipping-american-select').style.display = 'none';
			document.getElementById('shipping-australian-select').style.display = 'none';
			document.getElementById('shipping-state-star').style.display = 'none';
			document.getElementById('error-shipping-state-input').style.display = 'block';
			document.getElementById('error-shipping-state-american').style.display = 'none';
			document.getElementById('error-shipping-state-australian').style.display = 'none';
		}
	}
}


function updateProduct(rowid, quantity, id, type, product_shipping,product_address){
		
	block();
	if(product_shipping != ''){
	product_shipping2 = getSelectedValue(product_shipping);
	}else{
		product_shipping2 = '';
	}
	if(product_address != ''){
	product_address2 = getSelectedValue(product_address);
	}else{
		product_address2 = '';
	}
	if(quantity != 0){
		
		$.get(baseURL + "cart/update_cart/" + rowid + "/" + quantity + "/" + product_shipping2 + "/" + product_address2, function(){
			$('#' + type + '_subtotal_' + id).load(baseURL + "cart/subtotal/" + rowid, function(){
				$('#total-price').load(baseURL + "cart/total", function(){		
					$('#shipping').load(baseURL + "cart/transport", function(){
						$('#gst').load(baseURL + "cart/gst", function(){
							$('#full_total').load(baseURL + "cart/full_total", function(){
								$.unblockUI();
							})
						})
					})
				})
			})
		})
	}else{
		$.get(baseURL + "cart/update_cart/" + rowid + "/" + quantity, function(){
			$('#total-price').load(baseURL + "cart/total", function(){
				
					$('#shipping').load(baseURL + "cart/transport", function(){
						$('#gst').load(baseURL + "cart/gst", function(){
							$('#full_total').load(baseURL + "cart/full_total", function(){
								$('#' + type + "_" + id).remove();
								$('#border_' + id).remove();
								$.unblockUI();
							})
						})
					})
					
			
			})
		})
	}
}

function updateProductAll(rowid, quantity, id, type, product_shipping,product_address){
		
	block();
	if(product_shipping != ''){
	product_shipping2 = getSelectedValue(product_shipping);
	}else{
		product_shipping2 = '';
	}
	if(product_address != ''){
	product_address2 = getSelectedValue(product_address);
	}else{
		product_address2 = '';
	}
	if(quantity != 0){
		
		$.get(baseURL + "cart/update_cart_all/" + rowid + "/" + quantity + "/" + product_shipping2 + "/" + product_address2, function(){
			$('#' + type + '_subtotal_' + id).load(baseURL + "cart/subtotal/" + rowid, function(){
				$('#total-price').load(baseURL + "cart/total", function(){		
					$('#shipping').load(baseURL + "cart/transport", function(){
						$('#gst').load(baseURL + "cart/gst", function(){
							$('#full_total').load(baseURL + "cart/full_total", function(){
								$.unblockUI();
							})
						})
					})
				})
			})
		})
	}else{
		$.get(baseURL + "cart/update_cart_all/" + rowid + "/" + quantity, function(){
			$('#total-price').load(baseURL + "cart/total", function(){
					$('#shipping').load(baseURL + "cart/transport", function(){
						$('#gst').load(baseURL + "cart/gst", function(){
							$('#full_total').load(baseURL + "cart/full_total", function(){
								$('#' + type + "_" + id).remove();
								$('#border_' + id).remove();
								$.unblockUI();
							})
						})
					})
					
			
			})
		})
	}
}
function updateProductAllMulti(rowid, quantity, id, type, product_shipping,product_address){
		
	block();
	
	if(document.getElementById(product_shipping) != null){
		product_shipping2 = getSelectedValue(product_shipping);
	}else{
		product_shipping2 = '0';
	}
	
	if(document.getElementById(product_address) != null){
		product_address2 = getSelectedValue(product_address);
	}else{
		product_address2 = '0';
	}
	if(quantity != 0){
		
		$.get(baseURL + "cart/update_cart/" + rowid + "/" + quantity + "/" + product_shipping2 + "/" + product_address2, function(){
			$('#' + type + '_subtotal_' + id).load(baseURL + "cart/subtotal/" + rowid, function(){
				$('#total-price').load(baseURL + "cart/total", function(){		
					$('#shipping').load(baseURL + "cart/transport", function(){
						$('#gst').load(baseURL + "cart/gst", function(){
							$('#full_total').load(baseURL + "cart/full_total", function(){
								$.unblockUI();
							})
						})
					})
				})
			})
		})
	}else{
		$.get(baseURL + "cart/update_cart/" + rowid + "/" + quantity, function(){
			$('#total-price').load(baseURL + "cart/total", function(){
					$('#shipping').load(baseURL + "cart/transport", function(){
						$('#gst').load(baseURL + "cart/gst", function(){
							$('#full_total').load(baseURL + "cart/full_total", function(){
								$('#' + type + "_" + id).remove();
								$('#border_' + id).remove();
								$.unblockUI();
							})
						})
					})
					
			
			})
		})
	}
}
function updateProductInCart(rowid, quantity, id, type, product_shipping,product_address,attribute){
		
	block();
	alert(product_shipping);
	if(document.getElementById(product_shipping) != null){
		product_shipping2 = getSelectedValue(product_shipping);
	}else{
		product_shipping2 = '0';
	}
	
	if(document.getElementById(product_address) != null){
		product_address2 = getSelectedValue(product_address);
	}else{
		product_address2 = '0';
	}
	if (document.getElementById(attribute) != null) {
		var value_attribute = getSelectedValue(attribute);
	}
	if(quantity != 0){
		
		$.get(baseURL + "cart/update_cart/" + rowid + "/" + quantity + "/" + product_shipping2 + "/" + product_address2 + "/" + value_attribute, function(){
			$('#' + type + '_price_' + id).load(baseURL + "cart/price/" + rowid, function(){
				$('#' + type + '_subtotal_' + id).load(baseURL + "cart/subtotal/" + rowid, function(){
					$('#total-price').load(baseURL + "cart/total", function(){		
						$.unblockUI();	
					})
				})
			})
		})
	}else{
		$.get(baseURL + "cart/update_cart/" + rowid + "/" + quantity, function(){
			$('#total-price').load(baseURL + "cart/total", function(){
				
				$('#' + type + "_" + id).remove();
				$('#border_' + id).remove();
				$.unblockUI();
			})
		})
	}
}

function updateProductInCart(rowid, quantity, id, type, product_shipping,product_address,attribute){
		
	block();
	if(product_shipping != ''){
	product_shipping2 = getSelectedValue(product_shipping);
	}else{
		product_shipping2 = '0';
	}
	if(product_address != ''){
	product_address2 = getSelectedValue(product_address);
	}else{
		product_address2 = '0';
	}
	if (attribute != '') {
		var value_attribute = getSelectedValue(attribute);
	}
	if(quantity != 0){
		
		$.get(baseURL + "cart/update_cart/" + rowid + "/" + quantity + "/" + product_shipping2 + "/" + product_address2 + "/" + value_attribute, function(){
			$('#' + type + '_price_' + id).load(baseURL + "cart/price/" + rowid, function(){
				$('#' + type + '_subtotal_' + id).load(baseURL + "cart/subtotal/" + rowid, function(){
					$('#total-price').load(baseURL + "cart/total", function(){		
						$.unblockUI();	
					})
				})
			})
		})
	}else{
		$.get(baseURL + "cart/update_cart/" + rowid + "/" + quantity, function(){
			$('#total-price').load(baseURL + "cart/total", function(){
				
				$('#' + type + "_" + id).remove();
				$('#border_' + id).remove();
				$.unblockUI();
			})
		})
	}
}
function updateProductInCartMulti(rowid, quantity, id, type){
		
	block();
	
	if(quantity != 0){
		
		$.get(baseURL + "cart/update_cart/" + rowid + "/" + quantity, function(){
			$.unblockUI();		
		})
	}else{
		$.get(baseURL + "cart/update_cart/" + rowid + "/" + quantity, function(){
				$('#' + type + "_" + id).remove();
				$('#border_' + id).remove();
				$.unblockUI();
		})
	}
}

function setActiveAttribute(id){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}

	
	var value = getSelectedValue(id);
	var url = baseURL + "admin/categories/set_active_attribute/" + value;
		
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}


function updatePrice(product_id, attribute, qty){
	block();
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	if (document.getElementById(attribute)) {
		var value_attribute = getSelectedValue(attribute);
	}
	if (document.getElementById(qty)) {
		var value_qty = getSelectedValue(qty);
	}
	if(value_attribute != ''){
		var url= baseURL + "product/get_price/" + product_id + "/" + value_attribute + "/" + value_qty;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			updatePriceResponse();
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function updatePriceResponse(){
	
	
	if(xmlhttp.responseText != "0"){
		document.getElementById("product_price").innerHTML = "$"+ xmlhttp.responseText;
	}else{
		document.getElementById("product_price").innerHTML = "N/A";
	}
	
	setTimeout($.unblockUI, 1000); 
}
/*
function subscribeUser(email){
	block();
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	
	var value_email = document.getElementById(email).value;
	alert(value_email);
	if(value_email != '' && value_email != 'Enter your email address'){
		var url= baseURL + "subscribers/add/" + value_email;
	}else{
		document.getElementById("subscribe_message").innerHTML = 'You must enter an email.';
		setTimeout($.unblockUI, 1000); 
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			subscribeUserResponse();
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
*/
function subscribeUserResponse(data){
	document.getElementById("subscribe_message").innerHTML = data;
	setTimeout($.unblockUI, 1000); 
	if(data == 'You have been successfully subscribed.'){
		$('#subscribe_succ').trigger('click');
	}
}

function subscribeUser(email){
	block();
	var value_email = document.getElementById(email).value;
	
	var parameters="email="+value_email;
	
	var doURL= baseURL + "subscribers/add/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			subscribeUserResponse(data);					
		}
	});	
	
	return false;	
}

function apply_voucherResponse(data){
	document.getElementById("voucher_message").innerHTML = '<span style="color:#852419;font-weight:bold;">'+data+'</span>';
	setTimeout($.unblockUI, 1000); 
	//window.location.href = baseURL + "overview";
	form = document.getElementById('card_details_form');
    var input = document.createElement("input");
    input.setAttribute("type", "hidden");
    input.setAttribute("name", 'apply');
    input.setAttribute("id", 'apply');
    input.setAttribute("value", 'apply');
    form.appendChild(input);
    form.submit();
    return false;
}

function apply_voucher(voucher){
	block();
	var value_voucher = document.getElementById(voucher).value;
	
	var parameters="voucher="+value_voucher;
	
	var doURL= baseURL + "cart/apply_voucher/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			apply_voucherResponse(data);					
		}
	});	
	
	return false;	
}

function apply_codeResponse(data){
	document.getElementById("code_message").innerHTML = '<span style="color:#852419;font-weight:bold;">'+data+'</span>';
	setTimeout($.unblockUI, 1000); 
	//window.location.href = baseURL + "overview";
	form = document.getElementById('card_details_form');
    var input = document.createElement("input");
    input.setAttribute("type", "hidden");
    input.setAttribute("name", 'apply');
    input.setAttribute("id", 'apply');
    input.setAttribute("value", 'apply');
    form.appendChild(input);
    form.submit();
    return false;
}

function apply_code(code){
	block();
	var code_voucher = document.getElementById(code).value;
	
	var parameters="code="+code_voucher;
	
	var doURL= baseURL + "cart/apply_code/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			apply_codeResponse(data);					
		}
	});	
	
	return false;	
}
function apply_voucherResponseMulti(data){
	document.getElementById("voucher_message").innerHTML = '<span style="color:#852419;font-weight:bold;">'+data+'</span>';
	setTimeout($.unblockUI, 1000); 
	//window.location.href = baseURL + "overview_multi";
	form = document.getElementById('card_details_form');
    var input = document.createElement("input");
    input.setAttribute("type", "hidden");
    input.setAttribute("name", 'apply');
    input.setAttribute("id", 'apply');
    input.setAttribute("value", 'apply');
    form.appendChild(input);
    form.submit();
    return false;
}

function apply_voucherMulti(voucher){
	block();
	var value_voucher = document.getElementById(voucher).value;
	
	var parameters="voucher="+value_voucher;
	
	var doURL= baseURL + "cart/apply_voucher/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			apply_voucherResponseMulti(data);					
		}
	});	
	
	return false;	
}
function apply_codeResponseMulti(data){
	document.getElementById("code_message").innerHTML = '<span style="color:#852419;font-weight:bold;">'+data+'</span>';
	setTimeout($.unblockUI, 1000); 
	//window.location.href = baseURL + "overview_multi";
	form = document.getElementById('card_details_form');
    var input = document.createElement("input");
    input.setAttribute("type", "hidden");
    input.setAttribute("name", 'apply');
    input.setAttribute("id", 'apply');
    input.setAttribute("value", 'apply');
    form.appendChild(input);
    form.submit();
    return false;
}

function apply_codeMulti(code){
	block();
	var code_voucher = document.getElementById(code).value;
	
	var parameters="code="+code_voucher;
	
	var doURL= baseURL + "cart/apply_code/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			apply_codeResponseMulti(data);					
		}
	});	
	
	return false;	
}
function getSubcategoriesUpsell(id, div, div2){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "admin/categories/subcategories_ajax_dropdown_simple_upsell/" + value + "/" + div2;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			getSubcategoriesUpsellResponse(id, div);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function getSubcategoriesUpsellResponse(id, div){
	if(xmlhttp.responseText != -1 && xmlhttp.responseText != 'no_subcategories'){
		document.getElementById(div).innerHTML = xmlhttp.responseText;
		document.getElementById('subcategories_upsell').style.display = 'block';
		document.getElementById('category-error').style.display = 'none';
	}else{
		document.getElementById('subcategories_upsell').style.display = 'none';
	}
}

function getProductsDropdown(id, div){
	$('#' + div).empty();
	
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url = '';
		
		url = baseURL + "admin/products/products_dropdown/" + value;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			getProductsDropdownResponse(div);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function getProductsDropdownResponse(div){
	if(xmlhttp.responseText != -1){
		$('#' + div).append(xmlhttp.responseText);
		document.getElementById('products_upsell').style.display = 'block';
	}
}

function updatePriceBox(product_id, attribute, qty, upsell_id){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	
	if (document.getElementById(attribute)) {
		var value_attribute = getSelectedValue(attribute);
	}
	if (document.getElementById(qty)) {
		var value_qty = getSelectedValue(qty);
	}
	if(value_attribute != ''){
		var url= baseURL + "product/get_price_upsell/" + product_id + "/" + value_attribute + "/" + value_qty + "/" + upsell_id;
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			updatePriceBoxResponse(upsell_id);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function updatePriceBoxResponse(upsell_id){
	if(xmlhttp.responseText != "0"){
		document.getElementById("product_price_box_"+upsell_id).innerHTML = "$"+ xmlhttp.responseText;
	}else{
		document.getElementById("product_price_box_"+upsell_id).innerHTML = "N/A";
	}
	
}

function add_to_cart_upsell(product_id, upsell_id, attribute_key, amount){
	block_in_box();
	if (document.getElementById(attribute_key)) {
		var attribute_key_value = getSelectedValue(attribute);
	}
	if (document.getElementById(amount)) {
		var amount_value = getSelectedValue(amount);
	}
	
	
	var parameters="product_id="+product_id+"&upsell_id="+upsell_id+"&amount_upsell="+amount_value+"&product_attribute_upsell="+attribute_key_value;
	
	var doURL= baseURL + "cart/add_to_cart_upsell/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			add_to_cart_upsellResponse(upsell_id, data);					
		}
	});	
	
	return false;	
}
function add_to_cart_upsellResponse(upsell_id, data){
	
	if(data = '1'){
		data = 'Product Successfully Added To Cart';
	}else{
		data = 'Product Not Added To Cart';
	}
	
	$('#info-message_upsell_'+upsell_id).html(data);
	
	document.getElementById('upsell_link_'+upsell_id).src = baseURL + 'assets/images/add_again.png';
	
	document.getElementById('no_link').src = baseURL + 'assets/images/view_my_cart.png';
	
	setTimeout($.unblockUI, 1000); 
}

function fillUpOccasion(fillUpOccasion){
	var occasion_value = getSelectedValue(fillUpOccasion);
	document.getElementById('occasion_text').value = occasion_value;
}

function updatePriceVoucher(product_id, qty){
	block();
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
	
	
	var value_qty = getSelectedValue(qty);
	if(value_qty != ''){
		var url= baseURL + "voucher/get_price/" + product_id + "/" + value_qty;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			updatePriceVoucherResponse();
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function updatePriceVoucherResponse(){
	
	
	if(xmlhttp.responseText != "0"){
		document.getElementById("product_price").innerHTML = "$"+ xmlhttp.responseText;
	}else{
		document.getElementById("product_price").innerHTML = "N/A";
	}
	
	setTimeout($.unblockUI, 1000); 
}

function set_upgraded_session(id){
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}

	if(document.getElementById(id).checked=true){
		var value = '1';
	}else{
		var value = '0';
	}
	
	var url = baseURL + "product/set_upgraded_session/" + value;
		
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function setSessionAddress(id){
	
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null){
	  alert ("Browser does not support HTTP Request");
	  return;
	}
		
	var value = getSelectedValue(id);
	if(value != ''){
		var url= baseURL + "details/get_address_details/" + value;
		
	}
	
	xmlhttp.onreadystatechange=function () {
		if (xmlhttp.readyState == 4) {
			setSessionAddressResponse(value);
		}
	};
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function setSessionAddressResponse(value){
	var longstring=xmlhttp.responseText;
	var brokenstring=longstring.split(";");
	if(value != -1){
		document.getElementById('billing_c_name').value = brokenstring[0];
		document.getElementById('billing_first_name').value = brokenstring[1];
		document.getElementById('billing_last_name').value = brokenstring[2];
		document.getElementById('billing_address').value = brokenstring[3];
		document.getElementById('billing_suburb').value = brokenstring[4];
		document.getElementById('billing_postal_code').value = brokenstring[5];
		document.getElementById('billing_state').value = brokenstring[6];
		document.getElementById('billing_phone').value = brokenstring[7];
		document.getElementById('billing_email').value = brokenstring[8];
		document.getElementById('billing_title').value = brokenstring[9];
		
	}
	
}

function updateShipping(type){
		
	block();

	$.get(baseURL + "overview/update_shipping/" + type, function(){
		$('#total-price').load(baseURL + "cart/total", function(){		
			$('#shipping').load(baseURL + "cart/transport", function(){
				$('#gst').load(baseURL + "cart/gst", function(){
					$('#full_total').load(baseURL + "cart/full_total", function(){
						$.unblockUI();
					})
				})
			})
		})
	})
		
}


function updateProductShippingMultiResponse(data){
	
	$('#total-price').load(baseURL + "cart/total", function(){		
		$('#shipping').load(baseURL + "cart/transport", function(){
			$('#gst').load(baseURL + "cart/gst", function(){
				$('#full_total').load(baseURL + "cart/full_total", function(){
					$.unblockUI();
				})
			})
		})
	})
		
	//window.location.href = baseURL + "overview_multi";
}

function updateProductShippingMulti(shipping_type,shipping_value, delivery_address_key){
	block();

	var parameters="shipping_type="+shipping_type+"&shipping_value="+shipping_value+"&delivery_address_key="+delivery_address_key;
	
	var doURL= baseURL + "cart/shipping_multi/";
	
	$.ajax({
		url: doURL,
		type: "POST",
		data: parameters,
		success: function(data){
			updateProductShippingMultiResponse(data);					
		}
	});	
	
	return false;	
}
