
//jQuery elements
$(document).ready(function(){
						   
//Global variables

//change hex for flash bg color (default=639CCE)
var flashBg="606037";
						   
//misc functions
	//Accessible Popups
	$('a[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
	
	//Hide div w/id extra
    $("#anatomy-of-a-tooth, #flash-know-your-teeth").css("display","none");
	//toggles anatomy of a tooth div
	$(".show-anatomy").click(function() {
		$("#anatomy-of-a-tooth").toggle("slow");								
	});
	
	$(".show-teeth").click(function() {
		$("#flash-know-your-teeth").toggle("slow");								
	});
	
	//toggle hidden form elements
	$("#Found").change(onSelectChange);
	
	//Hide div w/id extra
    $("#found-other").css("display","none");

	function onSelectChange(){  
		var selected = $("#Found option:selected");       
		if(selected.val() == 'Other'){  
            //show the hidden field
            $("#found-other").show("slow");
		} else {
			//otherwise, hide it 
            $("#found-other").hide("slow");		
		} 
	}  
	

//IE6 hover capability
  if (jQuery.browser.msie) {
    $('#nav li').hover(
      function() {
        $(this).addClass("sfhover");
      },
      function() {
        $(this).removeClass("sfhover");
      }
    );
  }

//flash embed

	//home page flash
	$('#flash-home').flash(
		{ 
		  src: 'flash/flash-home.swf',
		  width: 570,
		  height: 420,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);
	
	//luposello flash
	$('#flash-luposello').flash(
		{ 
		  src: 'flash/flash-luposello.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change item value to false to omit
			caption01: '',
			caption02: '',
			caption03: '',
			caption04: '',
			caption05: '',
			caption06: '',
			caption07: ''			
			}
		},
		{ version: 8 }
	);
	
	//marzban flash
	$('#flash-marzban').flash(
		{ 
		  src: 'flash/flash-marzban.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change item value to false to omit
			caption01: '',
			caption02: '',
			caption03: '',
			caption04: '',
			caption05: '',
			caption06: '',
			caption07: '',
			caption08: '',
			caption09: ''
			}
		},
		{ version: 8 }
	);
	
	//team
	$('#flash-team').flash(
		{ 
		  src: 'flash/flash-team.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change item value to false to omit
			caption01: '',
			caption02: '',
			caption03: '',
			caption04: '',
			caption05: '',
			caption06: '',
			caption07: '',
			caption08: '',
			caption09: '',
			caption10: ''
			}
		},
		{ version: 8 }
	);
	
	//events
	$('#flash-events').flash(
		{ 
		  src: 'flash/flash-events.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change item value to false to omit
			caption01: 'Baltimore Harbor',
			caption02: 'Marriot Ranch',
			caption03: 'The Bay',
			caption04: 'Obrycki\'s in Baltimore',
			caption05: 'Ranch',
			caption06: 'Virginia Beach',
			caption07: 'Racing',
			caption08: 'Summit Point',
			caption09: 'McLean Day',
			caption10: 'White Tail'
			}
		},
		{ version: 8 }
	);
	
	$('#flash-halloween').flash(
		{ 
		  src: 'flash/flash-halloween.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change item value to false to omit
			caption01: 'Willy Wonka',
			caption02: 'Sponge Bob',
			caption03: 'Simpsons',
			caption04: 'Under the Sea',
			caption05: 'Carnival',
			caption06: 'Decorating the office',
			caption07: 'Adams Family',
			caption08: 'Pirates of the Caribbean',
			caption09: 'Dr. Bob and Artemeez'
			}
		},
		{ version: 8 }
	);

//flash modules

	//brace painter
	$('#flash-brace-painter').flash(
		{ 
		  src: 'flash/brace-painter.swf',
		  width: 500,
		  height: 430,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);
	
	//braces diagram
	$('#flash-braces-diagram').flash(
		{ 
		  src: 'flash/braces-diagram.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			//see global variables at top for flash background color
			thisColor: '0x' + flashBg
		  }
		},
		{ version: 8 }
	);
	
	//brushing and flossing
	$('#flash-brushing-and-flossing').flash(
		{ 
		src: 'flash/brushing-and-flossing.swf',
		width: 500,
		height: 300,
		wmode: 'transparent',
		flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//see global variables at top for flash background color
			thisColor: '0x' + flashBg,
			//change item value to false to omit
			brushing: 'true',
			flossing: 'true'
			}
		},
		{ version: 8 }
	);
	
	//color your retainer
	$('#flash-color-your-retainer').flash(
		{ 
		  src: 'flash/color-your-retainer.swf',
		  width: 300,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//see global variables at top for flash background color
			thisColor: '0x' + flashBg
			}
		},
		{ version: 8 }
	);
	
	//common treatments
	$('#flash-common-treatments').flash(
		{ 
		src: 'flash/common-treatments.swf',
		width: 500,
		height: 300,
		wmode: 'transparent',
		flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//see global variables at top for flash background color
			thisColor: '0x' + flashBg,
			//change item value to false to omit
			crowding: 'true',
			openbite: 'true',
			deepOverbite: 'true',
			missing: 'true',
			underbite: 'true',
			spacing: 'true',
			overbite: 'true',
			nonBraces: 'true',
			phaseI: 'true'
			}
		},
		{ version: 8 }
	);
	
	//damon system
	$('#flash-the-damon-system').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 300,
		  height: 275,
		  wmode: 'transparent',
		  flashvars: { 
			//paths to skin & player
			FLVPath: 'the-damon-system.flv',
			SkinPath: 'video/SteelExternalAll.swf'
		  }
		},
		{ version: 8 }
	);
	
	//damon system comparison
	$('#flash-the-damon-system-comparison').flash(
		{ 
		  src: 'flash/the-damon-system-comparison.swf',
		  width: 250,
		  height: 165,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);
	
	//emergency care
	$('#flash-emergency-care').flash(
		{ 
		  src: 'flash/emergency-care.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
		  	//change value to false to pause on start
			autoPlay: 'false',
			//see global variables at top for flash background color
			thisColor: '0x' + flashBg,
			//change item value to false to omit
			pokingWire: 'true',
			bracket: 'true',
			looseWire: 'true',
			appliance: 'true',
			headgear: 'true',
			soreness: 'true'
		  }
		},
		{ version: 8 }
	);

