var dnaMsgs = new Array();
function consoleWrite(msg) {
}
function dnaFormElementError(error, element) {
	var id = jQuery(element).attr('id');
	var type = jQuery(element).attr('type');
	if (type == 'checkbox') {
		id = jQuery(element).attr('alt');
	}
	var wrapper = id + 'wrapper';
	jQuery('#' + wrapper).addClass('dnaElementwrapperError');
	jQuery('#' + id + 'elementerrors').remove();
	var div = '<div class="dnaElementelementerrors" id="' + id
			+ 'elementerrors">' + error.html() + '</div>';
	jQuery('#' + id + 'element').append(div);
}
function dnaFormElementSuccess(label) {
	var id = jQuery(label).attr('id');
	var type = jQuery(label).attr('type');
	if (type == 'checkbox') {
		id = jQuery(label).attr('alt');
	}
	var wrapper = id + 'wrapper';
	jQuery('#' + wrapper).removeClass('dnaElementwrapperError');
}
function dnaFormCancel(page) {
	window.location = page;
}
function dnaResponseAppend(msg, section) {
}
function dnaResponseDisplay(loc) {
}

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g, '');
	if (isNaN(num))
		num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num * 100 + 0.50000000001);
	cents = num % 100;
	num = Math.floor(num / 100).toString();
	if (cents < 10)
		cents = "0" + cents;
	for ( var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
		num = num.substring(0, num.length - (4 * i + 3)) + ','
				+ num.substring(num.length - (4 * i + 3));
	return (((sign) ? '' : '-') + '$' + num + '.' + cents);
}
function slideSwitch() {
    var $active = jQuery('#slideshow DIV.active');
    if ( $active.length == 0 ) $active = jQuery('#slideshow DIV:last');
    var $next =  $active.next().length ? $active.next()
        : jQuery('#slideshow DIV:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

function ssbuttonSwitch() {
    var $active = jQuery('#ssbutton DIV.active');
    if ( $active.length == 0 ) $active = jQuery('#ssbutton DIV:last');
    var $next =  $active.next().length ? $active.next()
        : jQuery('#ssbutton DIV:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

