$(document).ready(function(){

     $('.faq-row-head a').click(function() {
        $(this).parent().toggleClass('opened');
        $(this).parents('.faq-row').find('.faq-row-entry').slideToggle();
        return false;
    });
    $('.faq-close').click(function() {
        $(this).parents('.faq-row').find('.opened').removeClass('opened');
        $(this).parents('.faq-row').find('.faq-row-entry').slideUp();
        return false;
    });
    
		jQuery("a[rel='form']").colorbox({
            rel:"nofollow",
			href: "/request_form",
			scrolling: false,
			onComplete: function(){
				after_load();
			}
		});
		jQuery('a.colorbox').colorbox();
    if ($( "#request_case_date_of_incident" ).count>0)
    {
  $( "#request_case_date_of_incident" ).datepicker();
    }

});

function create_recaptcha(div,key)
{
	Recaptcha.create(key,
	div, {
   theme: "red",
   callback: function (){
   	Recaptcha.focus_response_field;
	jQuery.fn.colorbox.resize();
	}
});
}

function after_load2()
{
  $( "#request_case_date_of_incident" ).datepicker();

}

function after_load()
{
	$(".inp").focus(function(srcc)
    {
        if ($(this).val() == $(this)[0].title)
        {
            $(this).val("");
        }
    });
    
    $(".inp").blur(function()
    {
        if ($(this).val() == "")
        {
            $(this).val($(this)[0].title);
        }
    });

	$("#request_description").focus(function(srcc)
    {
        if ($(this).val() == "Description")
        {
            $(this).val("");
        }
    });
    
    $("#request_description").blur(function()
    {
        if ($(this).val() == "")
        {
            $(this).val("Description");
        }
    });

    
    $(".inp").blur();
	$("#request_description").blur();
    if ($("#recaptcha_box").length > 0){
         create_recaptcha("recaptcha_box",recaptcha_key);
    } else
    {
        jQuery.fn.colorbox.resize();
    }
	
    
	
    

}






function submit_form()
{
        if ($("#request_first_name").val()=="First Name*")
        {
            $("#request_first_name").val("");
        }
        if ($("#request_last_name").val()=="Last Name*")
        {
            $("#request_last_name").val("");
        }
        if ($("#request_email").val()=="Email*")
        {
            $("#request_email").val("");
        }
        if ($("#request_phone").val()=="Phone*")
        {
            $("#request_phone").val("");
        }
        if ($("#request_description").val()=="Description")
        {
            $("#request_description").val("");
        }
//	$("#formRequest").html("Loading...");
	jQuery.fn.colorbox.resize();  
}

function loading()
{
    $("#formRequest").html("Loading...");
}

