// JavaScript Document
// author: Edyta Jordan - Senior Web Designer and Developer
// all the jQuery code goes into document.ready()!!!!!!!!!!!!!!!!!!!!!!!! 
$(document).ready(function(){
	var bodyClass = $('body').attr('class');
	switch(bodyClass){
		// topMenu
		case 'aboutPage':
		$('#menu ul li a.about').removeClass('about').addClass('about2');	
		break;
		case 'eventsPage':
		$('#menu ul li a.events').removeClass('events').addClass('events2');
		break;
		case 'givingPage':
		$('#menu ul li a.giving').removeClass('giving').addClass('giving2');
		break;
		case 'membershipPage':
		$('#menu ul li a.membership').removeClass('membership').addClass('membership2');
		break;
		case 'conventionPage':
		$('#menu ul li a.convention').removeClass('convention').addClass('convention2');
		break;
		case 'mediaPage':
		$('#menu ul li a.media').removeClass('media').addClass('media2');
		break;
		case 'contactPage':
		$('#menu ul li a.contact').removeClass('contact').addClass('contact2');
		break;
		// sideMenu *GivingBackPage
		case 'grantsPage':
		$('#sideMenu ul li a.grants').removeClass('grants').addClass('grants2');	
		break;
		case 'scholarshipsPage':
		$('#sideMenu ul li a.scholarships').removeClass('scholarships').addClass('scholarships2');
		break;
		case 'sponsorsPage':
		$('#sideMenu ul li a.sponsors').removeClass('sponsors').addClass('sponsors2');
		break;
		case 'youthPage':
		$('#sideMenu ul li a.youth').removeClass('youth').addClass('youth2');
		break;
		// sideMenu *MediaPage
		case 'photosPage':
		$('#sideMenu ul li a.photos').removeClass('photos').addClass('photos2');	
		break;
		case 'videoPage':
		$('#sideMenu ul li a.video').removeClass('video').addClass('video2');
		break;
		case 'publicationsPage':
		$('#sideMenu ul li a.publications').removeClass('publications').addClass('publications2');
		break;
		case 'pressPage':
		$('#sideMenu ul li a.press').removeClass('press').addClass('press2');
		break;
		// sideMenu *MembershipPage
		case 'membershipFormPage':
		$('#sideMenu ul li a.membershipForm').removeClass('membershipForm').addClass('membershipForm2');
		break;
		//
		case 'conventionRegistrationForm':
		$('#sideMenu ul li a.conventionRegistrationForm').removeClass('conventionRegistrationForm').addClass('conventionRegistrationForm2');
		break;
		case 'conventionSponsors':
		$('#sideMenu ul li a.conventionSponsors').removeClass('conventionSponsors').addClass('conventionSponsors2');
		break;
		case 'conventionResources':
		$('#sideMenu ul li a.conventionResources').removeClass('conventionResources').addClass('conventionResources2');
		break;
	}
	//conditional statement to change bgd according to screen width
	//code here
	//contact form validation
	$('#contactForm').validate({
		rules:{
			name: 'required',
			address: 'required',
			email: 
				{
					required: true,
					email: true
					},
			subject: {required: true},
			message: 'required'		
		}, //end of rules
		 messages: {
			  email: {
				 required: "<br/>Please supply an e-mail address",
				 email: "<br/>This is not a valid email address"
			   }
		 }, //end of messages
		errorPlacement: function(error, element) { 
          error.insertAfter(element);
        }
	}); //end of validate
	//membershipRegForm
	$('#membershipRegForm').validate({
		rules:{
			membershipType: 'required',
			BillFirstName: 'required',
			BillLastName: 'required',
			BillAddress: 'required',
			BillCity: 'required',
			BillZip: 'required',
			BillCountry: 'required',
			BillPhone: 'required',
			BillEMail: 'required',
			user_Acknowledgement: 'required',
			user_Acknowledgement2: 'required',
			//
			user_DOB:{
				date: true
			},
			//
			//user_Occupation: 'required',
			user_MailSentTo: 'required',
			disclaimer: 'required',
			email: 
				{
					required: true,
					email: true
					}
			},
			messages: {
			  BillEMail: {
				 required: "<br/>Please supply an e-mail address",
				 email: "<br/>This is not a valid email address"
			   },
			  user_Occupation: "Please enter your occupation",
			  ItemQty: "Please select the type of membership",
			  user_DOB: "Please enter your date of birth in a format MM/DD/YYYY",
			  user_MailSentTo: "Tell us where do you want your mail to be sent to"
		 }, //end of messages
		errorPlacement: function(error, element) { 
			var errorPlacement = $('.errorPlacement');
        	error.appendTo(errorPlacement);
        	}
		});
	//
	//
	//end of membershipRegForm
	$('#contactForm input').addClass('required');
	$('#contactForm #email').addClass('email');
	//
	//
	$('#recipients ul').hide();
	$('select option').click(function(evt){
		var letterID = $(this).attr('value');
		$('#recipients ul').hide();
		switch(letterID){
			case 'A-B':
			$('#recipients #A-B ul').fadeIn('slow');
			break;
			case 'C-D':
			$('#recipients #C-D ul').fadeIn('slow');
			break;
			case 'E-F-G-H':
			$('#recipients #E-F-G-H ul').fadeIn('slow');
			break;
			case 'I-J-K-L':
			$('#recipients #I-J-K-L ul').fadeIn('slow');
			break;
			case 'M-N-O-P':
			$('#recipients #M-N-O-P ul').fadeIn('slow');
			break;
			case 'Q-R-S':
			$('#recipients #Q-R-S ul').fadeIn('slow');
			break;
			case 'T':
			$('#recipients #T ul').fadeIn('slow');
			break;
			case 'U-V-W-X':
			$('#recipients #U-V-W-X ul').fadeIn('slow');
			break;
			case 'Y-Z':
			$('#recipients #Y-Z ul').fadeIn('slow');
			break;
		};
	});
//
	$('#formAccordion').accordion({
		autoHeight: false,
		header: 'h2',
		selectedClass: 'current'
		//event: 'mouseover'	
	});
	//
	/*
	var j = $('#formAccordion h2');
	for(var i=1; i<j.length; i++){
		var j2 = 'Step .[i].';
		j.prepend(j2);	
	}
	*/
//
    var options = {};
    var events = [ 			
				  	{ EventID: 1, "Date": new Date(2009, 8, 2), "Title": "Speaker: Larry Weishuhn on Whitetail @ HESS Club", URL: "monthlyMeetings/HSCmeetingNoticeSept2009.pdf" },
					{ EventID: 2, "Date": new Date(2009, 9, 7), "Title": "Speaker: Jim Miller @ HESS Club", URL: "monthlyMeetings/HSCmeetingNoticeOct2009.pdf" },
					{ EventID: 3, "Date": new Date(2009, 10, 4), "Title": "Speaker: TBD @ HESS Club", URL: "#" },
					{ EventID: 4, "Date": new Date(2009, 11, 2), "Title": "Annual Christmas Party @ Cadillac Bar", URL: "#" },
					{ EventID: 5, "Date": new Date(2010, 0, 15), "Title": "Annual Convention", URL: "../convention" },
					{ EventID: 6, "Date": new Date(2010, 0, 16), "Title": "Annual Convention", URL: "../convention" },
					{ EventID: 7, "Date": new Date(2010, 0, 17), "Title": "Annual Convention", URL: "../convention" },
					{ EventID: 8, "Date": new Date(2010, 1, 3), "Title": "Speaker: Mark Butcher w/Matapura Safaris @ HESS Club", URL: "#" },
					{ EventID: 9, "Date": new Date(2010, 2, 3), "Title": "Speaker: Butch King @ HESS Club", URL: "#" },
					{ EventID: 10, "Date": new Date(2010, 3, 7), "Title": "Speaker: John Banovich @ HESS Club", URL: "#" },
					{ EventID: 11, "Date": new Date(2010, 4, 7), "Title": "2010 Houston Safari Club Sporting Clays Tournament", URL: "sportingClays/2010sportingClaysTournament.pdf" },
					{ EventID: 12, "Date": new Date(2010, 5, 2), "Title": "Speaker: TBD @ HESS Club", URL: "#" },
					{ EventID: 12, "Date": new Date(2010, 5, 3), "Title": "Sporting Clays 2nd Amendment Celebration Honoring District Attorney Pat Lykos @ American Shooting Centers", URL: "#" },
					{ EventID: 13, "Date": new Date(2009, 8, 17), "Title": "Young Professional's Mixer", URL: "youngProfessionalMixer/youngProfessionalMixerSept17-2009.jpg" },
					{ EventID: 14, "Date": new Date(2009, 9, 16), "Title": "Texas Big Horn Society Open House from 6:30 till 9:30 pm.<br/>Silver Eagle Distributors, 7777 Washington Ave., Houston, TX  77007<br/>RSVP to Charles Wolcott at 713-824-9146 or cwwolcott@gmail.com", URL: "mailto:cwwolcott@gmail.com" },
					{EventID: 15, "Date": new Date(2009, 10, 06), "Title": "Feast with the Beasts - Houston Zoo. From 7:00 till 11:00 pm", URL: "http://www.houstonzoo.org/feast/" },
					
					{EventID: 16, "Date": new Date(2009, 11, 15), "Title": "Photo Contest Deadline - December 15, 2009", URL: "otherEvents/photoContest.pdf" },
					{EventID: 17, "Date": new Date(2009, 11, 1), "Title": "Trophy Awards Deadline - December 1, 2009", URL: "otherEvents/2010 Annual Trophy Awards Flyer1.pdf" },
					{EventID: 18, "Date": new Date(2010, 0, 6), "Title": "Whitetail Contest Deadline - January 6, 2010", URL: "otherEvents/2010 Member Trophy Awards Page 2.pdf" },
					{EventID: 19, "Date": new Date(2009, 11, 12), "Title": "2009/2010 Youth Hunts at CMS Tejas", URL: "" },
					{EventID: 20, "Date": new Date(2009, 09, 9), "Title": "2009/2010 Youth Hunts at Cotton Mesa", URL: "" },
					{EventID: 21, "Date": new Date(2009, 09, 10), "Title": "2009/2010 Youth Hunts at Cotton Mesa", URL: "" },
					{EventID: 22, "Date": new Date(2009, 09, 11), "Title": "2009/2010 Youth Hunts at Cotton Mesa", URL: "" },
					{EventID: 23, "Date": new Date(2009, 09, 30), "Title": "2009/2010 Youth Hunts at Flying A and DD", URL: "" },
					{EventID: 24, "Date": new Date(2009, 09, 31), "Title": "2009/2010 Youth Hunts at Flying A and DD", URL: "" },
					{EventID: 25, "Date": new Date(2009, 10, 1), "Title": "2009/2010 Youth Hunts at Flying A and DD", URL: "" },
					{EventID: 26, "Date": new Date(2009, 09, 29), "Title": "2009/2010 Youth Hunts at DD", URL: "" },
					{EventID: 27, "Date": new Date(2009, 10, 6), "Title": "2009/2010 Youth Hunts at Greg Rodriguez/Calhan", URL: "" },
					{EventID: 28, "Date": new Date(2009, 10, 7), "Title": "2009/2010 Youth Hunts at Greg Rodriguez/Calhan", URL: "" },
					{EventID: 29, "Date": new Date(2009, 10, 8), "Title": "2009/2010 Youth Hunts at Greg Rodriguez/Calhan", URL: "" },
					{EventID: 30, "Date": new Date(2009, 10, 20), "Title": "2009/2010 Youth Hunts at Mostyn", URL: "" },
					{EventID: 31, "Date": new Date(2009, 11, 0), "Title": "2009/2010 Youth Hunts at Patio (exact date TBA)", URL: "" },
					{EventID: 32, "Date": new Date(2009, 11, 4), "Title": "2009/2010 Youth Hunts at Flo Jo", URL: "" },
					{EventID: 33, "Date": new Date(2009, 11, 5), "Title": "2009/2010 Youth Hunts at Flo Jo", URL: "" },
					{EventID: 34, "Date": new Date(2009, 11, 6), "Title": "2009/2010 Youth Hunts at Flo Jo", URL: "" },
					{EventID: 35, "Date": new Date(2010, 0, 1), "Title": "2009/2010 Youth Hunts at Indianhead", URL: "" },
					{EventID: 36, "Date": new Date(2010, 0, 2), "Title": "2009/2010 Youth Hunts at Indianhead", URL: "" },
					{EventID: 37, "Date": new Date(2010, 0, 3), "Title": "2009/2010 Youth Hunts at Indianhead", URL: "" },
					{EventID: 38, "Date": new Date(2009, 09, 29), "Title": "YP Grill & Chill", URL: "" },
					{EventID: 39, "Date": new Date(2009, 11, 1), "Title": "Early Bird Convention Registration Deadline - December 1, 2009. Prizes Drawn at Annual Christmas Party", URL: "../convention/" },
					{EventID: 40, "Date": new Date(2009, 10, 04), "Title": "Monthly Meeting - Adventures in Turkey with the Cunninghams and the Sadlers @ HESS Club ", URL: "monthlyMeetings/HSC meeting notice Nov 2009.doc" },
					
					{EventID: 41, "Date": new Date(2010, 06, 08), "Title": "Young Professionals Mixer - 6pm @ Amadillo Palace", URL: "" },
					{EventID: 42, "Date": new Date(2010, 06, 11), "Title": "HSC Evening at the Zoo & Jaguar Feeding 5:00 – 7:00 pm @ Houston Zoo", URL: "" },
					{EventID: 43, "Date": new Date(2010, 07, 04), "Title": "Convention Planning Meeting Committee Chairs Embassy Suites – Energy Corridor", URL: "" },
					{EventID: 44, "Date": new Date(2010, 07, 04), "Title": "Monthly Meeting: Hunting Cats with Gary & Will Ellison Embassy Suites – Energy Corridor", URL: "" },
					{EventID: 45, "Date": new Date(2010, 08, 01), "Title": "Monthly Meeting TBD Embassy Suites – Energy Corridor", URL: "" },
					{EventID: 46, "Date": new Date(2010, 08, 17), "Title": "Young Professionals Mixer - TBD", URL: "" },
					{EventID: 47, "Date": new Date(2010, 09, 06), "Title": "Monthly Meeting Gary Ingersoll Dr. James Derr Embassy Suites – Energy Corridor", URL: "" },
					{EventID: 48, "Date": new Date(2010, 06, 17), "Title": "Texas Hunting and Outdoors Expo (July 17-18) - Merrell Center & Robinson Pavilion – Katy [Saturday 9:00 - 3:00] ***Contact the HSC Office if you would like to volunteer for the Membership Booth***", URL: "http://www.texashuntingandoutdoorsexpo.com" },
					{EventID: 49, "Date": new Date(2010, 06, 18), "Title": "Texas Hunting and Outdoors Expo (July 17-18) - Merrell Center & Robinson Pavilion – Katy [Sunday 11:00 - 5:00] ***Contact the HSC Office if you would like to volunteer for the Membership Booth***", URL: "http://www.texashuntingandoutdoorsexpo.com" },
					{EventID: 50, "Date": new Date(2010, 07, 06), "Title": "TTHA Hunters Extravaganza (August 6 – 8) - Reliant Center – Houston [Friday 3:00 – 9:00] ***Contact the HSC Office if you would like to volunteer for the Membership Booth***", URL: "http://www.ttha.com/HuntersExtravaganza/tabid/70/Default.aspx" },
					{EventID: 51, "Date": new Date(2010, 07, 07), "Title": "TTHA Hunters Extravaganza (August 6 – 8) - Reliant Center – Houston [Saturday 9:00 – 7:00] ***Contact the HSC Office if you would like to volunteer for the Membership Booth***", URL: "http://www.ttha.com/HuntersExtravaganza/tabid/70/Default.aspx" },
					{EventID: 52, "Date": new Date(2010, 07, 08), "Title": "TTHA Hunters Extravaganza (August 6 – 8) - Reliant Center – Houston [Sunday 10:00 – 5:00] ***Contact the HSC Office if you would like to volunteer for the Membership Booth***", URL: "http://www.ttha.com/HuntersExtravaganza/tabid/70/Default.aspx" },
					{EventID: 53, "Date": new Date(2011, 02, 09), "Title": "Monthly Meeting: An Evening with John Banovich @ Embassy Suites – Energy Corridor", URL: "" },
					{EventID: 54, "Date": new Date(2011, 03, 06), "Title": "Monthly Meeting: \"Ladies Night at the High Desert Ranch\" with Larry Weishuhn, Nancy Ellison, Becky Simpson and Pug Mostyn @ Embassy Suites – Energy Corridor", URL: "" },
					{EventID: 55, "Date": new Date(2011, 03, 09), "Title": "<a href='mailto:herb@herbatkinson.com'>SCI Official Measurers Class - Contact Herb Atkinson to Register herb@herbatkinson.com</a>", URL: "" },
					{EventID: 56, "Date": new Date(2011, 03, 16), "Title": "Annual Crawfish Boil Hosted by the HSC Young Professionals @ Blanco's Bar & Grill", URL: "/files/crawfish_invitation.pdf" },
					{EventID: 57, "Date": new Date(2011, 04, 06), "Title": "Annual Sporting Clays Shoot Benefiting the HSC Hunting with Heroes Program @ Greater Houston Gun Club", URL: "" },
					{EventID: 58, "Date": new Date(2011, 05, 08), "Title": "Monthly Meeting: Craig Boddington @ Embassy Suites – Energy Corridor", URL: "" },
					{EventID: 59, "Date": new Date(2011, 08, 07), "Title": "Monthly Meeting: Hunting Chasse Libre in Cameroon with Cam Greig @ Embassy Suites – Energy Corridor", URL: "" },
					{EventID: 60, "Date": new Date(2011, 09, 05), "Title": "Monthly Meeting: Accomplished author and columnist Gayne Young @ Embassy Suites – Energy Corridor", URL: "" },
					{EventID: 61, "Date": new Date(2011, 10, 02), "Title": "Monthly Meeting: George Hartley on Tanzania @ Embassy Suites – Energy Corridor", URL: "" },
					{EventID: 62, "Date": new Date(2011, 11, 13), "Title": "Annual Christmas Party @ Cadillac Bar", URL: "" },
					{EventID: 63, "Date": new Date(2012, 0, 13), "Title": "2012 Sporting Expo & Convention New Horizons @ The Woodlands Waterway Marriott Hotel & Convention Center", URL: "http://www.houstonsafariclub.org/convention/" },
					{EventID: 63, "Date": new Date(2012, 0, 14), "Title": "2012 Sporting Expo & Convention New Horizons @ The Woodlands Waterway Marriott Hotel & Convention Center", URL: "http://www.houstonsafariclub.org/convention/" },
					{EventID: 63, "Date": new Date(2012, 0, 15), "Title": "2012 Sporting Expo & Convention New Horizons @ The Woodlands Waterway Marriott Hotel & Convention Center", URL: "http://www.houstonsafariclub.org/convention/" },
					];
    $.jMonthCalendar.Initialize(options, events);
//
var disclaimer = 'Attendees names must be received in HSC office by Dec 31, 2011. Table requests with less than 10 paid reservations will be assigned with other paid banquet attendees after Dec 31, 2011.<br/><br/>Full payment must accompany this form.<br/><br/>Payments for tickets are not deductible as charitable contributions for Federal Income Tax purposes. Such payments may be deductible as business expenses, depending upon the buyer\'s particular circumstances.';
$('.disclaimerNote').click(function(){
	$.modaldialog.success(disclaimer, { title: 'Terms and Conditions' });						  
				});
//
var disclaimerMembershipForm = '*Associate members must reside outside of the Greater Houston Area.<br/>*Lifetime Membership Payment Options:<br/>$1,400.00 single payment.<br/>$1,500.00 split out in 3 payments of $500 each (upon sign-up; end of 1st year; end of 2nd year).<br/>$1,500.00 split out in 12 equal credit card payments of $125 each.<br/>Dues may be deductible as business expenses but are not deductible as charitable donations for Federal Income Tax purposes. The non-deductible portion of your dues for the year is twenty-five percent.<br/>*Spousal, Associate &amp; Student memberships are not eligible to vote.';
$('.disclaimerMembershipFormNote').click(function(){
	$.modaldialog.success(disclaimerMembershipForm, { title: 'Terms and Conditions' });						  
				});
//

//

	$('#demotable').dataTable({
						
						//"aaSorting": [[ 0, "asc" ]],
						"bJQueryUI": true,
						"bStateSave": false,
						"sPaginationType": "full_numbers"


									  });
	//
	//
	/*
	$('#demotable1').dataTable({
						
						//"aaSorting": [[ 0, "asc" ]],
						"bJQueryUI": true,
						"bStateSave": false,
						"sPaginationType": "full_numbers"


									  });
	//
*/

//
$("#slider").easySlider({
	loop: true,
	autoplayDuration: '100',
	prevText: '[Previous]',
	nextText: '[Next]'
});
//
$('#loopedSlider').loopedSlider();
//
}); // end of document.ready - jQuery
//
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//	
//
function calculateExpo(price){
						var quant = $('#quant').val();
						//alert(quant);
						var totalExpo = quant*price;
						//alert(total);
						totalExpo = totalExpo.toFixed(2);
						$('#total').val(totalExpo); 
						//alert(quant.options[selectedIndex].value);
					}					
