
confirmContrib = '<div style="text-align:left; margin-left:55px; margin-top:10px;">Please Confirm!</div>\
<div style="text-align:left; margin-left:55px;">The Sermon Network <a target="_blank" href="http://sermonstudio.net" style="color:#8baf31">Studio</a><br>\
is intended for Church use only</div>\
<div style="margin:15px 0 0 55px; text-align:left;">\
<input id="member" type="checkbox"> Oops, I just want to listen.</input><br>\
<input id="cotributor" type="checkbox"> Yes, I am here to upload sermons.</input>\
</div>';
confirmMember = '<div style="text-align:left; margin-left:15px; margin-top: 10px;">What type of account are you wanting to create?</div>\
<div style="text-align:left; margin-left:55px;"></div>\
<div style="margin:15px 0 0 15px; text-align:left; background-color:#de7b11; padding:5px;">\
<input id="member" type="checkbox"> I am here as a member to listen and watch.</input></div>\
<div style="margin:15px 0 0 15px; text-align:left; background-color:#aecc64; padding:5px;">\
<input id="cotributor" type="checkbox"> I want to create a channel and upload sermons.</input></div>\
<div style="padding-left:25px; text-align: left; font-size: 80%">Notice: Uploading is for Churches and Ministries only.</div>\
';
function signupPost(){
//alert($('#signup').serialize()); return 0;
    $.post('signup/ajax/1',$('#signup').serialize(),function(data){
if(data.match(/http/)){
parent.location.href = data;
}else {
showConfirm(data);
}

            });
    }
function showConfirm(html){
    $('#signConfirm').html(html);
    $('#signConfirm p').attr('style','');
    $('#signConfirm #cotributor').click(function(event){
        event.stopPropagation();
        $("#contrib").attr('checked',true)
        signupPost();
    });
    $('#signConfirm #member').click(function(event){
        event.stopPropagation();
        $("#contrib").attr('checked',false)
        signupPost();
    });
    $('#signConfirm').fadeIn('slow');
}
$(document).ready(function(event){
    $("#divHeaderMenu .icons a").mouseover(function(){
        $(".linkRef").html($(this).attr('alt'));
    });
    $("#searchMain .text").focus(function(){
        $(this).val('');
    });
    $('.signupInput').focus(function(){
            //password
        if($(this).val()==$(this).attr('def')){
            $(this).val('');
            if($(this).attr('name')=='pw' | $(this).attr('name')=="ppw"){
                $("#pass").val('');
                $("#pass2").val('');
            }
        }
    });

    $('.signupInput').blur(function(){
        if($(this).attr('name')!='password' & $(this).attr('name')!="password2" &  $(this).val()=='')
            $(this).val($(this).attr('def'));
    });
$('#signConfirm').click(function(){$(this).hide()})
$('#divDashHead').click(function(){
    $('#signConfirm').toggle();
});

$('.signupSubmit').click(function(){
        if($("#pass").val()!=$("#pass2").val()){
            showConfirm('<p>Passwords not match</p>');
            return false;
        }
        var f=0;
        $(".signupInput").each(function (i) {

            if($(this).val()==$(this).attr('def')){
                showConfirm('<p>Please complete all fields</p>');
                f=1;
            }
        });
        if(f) return false;
        if($("#contrib").attr('checked')){
            showConfirm(confirmContrib);
        } else {
            showConfirm(confirmMember);
        }
        return false;
        //if($("#contrib"))
        signupPost();
});

});
