$(document).ready(function(){
	hidePartialArea();
	$("#service_history_description").keyup(
         function(){
        	 checkChars("#service_history_description",400);
         }
	 );
	
	$("#service_history_description").blur(
         function(){
        	 checkChars("#service_history_description",400);
         }
	 );

         $('.lightbox').lightBox();
});

function checkChars(object,limit){
	var count_chars = $(object).val().length;
    if (count_chars > limit){
        var new_value = $(object).val().substring(0, limit);
        $(object).val(new_value);
     }
     $("span#countChars").html("" + (limit - $(object).val().length) + "");
	
}
function hidePartialArea($sType){
	if($sType!='Partial'){
		$('div.serviceHistoryArea').hide();
	}
	else $('div.serviceHistoryArea').show();
	
}

function sole_credit_card(item){
	if(item.value=='Yes'){
		document.getElementById('sole_credit_card_div').style.display="block";
	}
	else{
		document.getElementById('sole_credit_card_div').style.display="none";
	}
}

function sole_how_long_address(item){
	if(item.value>2){
		document.getElementById('previous_address_div').style.display="none";
	}
	else{
		document.getElementById('previous_address_div').style.display="block";
	}
}