recordUrl='/index';



/*
confirmContrib = '<div style="text-align:left; margin-left:55px; margin-top: -10px;">Please Confirm!</div>\
<div style="text-align:left; margin-left:55px;">You are creating a Member account.</div>\
<div style="margin:15px 0 0 55px; text-align:left;">\
<input id="member" type="checkbox"> Yes, I am here to listen and watch.</input><br>\
<input id="cotributor" type="checkbox"> Oops, I want to upload sermons.</input>\
<div style="padding-left:20px; text-align: left; font-size: 70%">Uploading is for Churches only.</div>\
</div>';
confirmMember = '<div style="text-align:left; margin-left:55px; margin-top: -10px;">Please Confirm!</div>\
<div style="text-align:left; margin-left:55px;">You are creating a Member account.</div>\
<div style="margin:15px 0 0 55px; text-align:left;">\
<input id="member" type="checkbox"> Yes, I am here to listen and watch.</input><br>\
<input id="cotributor" type="checkbox"> Oops, I want to upload sermons.</input>\
<div style="padding-left:20px; text-align: left; font-size: 70%">Uploading is for Churches only.</div>\
</div>';
*/
confirmContrib = '<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:#aecc64; 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:#de7b11; 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>\
';
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:#aecc64; 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:#de7b11; 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(){
    $.post('/signup/ajax/1',$('#signup').serialize(),function(data){
		if(data.match(/http/)){
//		alert(data);
		    document.location = 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'));
    });
    
    $('.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'));
    });
$(".bestDescription").jCarouselLite({
    btnNext: ".default .next",
    btnPrev: ".default .prev",
    visible: 1,
    btnGo: ["#ci0", "#ci1","#ci2","#ci3","#ci4","#ci5"]
});
$('#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('<div style="text-align:middle; margin-top: 10px;">Please complete all fields</div>');
                f=1;
            }
        });
        if(f) return false;
        if($("#contrib").attr('checked')){
            showConfirm(confirmContrib);
        } else {
            showConfirm(confirmMember);
        }
        return false;
        //if($("#contrib"))
        signupPost();
});

    $('.face').click(function(){
        record = $(this).attr('record');
        //alert(recordUrl);
        $.get(recordUrl,{'sermonid':record}, function(data){
            var data = eval(data);
            so.addParam('flashvars',data.flashvars);
            so.write('divVideo');
            $('#nowplaying').html(data.now_playing);
        },"json");

    });

});
