$(function(){
	// for the Form only.
	$(".field, div.container, input.radio, input.checkbox", $(".form_field")).each(function(){
		var theId = parseInt($(this).parents('.form_field').get(0).id.split('form_field_')[1]);
		$(this).bind('focus', function(){
			showInstructions(theId);
		}).bind('mouseover', function(){
			showInstructions(theId);
		});
	});
});

var showInstructions = function(id){
	$(".form_field").not(".section").each(function(){
		$("p.instructions", $(this)).each(function(){
			$(this)
			.removeClass("active")
			.hide()
			.filter("#instructions_"+id)
			.filter(function(){ return $(this).text() != ''; })
			.show()
			.addClass("active");
		});
	});
};

var hideInstructions = function(id, e){
	$('p.instructions')
	.filter("#instructions_"+id)
	.filter(function(){ return $(this).text() != ''; })
	.hide()
	.removeClass("active");
};

var highlightField = function(id){
	$(".form_field").not(".section").not(".hover").removeClass("hover").filter("#form_field_"+id).addClass("hover");
};

var unhighlightField = function(id){
	$(".form_field").filter("#form_field_"+id).removeClass("hover");
};

var resetParentIFrameSize = function(){
	if(frameElement != null){
		$(frameElement)
		.removeAttr('height')
		.animate({
			height: $('#container').outerHeight() + 'px'
		}, "fast", "swing");
	}
};