$(document).ready(function(){
	if ($("ul.sf-menu").length > 0) {
		jQuery('ul.sf-menu').superfish();
	}
	if ($("#homeflash").length > 0) {
		swfobject.embedSWF(root+"home_movie.swf", "homeflash", "595", "280", "9.0.0","",{},{wmode:'opaque'},{});
	}
	if ($("a.leader").length > 0) {
		$("a.leader").bind("click",function(e){
			e.preventDefault();
			lida = this.id.split('_');
			lid = lida[1];
			$("#jquiDialog").load(root+'index.cfm/XHR/Bio/leaderID/'+lid);
			$("#jquiDialog").dialog('open');
		})
	}
	$("#jquiDialog").dialog({
		bgiframe:true,
		height:360,
		width:540,
		modal:true,
		autoOpen:false
	})
	$("a.email").bind("click",function(e) {
		e.preventDefault();
		var ts = new Date().getTime();
		var url = root+"index.cfm?go=XHR.ContactForm&recip="+encodeURIComponent($(this).html())+"&recipName="+encodeURIComponent($(this).attr('name'))+"&ts="+ts;
		$("#jquiDialog").load(url,function(){$("#contactForm").validate();});
		$("#jquiDialog").dialog('open');
	})
	$("ul li:not(ul#suckernav li)").prepend("<span class='bullet'>&bull;</span>&nbsp;");
	if ($("#payment").length > 0) {
		$("#payment").validate({
			rules: {
				cvv: {
					required: true,
					range: [0,999]
				},
				billingZip: {
					required: true,
					range: [10000,99999]
				}
			}
		})
	}
	if ($("#statementDate").length > 0) {
		$("#statementDate").datepicker();
	}
	if ($("#findCVV").length > 0) {
		$("#findCVV").tooltip({
			delay:0,
			showURL: false,
			top: -80,
			bodyHandler: function() {
				return $("<img/>").attr("src",root+"images/cvv.jpg");
			}
		})
	}
});