function calculateFriReg(price){
						var quant = $('#quant1').val();
						//alert(quant);
						var totalFriReg = quant*price;
						//alert(total);
						totalFriReg = totalFriReg.toFixed(2);
						$('#total1').val(totalFriReg); 
					}
function calculateFriStu(price){
						var quant = $('#quant2').val();
						//alert(quant);
						var totalFriStu = quant*price;
						//alert(total);
						totalFriStu = totalFriStu.toFixed(2);
						$('#total2').val(totalFriStu); 
					}
function calculateFriExh(price){
						var quant = $('#quant3').val();
						//alert(quant);
						var totalFriExh = quant*price;
						//alert(total);
						totalFriExh = totalFriExh.toFixed(2);
						$('#total3').val(totalFriExh); 
					}
function calculateSatReg(price){
						var quant = $('#quant4').val();
						//alert(quant);
						var totalSatReg = quant*price;
						//alert(total);
						totalSatReg = totalSatReg.toFixed(2);
						$('#total4').val(totalSatReg); 
						//alert(quant.options[selectedIndex].value);
					}
function calculateSatExh(price){
						var quant = $('#quant5').val();
						//alert(quant);
						var totalSatExh = quant*price;
						//alert(total);
						totalSatExh = totalSatExh.toFixed(2);
						$('#total5').val(totalSatExh); 
						//alert(quant.options[selectedIndex].value);
					}
