// This contains all base javascript (e.g. siFR, swfobject calls, etc)

//  base.js
//  WebDevTemplate
//  
//  Created by Brandon Calloway on 2008-08-01.
//  Copyright 2008 Scully Group. All rights reserved.
// 

$(document).ready(function() {
	
  // contact us form validation
	$("#error").hide();
	$("#contact-us").validate({
		errorPlacement: function(error, element) {
		error.appendTo( element.parent("p") );
		$("#error").show();
		}
	});
	
	// facility rental form validation
	$("#error").hide();
	$("#facility-rental").validate({
		errorPlacement: function(error, element) {
		error.appendTo( element.parent("p") );
		$("#error").show();
		}
	});
	
	// membership form validation
	$("#error").hide();
	$("#membership").validate({
		errorPlacement: function(error, element) {
		error.appendTo( element.parent("p") );
		$("#error").show();
		}
	});


  if (typeof sIFR == "function") {
  	sIFR.replaceElement(named({
  		sSelector: " #feature h1",
  		sFlashSrc: "/swf/garamond.swf",
  		sColor: "#99ae7a",
  		/*sLinkColor: "#f9f9fa",*/
  		/*sBgColor: "#fff",*/
  		/*sHoverColor: "#ccc",*/
  		/*sCase: "upper",*/
  		sWmode: "transparent",
  		sFlashVars: "textalign=center" //textalign=center, textalign=right, offsetLeft=6, offsetTop=6, underline=true (seperated by &)
  	}));
  };
  
  if (typeof sIFR == "function") {
  	sIFR.replaceElement(named({
  		sSelector: " #feature_box h2",
  		sFlashSrc: "/swf/garamond.swf",
  		sColor: "#ce7018",
  		/*sLinkColor: "#f9f9fa",*/
  		/*sBgColor: "#fff",*/
  		/*sHoverColor: "#ccc",*/
  		/*sCase: "upper",*/
  		sWmode: "transparent",
  		sFlashVars: "textalign=left" //textalign=center, textalign=right, offsetLeft=6, offsetTop=6, underline=true (seperated by &)
  	}));
  };
  
  if (typeof sIFR == "function") {
  	sIFR.replaceElement(named({
  		sSelector: " #footer_right h2",
  		sFlashSrc: "/swf/garamond.swf",
  		sColor: "#ecf6dc",
  		/*sLinkColor: "#f9f9fa",*/
  		/*sBgColor: "#fff",*/
  		/*sHoverColor: "#ccc",*/
  		/*sCase: "upper",*/
  		sWmode: "transparent",
  		sFlashVars: "textalign=right" //textalign=center, textalign=right, offsetLeft=6, offsetTop=6, underline=true (seperated by &)
  	}));
  };
  
  if (typeof sIFR == "function") {
  	sIFR.replaceElement(named({
  		sSelector: " #text h1, #text_interior h1",
  		sFlashSrc: "/swf/garamond_italic.swf",
  		sColor: "#ce7018",
  		/*sLinkColor: "#f9f9fa",*/
  		/*sBgColor: "#fff",*/
  		/*sHoverColor: "#ccc",*/
  		/*sCase: "upper",*/
  		sWmode: "transparent",
  		sFlashVars: "textalign=left" //textalign=center, textalign=right, offsetLeft=6, offsetTop=6, underline=true (seperated by &)
  	}));
  };

////////////////////////////////////////////////////////////////////////////swfobject call
	
var flashvars = {
	xml_path:"/filmstrip/"
};
var params = {
    menu: "false",
    wmode: "transparent"
    };
var attributes = {};

swfobject.embedSWF("swf/home_slide.swf", "flash", "100%", "290","9.0.0", "", flashvars, params, attributes);
//swfobject.embedSWF("swf/interior_slide.swf", "flash_interior", "1000", "290","9.0.0", "", flashvars, params, attributes);

//////////////////////////////////////////////////////////////////////////// set form recipient

  $('form#contact-us select#topic').change(function() {
    var topic = '';
    $("form#contact-us select#topic option:selected").each(function() {
      topic = $(this).text();
    });
    switch(topic) {
      case "Artist Inquiries":
        $('form#contact-us input#recipient').val('artinquiries@ncarboretum.org');
        break;
      case "Cafe":
        $('form#contact-us input#recipient').val('cafe@ncarboretum.org');
        break;
      case "Economic Development":
        $('form#contact-us input#recipient').val('economicdevelopment@ncarboretum.org');
        break;
      case "Education":
        $('form#contact-us input#recipient').val('education@ncarboretum.org');
        break;
      case "Exhibits":
        $('form#contact-us input#recipient').val('exhibits@ncarboretum.org');
        break;
      case "Rentals":
        $('form#contact-us input#recipient').val('rentals@ncarboretum.org');
        break;
      case "Gift Shop-Gallery":
        $('form#contact-us input#recipient').val('giftshop@ncarboretum.org');
        break;
      case "Giving":
        $('form#contact-us input#recipient').val('giving@ncarboretum.org');
        break;
      case "Green Weddings":
        $('form#contact-us input#recipient').val('greenweddings@ncarboretum.org');
        break;
      case "Group Tours":
        $('form#contact-us input#recipient').val('grouptours@ncarboretum.org');
        break;
      case "Jobs and Internships":
        $('form#contact-us input#recipient').val('jobsandinternships@ncarboretum.org');
        break;
      case "Membership":
        $('form#contact-us input#recipient').val('membership@ncarboretum.org');
        break;
      case "Media and Marketing":
        $('form#contact-us input#recipient').val('mediaandmarketing@ncarboretum.org');
        break;
      case "Plants":
        $('form#contact-us input#recipient').val('plants@ncarboretum.org');
        break;
      case "Segway Tours":
        $('form#contact-us input#recipient').val('segway@ncarboretum.org');
        break;
      case "Volunteering":
        $('form#contact-us input#recipient').val('volunteering@ncarboretum.org');
        break;
      case "Other":
        $('form#contact-us input#recipient').val('other@ncarboretum.org');
        break;
    }
  }).trigger('change');

}); //end document.ready
