var $j = jQuery.noConflict();
$j(document).ready(function(){
	
if ( $j(".altRows").length > 0 ) {
	//alternate table rows
	$j(".altRows tr:even").addClass("alt");
	
	$j(".altRows tr").hover(
      function () {
        $j(this).addClass("altOver");
      }, 
      function () {
        $j(this).removeClass("altOver");
      }
    );
}


if ( $j("tr#event1").length > 0 ) {	
	//activate event summary rollovers
	$j("tr#event1").hover(
      function () {
        $j("#eventSummary1").show("slow");
      }, 
      function () {
        $j("#eventSummary1").hide("fast");
      }
    );
}
	
if ( $j("tr#event2").length > 0 ) {	
	$j("tr#event2").hover(
      function () {
        $j("#eventSummary2").show("slow");
      }, 
      function () {
        $j("#eventSummary2").hide("fast");
      }
    );
}


if ( $j("tr#event3").length > 0 ) {	
	$j("tr#event3").hover(
      function () {
        $j("#eventSummary3").show("slow");
      }, 
      function () {
        $j("#eventSummary3").hide("fast");
      }
    );
}

if ( $j("tr#event4").length > 0 ) {	
	//activate event summary rollovers
	$j("tr#event4").hover(
      function () {
        $j("#eventSummary4").show("slow");
      }, 
      function () {
        $j("#eventSummary4").hide("fast");
      }
    );
}



if ( $j("div#modernArt img").length > 0 ) {	
	$j("div#modernArt img").hover(
      function () {
        $j("div#modernArt").animate({backgroundColor: '#000000'}, 500);
		$j("div#modernArt img").fadeTo("slow", 0.75);
      }, 
      function () {
        $j("div#modernArt").animate({backgroundColor: '#FFFFFF'}, 500);
		$j("div#modernArt img").fadeTo("fast", 1);
      }
    );
}

if ( $j("div#20century img").length > 0 ) {	
	$j("div#20century img").hover(
      function () {
        $j("div#20century").animate({backgroundColor: '#000000'}, 500);
		$j("div#20century img").fadeTo("slow", 0.75);
      }, 
      function () {
        $j("div#20century").animate({backgroundColor: '#FFFFFF'}, 500);
		$j("div#20century img").fadeTo("fast", 1);
      }
    );
}


if ( $j("div#renaissance img").length > 0 ) {	
	$j("div#renaissance img").hover(
      function () {
        $j("div#renaissance").animate({backgroundColor: '#000000'}, 500);
		$j("div#renaissance img").fadeTo("slow", 0.75);
      }, 
      function () {
        $j("div#renaissance").animate({backgroundColor: '#FFFFFF'}, 500);
		$j("div#renaissance img").fadeTo("fast", 1);
      }
    );
}


if ( $j("div#islamAsian img").length > 0 ) {	
	$j("div#islamAsian img").hover(
      function () {
        $j("div#islamAsian").animate({backgroundColor: '#000000'}, 500);
		$j("div#islamAsian img").fadeTo("slow", 0.75);
      }, 
      function () {
        $j("div#islamAsian").animate({backgroundColor: '#FFFFFF'}, 500);
		$j("div#islamAsian img").fadeTo("fast", 1);
      }
    );
}

if ( $j("div#romantiscism img").length > 0 ) {
	$j("div#romantiscism img").hover(
      function () {
        $j("div#romantiscism").animate({backgroundColor: '#000000'}, 500);
		$j("div#romantiscism img").fadeTo("slow", 0.75);
      }, 
      function () {
        $j("div#romantiscism").animate({backgroundColor: '#FFFFFF'}, 500);
		$j("div#romantiscism img").fadeTo("fast", 1);
      }
    );
}
	
if ( $j("div#contemporary img").length > 0 ) {	
	$j("div#contemporary img").hover(
      function () {
        $j("div#contemporary").animate({backgroundColor: '#000000'}, 500);
		$j("div#contemporary img").fadeTo("slow", 0.75);
      }, 
      function () {
        $j("div#contemporary").animate({backgroundColor: '#FFFFFF'}, 500);
		$j("div#contemporary img").fadeTo("fast", 1);
      }
    );
}


if ( $j("div#impressionism img").length > 0 ) {	
	$j("div#impressionism img").hover(
      function () {
        $j("div#impressionism").animate({backgroundColor: '#000000'}, 500);
		$j("div#impressionism img").fadeTo("slow", 0.75);
      }, 
      function () {
        $j("div#impressionism").animate({backgroundColor: '#FFFFFF'}, 500);
		$j("div#impressionism img").fadeTo("fast", 1);
      }
    );
}


if ( $j("form#contactfrm").length > 0 ) {
	//Validator for Contact form on contact.asp
		$j("form#contactfrm").validate({
   		rules: {
		firstName: "required",
		lastName: "required",
		phone: "required",
		email: {
		required: true,
		email: true
		}
		},
		
		messages: {
		firstName: "First name required.",
		lastName: "Last name required.",
		phone: "Phone number is required.",
		email: {
		required: "Email address is required.",
		email: "Email is invalid."
		}
		},
		
		errorElement: "li", //wraps the error message in a list element
		errorLabelContainer: "form#contactfrm #allErrors ul" //puts errors in an unorderd list
		});
}		
		
if ( $j("form#contactfrm #submit").length > 0 ) {	
		//custom hover functions for submit buttons
		$j("form#contactfrm #submit").hover(
			function(){ 
			$j(this).addClass("ui-state-hover"); 
			},
			function(){ 
			$j(this).removeClass("ui-state-hover"); 
			}
		);
}



});