function openPopup(URL, width, height) {
    if (height == undefined) {
        height = 600
    };
    if (width == undefined) {
        width = 600
    };
    popupwin = window.open(URL, '', 'width=' + width + ',height=' + height + ',toolbar=0,directories=0,menubar=0,scrollbars=1,location=0,copyhistory=0')
}

function expandDescription() {
    if (document.getElementById("divDescription").style.height != "auto") {
        document.getElementById("divDescription").style.height = "auto"
    };
}

var addthis_config = {
     ui_delay: 500
}

if (document.getElementById) {
    var obj = document.getElementById('txtSearch');
    if (obj.setAttribute) obj.setAttribute('autocomplete', 'off');
}

function EmptyBasket(f) {
	ClearCart();
	UpdateCartQuantity(f);
	ReloadCurrentPage();
}
	
function checkCountryState(f){
	var country, state;
	
    country = f.elements[ew_fldCountry];
    state = f.elements[ew_fldState];	
	
	if ((country.type == "select-one" && country.selectedIndex <= 0) || (country.type != "select-one" && country.value == "")) {
            alert(ew_RequiredMessage + ' ' + ew_country);
            FocusOption(country);
            return false
        }
	
	if (state && !state.disabled) {
        if (ew_fldStateCheck) {
            if ((state.type == "select-one" && state.selectedIndex <= 0) || (state.type != "select-one" && state.value == "")) {
                alert(ew_RequiredMessage + ' ' + ew_fldState);
                FocusOption(state);
                return false
            }
        }
    }	
	
	return true;
}

function checkForm(){	
	var f;
	f = document.forms["shipping"];

	if (checkCountryState(f)){
		SubmitShipping(f)
		submitForm();
	}
}

function submitForm(){
		document.checkout.submit();
}
