/*
  Module developed for the Open Source Content Management System AtACimo (http://atacimo.com)
  Copyright (C) 2009, AtACimo
*/



// **********************************************************************************
//   Function to delete an item in the cart
// **********************************************************************************

function mod_cimory_delete_item_f(id) {
	if(id != '') {
		document.getElementById('id_' + id).value=0;
		document.getElementById('update').click();
	}
}



// **********************************************************************************
//   Function to toggle between state text field and drop down menu
// **********************************************************************************

function mod_cimory_toggle_state_f(shopCountry, type, clean) {
	if(shopCountry != '') {
		var country = document.getElementsByName(type + '_country')[0].value;
		if (country == shopCountry) {
			document.getElementById(type + '_state_text').style.display = 'none';
			document.getElementById(type + '_state_select').style.display = 'table-row';
			document.getElementsByName(type + '_state')[1].value = document.getElementsByName(type + '_state')[0].value;
		} else {
			document.getElementById(type + '_state_select').style.display = 'none';
			document.getElementById(type + '_state_text').style.display = 'table-row';
			if(clean == 1) {
				document.getElementsByName(type + '_state')[1].value = '';
				document.getElementsByName(type + '_state')[1].focus();
			}
		}
	}
}



// **********************************************************************************
//   Functions to take over the state select value to the state text field
// **********************************************************************************

function mod_cimory_synchro_cust_state_f() {
	document.getElementsByName('cust_state')[1].value = document.getElementsByName('cust_state')[0].value;
}

function mod_cimory_synchro_ship_state_f() {
	document.getElementsByName('ship_state')[1].value = document.getElementsByName('ship_state')[0].value;
}

