$(function() {
    $(".loading").hide();
    $('#form_administration_songs_title_url_update').ajaxForm({ 
    //iframe: true,
    beforeSubmit: function() {
	//alert($(this));
	$("#container_form_administration_songs_title_url_update form").hide();
        $(".loading").show();
    },
    success: function(response) {
        //$("#ajaxResult").html($(html).find("#ajaxResponse"));
	$(".response").html(response);
	
    },
    complete: function() {
        $(".loading").hide();
    }

    });
    
    
    
    //CONTACT FORM
    
    
    
    
            $(".align_both").each(function(i)   
        {
	    $(this).css({'position':'relative','left':'50%','margin-left':($(this).width()/-2)+'px'});
	    $(this).css({'position':'relative','top':'50%','margin-top':($(this).height()/-2)+'px'});
	    $(this).css({'max-width':($(this).parent().width()-4)+'px'});
        });
    
    	 //form_contact DESIGN
  var form_contact_form_label_max = 0;
  $('#form_contact .form_label').each(function() {
    if ($(this).width() > form_contact_form_label_max)
      form_contact_form_label_max = $(this).width();   
  });
  $('#form_contact .form_label').width(form_contact_form_label_max);
  $('#form_contact .form_error').css({'margin-left' : form_contact_form_label_max + 6});
  
  $('#form_contact input[type=text],textarea').css({borderStyle: "solid"});
  $('#form_contact input[type=text],textarea').focus(function(){
    $(this).css({borderStyle: "dotted"});
  });
  $('#form_contact input[type=text],textarea').blur(function(){
    $(this).css({borderStyle: "solid"})
  });
  
  
    
   
    
    $("#form_contact_loading").hide();
    $("#form_contact_response").hide();
    $("#form_contact .form_error").hide();
    $('#form_contact').ajaxForm({ 
    beforeSubmit: function() {
	$("#form_contact .form_error").hide();
	
	var form_contact_name = $("#form_contact_name").val();
	if (form_contact_name == "") {
	    $("#form_contact_error_name").show();
	    $("#form_contact_name").focus();
	    return false;
	}
	var form_contact_email = $("#form_contact_email").val();
	if (form_contact_email == "") {
	    $("#form_contact_error_email").show();
	    $("#form_contact_email").focus();
	    return false;
	}
	
	var form_contact_text = $("#form_contact_text").val();
	if (form_contact_text == "") {
	    $("#form_contact_error_text").show();
	    $("#form_contact_text").focus();
	    return false;
	}
	
	var form_contact_captcha = $("#form_contact_captcha").val();
	if (form_contact_captcha == "") {
	    $("#form_contact_error_captcha").show();
	    $("#form_contact_captcha").focus();
	    return false;
	}

	$("#container_form_contact form").hide();
        $("#form_contact_loading").fadeIn(200);
    },
    success: function(response) {
        //$("#ajaxResult").html($(html).find("#ajaxResponse"));
	if (response != 'SUCCESS') {
	    if (response == 'ERROR_CAPTCHA') {
		//$("#form_contact_response > p").html();
		$("#container_form_contact form").show();
		$("#form_contact_captcha_ERROR_CAPTCHA").show();
		$("#form_contact_captcha").attr("value","").focus();
		return false;
	    }
	    else {
		$("#form_contact_response > p").html(response);
	    }
	}
	$("#form_contact_response").fadeIn(200);
	
    },
    complete: function() {
        $("#form_contact_loading").hide();
    }

    });
    
    function dddrealign() {
	        $(".align_both").each(function(i)   
        {
	    $(this).css({'position':'relative','left':'50%','margin-left':($(this).width()/-2)+'px'});
	    $(this).css({'position':'relative','top':'50%','margin-top':($(this).height()/-2)+'px'});
	    $(this).css({'max-width':($(this).parent().width()-4)+'px'});
        });
    
    }
       



    
    
});
