/* -------------------------------- */
/*  Short form styles               */
/* -------------------------------- */
		  
function add_colors() {
	
	 $("div.orderbtn").toggleClass('red_bg');
	  
	  $("a.btnrl span").toggleClass('grey_bg_span');
	  
	  $("a.btnrl").toggleClass('grey_bg');
	  
	  $("div.orderbtntext").toggleClass('white_text');
}

function show_throbber(element) {

     $(element).find("img.throbber").show();

}

function remove_throbber(element) {
    
    $(element).remove();
	$(element).parent().removeAttr("style");
	
}

$(document).ready(function() {
   
   $("table.formtb input, table.formtb textarea").focus(function() {
		if ($("#reqcallbackcontainer").is(":visible")) {
			$("#reqcallbackcontainer").slideToggle();
			updateRecaptcha("recaptcha_placeholder", "rc_recaptcha_widget");
		}
   });
   
   $("a#quote, a.open_quick_quote").click(function(event) {
	   
	  event.preventDefault();
	  
	  $("#shortform").slideToggle('normal', function() {
		if($("#shortform").is(":visible")) {
			if($("#reqcallbackcontainer").is(":visible")) {
				$("#reqcallbackcontainer").slideToggle(function() {
					updateRecaptcha("recaptcha_placeholder", "rc_recaptcha_widget");
				});
			}
		  }
	  });
	  
	  
	  
	  add_colors();
		
    });
   
   $("a.open, a.open_quick_quote").click(function(event) {
	   
	  event.preventDefault();
	 
	 if(!$("#shortform").is(":visible")) { 
	 
	   $("#shortform").slideToggle('normal');
	  
	   add_colors();
	   
	   }

	   var id = $(this).attr("id");		 
	
	
	 $("select#pack option").each(function(i) {
	         
			 if($(this).val() == id || $(this).text() == id) {
				 
				 $(this).attr("selected", "selected");
				 
				 }
     });
	
      $('html, body').animate({
           scrollTop: $("#content").offset().top
        }, 600);

		return false;
    });
 
}); 