// iBraces elements	
	//ibraces logo
	$('#flash-ibraces-logo').flash(
		{ 
		  src: 'flash/ibraces-logo.swf',
		  width: 200,
		  height: 135,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);
	
	//ibraces video 1
	$('#flash-ibraces-1').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 320,
		  height: 285,
		  wmode: 'transparent',
		  flashvars: { 
			//paths to skin & player
			FLVPath: 'ibraces-1.flv',
			SkinPath: 'video/SteelExternalAll.swf'
		  }
		},
		{ version: 8 }
	);
	
	//ibraces video 2
	$('#flash-ibraces-2').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 350,
		  height: 280,
		  wmode: 'transparent',
		  flashvars: { 
			//paths to skin & player
			FLVPath: 'ibraces-2.flv',
			SkinPath: 'video/SteelExternalAll.swf'
		  }
		},
		{ version: 8 }
	);
	
	//ibraces video 3
	$('#flash-ibraces-3').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 350,
		  height: 280,
		  wmode: 'transparent',
		  flashvars: { 
			//paths to skin & player
			FLVPath: 'ibraces-3.flv',
			SkinPath: 'video/SteelExternalAll.swf'
		  }
		},
		{ version: 8 }
	);
	
	//In-Ovation
	$('#flash-in-ovation').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 320,
		  height: 285,
		  wmode: 'transparent',
		  flashvars: { 
			//paths to skin &amp; player
			FLVPath: 'in-ovation.flv',
			SkinPath: 'video/SteelExternalAll.swf'
		  }
		},
		{ version: 8 }
	);
	
	//know your teeth
	$('#flash-know-your-teeth').flash(
		{ 
		  src: 'flash/know-your-teeth.swf',
		  width: 500,
		  height: 400,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);
	
	//office tour flash
	$('#flash-office-tour').flash(
		{ 
		  src: 'flash/office-tour.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change item value to false to omit
			caption01: '',
			caption02: 'Reception Area',
			caption03: '',
			caption04: '',
			caption05: 'Consultation Room',
			caption06: 'Operatory Room',
			caption07: '',
			caption08: ''
			}
		},
		{ version: 8 }
	);
	
	//patient care video
	$('#flash-patient-care').flash(
		{ 
		  src: 'video/flash-pt-care.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			//see global variables at top for flash background color
			thisColor: '0x' + flashBg
		  }
		},
		{ version: 8 }
	);
	
	//palatal expander
	$('#flash-palatal-expander').flash(
		{ 
		  src: 'flash/palatal-expander.swf',
		  width: 200,
		  height: 150,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);
	
	//smile gallery
	$('#flash-smile-gallery').flash(
		{ 
		src: 'flash/flash-smile-gallery.swf',
		width: 500,
		height: 300,
		wmode: 'transparent',
		flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//see global variables at top for flash background color
			thisColor: '0x' + flashBg,
			//change item value to false to omit
			bonding: 'true',
			bridges: 'true',
			crowns: 'true',
			fillings: 'true',
			implants: 'true',
			invisalign: 'true',
			veneers: 'true',
			whitening: 'true'
			}
		},
		{ version: 8 }
	);
	
	//suresmile video 1
	$('#flash-suresmile-1').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 320,
		  height: 285,
		  wmode: 'transparent',
		  flashvars: { 
			//paths to skin &amp; player
			FLVPath: 'suresmile-1.flv',
			SkinPath: 'video/SteelExternalAll.swf'
		  }
		},
		{ version: 8 }
	);
	
	//suresmile video 2
	$('#flash-suresmile-2').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 320,
		  height: 285,
		  wmode: 'transparent',
		  flashvars: { 
			//paths to skin & player
			FLVPath: 'suresmile-2.flv',
			SkinPath: 'video/SteelExternalAll.swf'
		  }
		},
		{ version: 8 }
	);
	
	//types of appliances
	$('#flash-types-of-appliances').flash(
		{ 
		src: 'flash/types-of-appliances.swf',
		width: 500,
		height: 300,
		wmode: 'transparent',
		flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//see global variables at top for flash background color
			thisColor: '0x' + flashBg,
			//change item value to false to omit
			elastics: 'true',
			headgear: 'true',
			palatal: 'true',
			positioners: 'true',
			retainers: 'true',
			separators: 'true'
			}
		},
		{ version: 8 }
	);
	
	//types of braces
	$('#flash-types-of-braces').flash(
		{ 
		src: 'flash/types-of-braces.swf',
		width: 500,
		height: 300,
		wmode: 'transparent',
		flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//see global variables at top for flash background color
			thisColor: '0x' + flashBg,
			//change item value to false to omit
			metal: 'true',
			gold: 'true',
			ceramic: 'true',
			invisible: 'true',
			lingual: 'true'
			}
		},
		{ version: 8 }
	);
	




