var eval_json = function(data){
    return eval("(" + data + ")");
};
var clear_default_value = function() {
        if (this.value == this.defaultValue) {
            this.value = "";
        }
};
var set_default_value = function(){
    if (this.value == ""){
        this.value = this.defaultValue;
    }
};

var page_effects = function(){
    $("#content_right").show("slow");
}
var show_invite_boxes = function(){
    $("#invite_link").hide();
    $("#empty_div").hide("slow");
    $("#invite_box_container").show("slow");
}
var ClassInvite = function(){};
ClassInvite.prototype = {
    initialize: function() {
        //$(".invite_form").submit(window.invite.submit_invite_form);
        $(".btn_submit").click(function(){
            //alert($("this").parent().parent());
            $(this).parents(".invite_form").submit();
        });
        $("#toggle-all-link").click(function(){
           toggleAll();
        });

        $("#submit-contacts-link").click(function(){
            submitForm();
        })
    }
   
 };



function toggleAll()
{
        var frm = document.selectfriendsform;
        var len = frm.elements.length;
        var i=0;
        for( i=0 ; i<len ; i++)
        {
                if (frm.elements[i].name=='email_list[]')
                {
                        frm.elements[i].checked= !frm.elements[i].checked ;
                }
        }
}

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



$(document).ready(function(){
    page_effects()
    window.invite = new ClassInvite();
    window.invite.initialize();
});
