$(document).ready(function()
{
	/* cv2 tooltip help */
	$('#cv2help').tooltip();

    /* Only showing those sidebar block elements that contain content */
    $('.hide_empty').each(function(i){
        var inner_html = $(this).html();
        var inner_html_trimmed = inner_html.replace(/^\s+|\s+$/g, '');
        if (inner_html_trimmed == '')
        {
        	$(this).hide();
        }
    });
    /* curvy corners */
    $('.curvy_all').corner({
        tl: { radius: 10 },
        tr: { radius: 10 },
        bl: { radius: 10 },
        br: { radius: 10 },
        antiAlias: true,
        autoPad: false,
        validTags: ["div"]
    });
    /* curvy corners */
    $('.curvy_links li').corner({
        tl: { radius: 5 },
        tr: { radius: 5 },
        bl: { radius: 5 },
        br: { radius: 5 },
        antiAlias: true,
        autoPad: false,
        validTags: ["div"]
    });
    //if (($.browser.msie == false)) {
        $('.box').corner({
            tl: { radius: 5 },
            tr: { radius: 5 },
            bl: false,
            br: false,
            antiAlias: true,
            autoPad: false,
            validTags: ["div"]
        });
    //}

    /* removing click function from box heading links */
    $('.box h3 a').click(function(){
    	return false;
    });

    /* protx cc type check */
    var cc_select = $('#cc_type');
    if (cc_select) {
        ccTypeSelectShowHide(cc_select.val());
    }

});
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 == 'AMEX'
    ) {
        $('#cc_extra').show();
        if (val != 'AMEX') {
            $('#cc_extra_issue').show();
        } else {
            $('#cc_extra_issue').hide();
        }
    } else {
        $('#cc_extra_issue').hide();
        $('#cc_extra').hide();
        $('#cc_start_month').val("");
        $('#cc_start_year').val("");
    }
}