var flashVideos = {
	
		defaults: {
		  // Define the configuation values applied to each module.
		  // Each module in flashModules can override these values.
		  
		  src: 'video/flvPlayer.swf',
		   dir: 'http://media.sesamehost.com/video/',//location of video and image files
		  width: 320,
		  height: 266,
		  wmode: 'transparent',
		  menu: false,
		  allowFullScreen: true,
		  flashvars: {
		    autoStart: "false", // change value to true to play on start
		    showScaleModes: "false", //set to false to disable scale modes menu
		    smoothVideo: "true", //set to false to disable video smoothing 
		  	hiddenGui: "false"
			},
		  pluginOptions: {version: 9}
		},
	
		videos: [
			{name: 'invisalign', 
								config: {
									//dir: 'video/',//override location of video and image file
									'width': 360
								}
							},{name: 'invisalign-best-friends', config: {'width': 320, 'height': 206}},
{name: 'invisalign-news-travels-fast', config: {'width': 320, 'height': 206}},
{name: 'invisalign-lobby', config:{}}
			
		]
	};
	for (var j=0; j < flashVideos.videos.length; j++) {
						var video = flashVideos.videos[j];
						// combine default config settings with module config settings
						var vidConfig = $.extend({}, flashVideos.defaults, video.config);
						// combine default flashvars with module flashvars
						vidConfig.flashvars = $.extend({}, flashVideos.defaults.flashvars, video.config.flashvars);
						vidConfig.flashvars.flvToPlay = vidConfig.dir + video.name + '.flv';
						vidConfig.flashvars.startImage = vidConfig.dir + video.name + '.jpg';
						$('#video-' + video.name).flash(vidConfig, flashVideos.defaults.pluginOptions);
	};
	
	//PrettyPhoto modal windows
//---------------------------------------------------------------------------------
$("a[rel^='prettyPhoto']").prettyPhoto({
animationSpeed: 'normal', /* fast/slow/normal */
default_width: 900,
default_height: 700,
opacity: 0.65, /* Value betwee 0 and 1 */
showTitle: false, /* true/false */
allowresize: true, /* true/false */
counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
theme: 'facebook', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
wmode: 'transparent', /* Set the flash wmode attribute */
autoplay: true, /* Automatically start videos: True/False */
modal: false /* If set to true, only the close button will close the window */
}); 

// jQuery Cycle Before and After //-------------------------------------------------
$('#before-after-cycle') // Give this ID a unique name if more than one office tour is needed on a page
.before('<div class="before-after-nav">') // Ditto for this ID
.cycle({
cleartype: true, // true if clearType corrections should be applied (for IE)
cleartypeNoBg: true, // Set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
speed: 500, // This controls speed of transition
timeout: 0, // This controls delay between slides. Set to 0 if more than one office tour on a page, so they don't auto-play
pager: '.before-after-nav',
before: function() {
$('.cycle-detail span').fadeOut(); // Give this ID a unique name if more than one office tour is needed on a page
},
after: function(curr, next, opts) {
var cycle_alt = $(next).find('img').attr('alt'); // This grabs the image alt text
$('.cycle-detail span').html(cycle_alt).fadeIn(); // This puts alt text into the caption span
}
}); 




//games
	$("a.asteroids").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/asteroids.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.frogger").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/frogger.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});	$("a.pong").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/pong.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.simon").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/simon.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.snake").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/snake.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.space-invaders").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/space-invaders.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.tetris").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/tetris.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	$("a.tic-tac-toe").click(function() {
		$('#sesame-game').flash(
			{ 
			  src: 'games/tic-tac-toe.swf',
			  width: 400,
			  height: 300,
			  wmode: 'transparent'
			},
			{ version: 8 }
		);
	});
	
	// Make rel="external" open links in new windows
	$('a[rel^="external"]').addClass('external').attr('target', '_blank');
	
});//end document.ready