$(document).ready(function()
{

// hide boxes with no content - user populated
	$('.box').each(function(i){
		var inner_html = $(this).html();
		var inner_html_trimmed = inner_html.replace(/^\s+|\s+$/g, '');
			if (inner_html_trimmed == ''){
				$(this).hide();
			}				
	});	

});

function clearValue(clearInput, defaultValue)
{
    if (clearInput.value == defaultValue) clearInput.value = '';
}
function showHide (showOrHide, elementToChange) {
    if (showOrHide == 'show')
    {
        $('#'+elementToChange).show();
    }
    else
    {
        $('#'+elementToChange).hide();
    }
}

function openUrl(url)
{
	window.open(url, '_self');
}
function openUrlFromSelect(select)
{
	var url = select.options[select.options.selectedIndex].value;
	openUrl(url);
}
function submitOnChange(idForm)
{
    $('#' + idForm).submit();
}


function ccTypeSelectShowHide(selectOrValue)
{
    if (typeof(selectOrValue) == 'string') {
        var val = selectOrValue;
    } else if (selectOrValue != undefined) {
        var val = selectOrValue.options[selectOrValue.options.selectedIndex].value;
    } else {
        var val = 'rubbish';
    }

    if (
        val == 'Solo'
        || val == 'Switch'
        || val == 'American Express'
    ) {
        $('#ecom_cc_extra').show();
        if (val != 'American Express') {
            $('#ecom_cc_extra_issue').show();
        } else {
            $('#ecom_cc_extra_issue').hide();
        }
    } else {
        $('#ecom_cc_extra_issue').hide();
        $('#ecom_cc_extra').hide();
    }
}
