$(document).ready(function(){
	$(".tooltip").tooltip({
		fade:300,
		top: 5
	});
	
	$(".scrollTo").click(function(event){
		//prevent the default action for the click event
		event.preventDefault();
		//get the top offset of the target anchor
		var target = $(this).attr("pos");
		var target_offset = $(target).offset();
		var target_top = target_offset.top;
		//goto that anchor by setting the body scroll top to anchor top
		$('html, body').animate({scrollTop:target_top}, 500);
	});
	

	$("a[rel='iFrm']").colorbox({height:"70%", width:900, opacity:.1});
	$("a[rel='iFrmVideo']").colorbox({iframe:true, height:450, width:700, opacity:.1});
	$("a[rel='iFrmPassword']").colorbox({iframe:true, height:200, width:400, opacity:.1});

	$('.watermarked').each(function() {
		$(this).watermark('watermark', $(this).attr('title'));
	});
});

validateRegistratorForm = function(frm){
	var arrFields = ["firstname", "lastname", "company", "address", "city", "state", "zipcode", "businessPhone", "taxIDNumber"]
	var err = false;
	$.each(arrFields, function(idx,val){
		var ele = $("#" + this);
		var fldVal = $.trim(ele.val());
		
		if(fldVal == ''){
			err = true;
			ele.addClass("required");
		}else{
			ele.removeClass("required");
		}
	});

	
	if(err){
		alert("Please fill in all required fields.");
		return false;
	}else{
		return true;
	}
	
};
