jQuery.noConflict();

jQuery(document).ready(function() 
{
	var so = new SWFObject("/assets/uploads/banner.swf", "mymovie", "311", "141", "8");
	so.addVariable("xmlPath", "/assets/uploads/data.xml");// <----You can change the path to the XML file here.
	so.addParam("menu", "false");
	so.write("flashSideBanner");
	
	
	// place homepage Flash banner
	if ( jQuery("#homeFlashBanner").length > 0 ) {
		var so1 = new SWFObject("/assets/uploads/ggi015cogentbannerv2.swf", "mymovie", "650", "475", "8");
		so1.addVariable("bannerlink", "http://www.cogentcollections.com/collection-software/");
		so1.write("homeFlashBanner");
	}

	// Contact form validation
	jQuery('#contact-form').validate({
		rules: {
			first_name: "required",
			last_name: "required",
			company: "required",
			email: "required"
		},
		messages: {
			first_name: "Username is required",
			last_name: "Password is required",
			company: "Company is required",
			email: "E-mail is required"
		}
	});

	jQuery('#SearchForm_SearchForm_Search').focus(function()
	{
		if (jQuery(this).val() == 'Search')
			jQuery(this).val('');
	});

	jQuery('#SearchForm_SearchForm_Search').blur(function()
	{
		if (jQuery(this).val() == '')
			jQuery(this).val('Search');
	});

	jQuery('#Form_NewsletterForm_Email').focus(function()
	{
		if (jQuery(this).val() == 'Enter email address')
			jQuery(this).val('');
	});

	jQuery('#Form_NewsletterForm_Email').blur(function()
	{
		if (jQuery(this).val() == '')
			jQuery(this).val('Enter email address');
	});
	
	// port newletter status message to hard-coded, visible form
	jQuery('form#Form_NewsletterForm p#Form_NewsletterForm_error').replaceAll(jQuery('form#Form_NewsletterFormN p#Form_NewsletterForm_errorN'));
	
	// Newsletter signup validation
	jQuery('#Form_NewsletterFormN').validate({
		errorLabelContainer: "#errMsg",
		rules: {
			Email: {
				required: true,
				email: true
			}
		},
		messages: {
			Email: {
				required: "E-mail is required",
				email: "E-mail must be in the format name@domain.com"
			}
		}
	});
	
});