
function setSeason(season) {

	var one, two, three;
	if(season == 'winter') {
		one = 'December';
		two = 'January';
		three = 'February';
	} else if(season == 'spring') {
		one = 'March';
		two = 'April';
		three = 'May';
	} else if(season == 'summer') {
		one = 'June';
		two = 'July';
		three = 'August';
	} else if(season == 'autumn') {
		one = 'September';
		two = 'October';
		three = 'November';
	}

	$('#month_one').html(one);
	$('#month_two').html(two);
	$('#month_three').html(three);

	$('#step2').fadeIn('slow');
}

function checkChars(field, counter, limit) {

	var counter = dynamItElem(counter);

	if(field.value.length > limit) {
		field.value = field.value.substring(0, limit);
		$(counter).html('0');
	} else {
		$(counter).html('' + (limit - field.value.length));
	}
}

var savedDates = [];
//datepicker_activeDayDT
function unmarkSquare(m, d, y) {
	d--;
	var id = "div#datepicker_div_" + m + " td.datepicker_daysCell:not('.datepicker_otherMonth'):eq('" + d  + "')";
	savedDates.removeItem(id);
	$(id).removeClass('datepicker_activeDayDT');
}

function markSquare(m, d, y) {
	d--;
	var id = "div#datepicker_div_" + m + " td.datepicker_daysCell:not('.datepicker_otherMonth'):eq('" + d  + "')";
	savedDates.push(id);
	$(id).addClass('datepicker_activeDayDT');
}

function setSavedDates() {
	for(var j = 0; j < savedDates.length; j++) {
		$(savedDates[j]).addClass('datepicker_activeDayDT');
	}
}

Array.prototype.removeItem = function(item) {

	var index = -1;
	for(var j = 0; j < this.length; j++) {
		if(this[j] == item) {
			index = j;
			break;
		}
	}

	this.splice(index, 1);
}

/*** ADMIN ***/
function addCategory(p, c) {
	dynamItSend('/category/addproduct.dT?category=' + c + '&product=' + p);
}

function remCategory(p, c) {
	dynamItSend('/category/remproduct.dT?category=' + c + '&product=' + p);
}

function deleteX(url, id, lbl) {
	dynamItLinkOnConfirm(url + '?id=' + id, 'Rellay delete this ' + lbl + '?');
}



function sameAsShipping(f, on) {

//	alert(on);
	f.ship_name.value = (on) ? f.name.value + ' ' + f.lastname.value : '';
	f.ship_address.value = (on) ? f.address.value : '';
	f.ship_address2.value = (on) ? f.address2.value : '';
	f.ship_city.value = (on) ? f.city.value : '';
	f.ship_state.value = (on) ? f.state.value : '';
	f.ship_zip.value = (on) ? f.zip.value : '';
}
