jQuery(window).bind("load", function() {
	jQuery("div#slider1").codaSlider()
});
$(function(){
	$('a.newWindow').click(function() {
		window.open(this.href);
		return false;
	});
});
jQuery.preloadImages = function() {
	for(var i = 0; i<arguments.length; i++) {
		jQuery("<img>").attr("src", arguments[i]);
	}
}
$.preloadImages("images/thickboxBk.png", "images/thickboxBk.gif", "images/formInput.gif", "images/cancelButton.gif");

// prepare the form when the DOM is ready 
$(document).ready(function() { 
	// thickbox init stuff
	tb_init('a.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;

	// ajaxSubmit options
	var joinOptions = { 
		target:        '#joinResponse',   // target element(s) to be updated with server response
		success:       joinResponse  // post-submit callback 
	}; 

	// add form validation
	$("#newMillenniumJoinForm").validate({
		submitHandler: function(form) {
			$(form).ajaxSubmit(joinOptions);
		}
	});

	var defaultMembersSearchValue = "Search members...";

	$("input#searchMembers").attr("value", defaultMembersSearchValue).bind("keyup", function() {searchMembers(this.value)}).bind("click", function() { 
		if(jQuery.trim(this.value) == defaultMembersSearchValue) {
			this.value="";
		}
	}).bind("blur", function() {
		if(jQuery.trim(this.value) == "") {
			this.value=defaultMembersSearchValue;
		}
	});


	// ajaxSubmit options
	var loginOptions = { 
		//target:        '#loginResponse',   // target element(s) to be updated with server response
		//beforeSubmit:  loginValidate,  // pre-submit callback 
		success:       handleLoginResponse  // post-submit callback 
	}; 

	// add form validation
	$("#loginForm").validate({
		submitHandler: function(form) {
			$(form).ajaxSubmit(loginOptions);
		},
		rules: {
			password: { // require password only if sendPassword is NOT checked
				required: "#sendPassword:unchecked"
			}
		}
	});
}); // end of DOM ready