function calculateIvory(price){
						var quant = $('#quant6').val();
						//alert(quant);
						var totalIvory = quant*price;
						//alert(total);
						totalIvory = totalIvory.toFixed(2);
						$('#total6').val(totalIvory); 
						//alert(quant.options[selectedIndex].value);
					}
function calculateLuncheon(price){
						var quant = $('#quant7').val();
						//alert(quant);
						var totalLuncheon = quant*price;
						//alert(total);
						totalLuncheon = totalLuncheon.toFixed(2);
						$('#total7').val(totalLuncheon); 
						//alert(quant.options[selectedIndex].value);
						//
					}
function calculateMemBreakfast(price){
						var quant = $('#quant8').val();
						//alert(quant);
						var totalMemBreakfast = quant*price;
						//alert(total);
						totalMemBreakfast = totalMemBreakfast.toFixed(2);
						$('#total8').val(totalMemBreakfast); 
						
						//alert(quant.options[selectedIndex].value);
					}
function calculateIvoryUpgrade(price){
						var quant = $('#quant9').val();
						//alert(quant);
						var totalIvoryUpgrade = quant*price;
						//alert(total);
						totalIvoryUpgrace = totalIvoryUpgrade.toFixed(2);
						$('#total9').val(totalIvoryUpgrade); 
						
						//alert(quant.options[selectedIndex].value);
					}
//
function getValue(){
	var total = Number($('#total').val());
	 total += Number($('#total1').val()); 
	 total += Number($('#total2').val()); 
	 total += Number($('#total3').val()); 
	 total += Number($('#total4').val()); 
	 total += Number($('#total5').val());
	 total += Number($('#total6').val());
	 total += Number($('#total7').val()); 
	 //total += Number($('#total8').val()); 
	 total += Number($('#total9').val()); 
	 total = total.toFixed(2);
	//alert(total1);
	$('#grandTotal').val(total);
}
//
