//round corners in ie
DD_roundies.addRule('.rounded_outer', '10px');
DD_roundies.addRule('#navigation ul li', '10px 10px 0 0');
//DD_roundies.addRule('#contact_form input, #contact_form textarea', '4px');
//turns out dd roundies puts z-index on elements and therefor obscures the input field

var $j = jQuery.noConflict();
 $j(document).ready(function() {
    //equal height columns
    var left_col = $j('#height_left');
    var right_col = $j('#height_right');
    var lc_height = parseInt(left_col.height());
    var rc_height = parseInt(right_col.height());

    //console.log(lc_height);
    //console.log(rc_height);

    if(lc_height < rc_height) {
        left_col.css({height: rc_height +'px'});
    }
    else {
        right_col.css({height: lc_height +'px'});
    }


    //validate email form
    $j('input#send').click(
    function() {
        //alert('n');
        $j('#js_msg').hide('normal');

        if(populated($j('#message')) && populated($j('#name'))) {
            if(valid($j('input#email').attr('value'))) {
                return true;
                //$('#js_msg').html(error_msg("Unable to send your email. Try again. Alternatively you can just send an email to <a href='mailto:mariomazzorana@gmail.com'>mariomazzorana@gmail.com</a>"));
                //return false;
            }
            else {
                $j('#js_msg').html(error_msg('Are you sure thats your email address?'));
                $j('#js_msg').show('normal');
                return false;
            }
        }
        else {
            $j('#js_msg').html(error_msg('Please enter all fields.'));
            $j('#js_msg').show('normal');
            return false;
        }
    });
})

function populated(field) {
    if((field.attr('value') !== '') || (field.html() !== '')) {
        return true;
    }
    else {
        return false;
    }
}

function valid(email) {
    var pattern = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(email.match(pattern)) {
        return true;
    }
    else {
        return false;
    }
}

function error_msg(msg) {
    return "<div id='error_msg'><p>"+ msg +"</p></div>";
}
