
//IE Hover Capability
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


//jquery flash

$(document).ready(function(){
//JQuery Setup

//misc functions
	//hide items ith class="hidden"
	$('.hidden').css("display","none");

// PNG Fixer Upper
	$(document).pngFix()

//Accessible Popups
	$('a[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });
	
	//clear form fields
	$('.clearme').one("focus", function() {
  		$(this).val("");
	});

//fancybox
	//Damon Media Center
	$("a#damon_swf").fancybox({
		'zoomSpeedIn':	500, 
		'zoomSpeedOut':	500,
		'frameWidth': 300,
		'frameHeight': 275, 
		'overlayShow':	true
	});
	$("a#damon_presentation").fancybox({
		'zoomSpeedIn':	500, 
		'zoomSpeedOut':	500,
		'frameWidth': 980, 
		'frameHeight': 640, 
		'overlayShow':	true
	});

	//iBraces Media Center
	$("a#ibraces-1, a#ibraces-2, a#ibraces-3").fancybox({
		'zoomSpeedIn':	500, 
		'zoomSpeedOut':	500,
		'frameWidth': 350,
		'frameHeight': 300, 
		'overlayShow':	true
	});

	//office tour
	$("a#hermitage").fancybox({
		'itemLoadCallback': getGroupItemsHermitage,
		'zoomSpeedIn':	500, 
		'zoomSpeedOut':	500,
		'overlayShow':	true

	});
	$("a#map_hermitage").fancybox({
		'zoomSpeedIn':	500, 
		'zoomSpeedOut':	500,
		'frameWidth': 425,
		'frameHeight': 350, 
		'overlayShow':	true
	});

	//List can contain mixed media too
	//Parameter "o" ir optional and used to override settings, example: {url: "http://www.google.com", title: false,  o: {'frameWidth': 200} }
	
	//hermitage
	var imageListA = [
		{url: "images/hermitage-exterior.jpg", title: "Welcome to Our Hermitage Office"},
		{url: "images/hermitage-lobby.jpg", title: "The Lobby"},
		{url: "images/hermitage-consultation-room.jpg", title: "The Consultation Room"},
		{url: "images/hermitage-treatment-clinic.jpg", title: "The Treatment Clinic"}
	];
	function getGroupItemsHermitage(opts) {
		jQuery.each(imageListA, function(i, val) {
			opts.itemArray.push(val);
		});
	}
	//lebanon office tour
	var imageListB = [
		{url: "images/lebanon-exterior.jpg", title: "Welcome to Our Lebanon Office"},
		{url: "images/lebanon-lobby.jpg", title: "The Lobby"},
		{url: "images/lebanon-consultation-room.jpg", title: "The Consultation Room"},
		{url: "images/lebanon-treatment-clinic.jpg", title: "The Treatment Clinic"}
	];
	function getGroupItemsLebanon(opts) {
		jQuery.each(imageListB, function(i, val) {
			opts.itemArray.push(val);
		});
	}
	
	//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("fast");
		} else {
			//otherwise, hide it 
            $("#found-other").hide("fast");		
		} 
	}  

//flash embed


	//home page flash
	$('#flash-home').flash(
		{ 
		  src: 'flash-home.swf',
		  width: 360,
		  height: 370,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);

//flash modules

	//office tour
	$('#flash-office-tour').flash(
		{ 
		src: 'office-tour.swf',
		width: 500,
		height: 375,
		wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change hex color (default=639CCE)
			thisColor: '0x' + '323481',
			//change item value to false to omit
			caption01: 'Office Exterior',
			caption02: 'Waiting Area',
			caption03: 'Oral Care Shelf'
			}
		},
		{ version: 8 }
	);

	//before-and-after
	$('#flash-before-after').flash(
		{ 
		src: 'before-after.swf',
		width: 500,
		height: 375,
		wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change hex color (default=639CCE)
			thisColor: '0x' + '323481',
			//change item value to false to omit
			caption01: 'Patient: Brenton',
			caption02: 'Patient: Jordan',
			caption03: 'Patient: Miranda',
			caption04: 'Patient: Robert',
			caption05: 'Patient: Tiffany',
			caption06: 'Patient: Violet'		  
			}
		},
		{ version: 8 }
	);
	//brushing-flossing
	$('#flash-brushing-and-flossing').flash(
		{ 
		src: 'brushing-and-flossing.swf',
		width: 500,
		height: 300,
		wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change hex color (default=639CCE)
			thisColor: '0x' + '323481',
			//change item value to false to omit
			brushing: 'true',
			flossing: 'true'
		  }
		},
		{ version: 8 }
	);
		
	//types of braces
	$('#flash-types-of-braces').flash(
		{ 
		  src: 'types-of-braces.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change hex color (default=639CCE)
			thisColor: '0x' + '323481',
			//change item value to false to omit
			metal: 'true',
			gold: 'false',
			ceramic: 'true',
			invisible: 'true',
			lingual: 'true'
		  }
		},
		{ version: 8 }
	);
		
		
	//common treatments
	$('#flash-common-treatments').flash(
		{ 
		  src: 'common-treatments.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change hex color (default=639CCE)
			thisColor: '0x' + '323481',
			//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 }
	);
	
	//palatal expander
	$('#flash-palatal-expander').flash(
		{ 
		  src: 'palatal-expander.swf',
		  width: 200,
		  height: 150,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);
	
	//braces diagram
	$('#flash-braces-diagram').flash(
		{ 
		  src: 'braces-diagram.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			//change hex color (default=639CCE)
			thisColor: '0x' + '323481'
		  }
		},
		{ version: 8 }
	);
	
	//brace painter
	$('#flash-brace-painter').flash(
	  { 
		src: 'brace-painter.swf',
		width: 500,
		height: 430,
		wmode: 'transparent'
	  },
	  { version: 8 }
	);
	
	//Emergency care 
	$('#flash-emergency-care').flash(
		{ 
		  src: 'emergency-care.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			//change value to false to pause on start
			autoPlay: 'false',
			//change hex color (default=639CCE)
			thisColor: '0x' + '323481',
			//change item value to false to omit
			pokingWire: 'true',
			bracket: 'true',
			looseWire: 'true',
			appliance: 'true',
			headgear: 'true',
			soreness: 'true'
		  }
		},
		{ version: 8 }
	);
	

	//iBraces
	
	$('#flash-ibraces-1').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 350,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { FLVPath: 'ibraces-1.flv', SkinPath: 'video/SteelExternalAll.swf' }
		},
		{ version: 9 }
	);
	$('#flash-ibraces-2').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 350,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { FLVPath: 'ibraces-2.flv', SkinPath: 'video/SteelExternalAll.swf' }
		},
		{ version: 9 }
	);
	$('#flash-ibraces-3').flash(
		{ 
		  src: 'video/flv-player.swf',
		  width: 350,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { FLVPath: 'ibraces-3.flv', SkinPath: 'video/SteelExternalAll.swf' }
		},
		{ version: 9 }
	);

	//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 }
		);
	});

});//end document.ready


