$(function(){
   $('.login_link').click(function(){
       $('#login_container').toggle();
       return false;
   });
   $('.video-iframe').colorbox({ opacity:0.5, iframe:true, innerWidth:812, innerHeight:412, scrolling:false, title:'Video Gallery' });
   $('.sf-menu').superfish();
   $('.iframe').colorbox({opacity:0.5,iframe:true,innerWidth:577,innerHeight:416,scrolling:false})
   $('#home_app input, #home_app select, #home_app textarea').focus(function(){
       $(this).removeClass('error');
   });
   $('#home_app').submit(function(){
        if($('#id_name').val() == "Name")$('#id_name').val("");
        if($('#id_phone_number').val() == "Phone")$('#id_phone_number').val("");
        if($('#id_message').val() == "Message")$('#id_message').val("");
        if($('#id_email_address').val() == "Email")$('#id_email_address').val("");
        $.ajax({
          type: "GET",
          //url: document.location.protocol + "//slp.socialups.com/contact/ajax/?callback=?",
          url: "http://slp.socialups.com/contact/ajax/?callback=?",
          data: $(this).serialize(),
          dataType: "jsonp",
          success: function(data){
            if(data["form_success"]){
               $('#home_app h2').text('Thank You!').next().text('Someone will contact you shortly.'); 
               $('#home_app textarea, #home_app input, #home_app select').val(''); 
            }else{
                for(error in data["form_errors"]){
                    $('#home_app #id_'+error).addClass('error');
                }
            }
            $('#home_app textarea, #home_app input').blur();
          }
        });

        return false; 
   });
});

