// SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
// -----------------------------------------------------------------------
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

// SUCKERFISH Single-level Dropdowns SCRIPT (http://www.htmldog.com/articles/suckerfish/dropdowns/)
// -----------------------------------------------------------------------

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"), "");
		}
	}
}



// ORAL CARE VIDEO
// -----------------------------------------------------------------------
function oralCareVideo() { newWindow = window.open('http://www.orthosesame.com/ptcare-video/video/choice.html','','scrollbars=no,resizable=no,width=500,height=500,left=10,top=10');}

// ORAL CARE VIDEO
// -----------------------------------------------------------------------
function invisalignVideo() { newWindow = window.open('flash/flv-player.html','','scrollbars=no,resizable=no,width=360,height=350,left=10,top=10');}



//JQuery Setup
$(function(){ 
		   // 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
}
}); 
		   
		   }

);

$(document).ready(function(){
// Make rel="external" open links in new windows
$('a[rel^="external"]').addClass('external').attr('target', '_blank');
});

//-- Sesame Design Global JavaScript --// 
//-- Created January 25th 2010 --//
//----------------------------------------//
//-- All plugin/jquery function additions should be added in the below format, within the 'globalLib' var, then initialized after the jQuery $(function(){
//
//		 	,COMMON_NAME_OF_LIBRARY_ITEM_TO_BE_INITIALIZED :
//			{
//				init : function()
//				{
//					YOUR CODE HERE
//				}
//			} -----Add comma here only if you add more rules; the last rule should not have a comma here	 

var globalLib =
{
//Google Analytics
//---------------------------------------------------------------------------------
	analytics :
	{
		init : function()
		{
			$.xLazyLoader({
				js: 'http://2.scripts.sesamehost.com/scripts/jGoogleAnalytics.min.js',
				name: 'jGoogleAnalytics',
				success: function() {
					//Google Analytics 
					$.jGoogleAnalytics(
						'', // Your GA tracker code
						{
							anchorClick: true, // adds click tracking to *all* anchors
							domainName: 'domain.com', // e.g. 'domain.com'
							pageViewsEnabled: true // can be disabled e.g. if only tracking e.g. click events
						}
					);
				}
			});
		}//end init
	}//end analytics

//preload css images
//---------------------------------------------------------------------------------
	,cssImage_preload :
	{
		init : function()
		{
			$.xLazyLoader({
			    js: 'http://15.scripts.sesamehost.com/scripts/jquery.preloadCssImages.min.js',
			    name: 'preloadCssImages',
			    success: function(){
			        $.preloadCssImages();
			    }
			});
		
		}//end init
	}//end image preloader
	
//Form Validation
//---------------------------------------------------------------------------------
	,form_validation :
	{
		init : function()
		{
			//Hide all items with class of "hidden-content"
			$('.hidden-content').css('display', 'none');
			
			//Sequential numbering of comment form li's
			$(".sequential-list li").each( function(i) {
			    i = i+1;
			    $(this).prepend('<span class="comment-number">' + i + '. </span>');
			});
			
			//toggle hidden fields on Appointment Request Form
			//New Patient Toggle...
			$("input[name^='Current_Patient']").click( function() {
				 if ($("input[name^='Current_Patient']:checked").val() == 'No')
				 	//not current patient, ask where they found us
				 	$('.hidden-content').fadeIn('slow');
				else 
					//current patient, hide content
					$('.hidden-content').fadeOut();
						if($('#found-other').css('display') != 'none') {
							$('#found-other').fadeOut();
						}
			});
			//Where did you hear about us toggle 
			$('#Found').change(function() {
				var selected = $('#Found option:selected');
				if(selected.val() == 'Other') {
					$('#found-other').fadeIn('slow');
				} else {
					$('#found-other').fadeOut();
				}
			});  
		
			//Comment form "May We Contact You" toggle
			$("input[name^='Contact_Me']").click( function() {
				 if ($("input[name^='Contact_Me']:checked").val() == 'Yes')
				 	//not current patient, ask where they found us
				 	$('.hidden-content')
				 		.fadeIn('slow');
				else 
					//current patient, hide content
					$('.hidden-content').fadeOut().find('input').val("");
			});
		
			//Referral form "Radiographs Sent" toggle
			$("input[name^='Radiographs_Sent']").click( function() {
				 if ($("input[name^='Radiographs_Sent']:checked").val() == 'Yes')
				 	//not current patient, ask where they found us
				 	$('.hidden-content')
				 		.fadeIn('slow');
				else 
					//current patient, hide content
					$('.hidden-content').fadeOut().find('input').val("");;
			});
			
			//clear form fields with "clearme" class when clicked
			$('.clearme').one("focus", function() {
					$(this).val("");
			});
		
			//add red asterisk to label of required fields
			$('label.required').each(function(i) {
				$(this).append('<em> * </em>');
			});
			
			
			//Form validation
			//---------------------------------------------------------------------------------
			$.xLazyLoader({
				js: ['http://20.scripts.sesamehost.com/scripts/jquery.validate.js',
					'http://13.scripts.sesamehost.com/scripts/jquery.maskedinput-1.2.2.min.js'],
				name: 'validate',
				success: function(){
					//masked input
					$(".date-mask").mask("99/99/9999");
					$(".phone-mask").mask("(999) 999-9999");
				
					//additional validation methods
					$.validator.addMethod("phone", function(phone_number, element) {
					    phone_number = phone_number.replace(/\s+/g, ""); 
						return this.optional(element) || phone_number.length > 9 &&
							phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
					}, "Please specify a valid phone number");
				
					//validator
					$("#bd form.validate").each(function() {
						$(this).validate({errorElement: "div",
							errorClass: "error",
							validClass: "success",
							success: function(label) {label.text("ok!").addClass("success");},
							rules: {
								First_Name: 					{required:true,minlength:2},
								Last_Name: 						{required:true,minlength:2},
								Doctor_First_Name: 				{required:true,minlength:2},
								Doctor_Last_Name: 				{required:true,minlength:2},
								Patient_First_Name: 			{required:true,minlength:2},
								Patient_Last_Name: 				{required:true,minlength:2},
								Patient_Email: 					{required:true,email:true},
								Referred_Patient_First_Name:	{required:true,minlength:5},
								Referred_Patient_Last_Name: 	{required:true,minlength:5},
								Doctor_Patient_Referring: 		{required:true,minlength:5},
								Doctor_Email: 					{required:true,email:true},
								Appointment_Email: 				{required:true,email:true},
								Daytime_Phone: 					{required:true,phone:true},
								Alternate_Phone: 				{phone:true},
								Patient_Phone: 					{required:true,phone:true},
								Message: 						{required:true,minlength:12},
								Would_Like_To: 					{required:true},
								Patient_Name: 					{required:"#Contact_Me_Yes:checked",minlength:5},
								Email: 							{required:"#Contact_Me_Yes:checked",email:true},
								txtNumber: 						{required:true,minlength: 5}
							}
						});
					});
				}
			});
		}//end form init()
		
	}//end form validation
	

//PrettyPhoto modal windows
//---------------------------------------------------------------------------------
	,modal_windows :
	{
		init : function() 
		{
			/*gets plugin then runs function*/
			$.xLazyLoader({
			    js: 'http://16.scripts.sesamehost.com/scripts/jquery.prettyPhoto.2.5.6.js',
			    css: 'css-main/prettyPhoto.css',
			    name: 'prettyPhoto',
			    success: function(){
					$("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: 'dark_rounded', 			/* 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 */
					});    
				}
			});
					
		}//end modal init
	}//end modal windows
	
// Standard Flash and video Modules
//-------------------------------------------------------------------------------
	,flash_functions :
	{
		init : function()
		{
			/* setup dynamic loading */	
			$.xLazyLoader({
			    js: 'http://8.scripts.sesamehost.com/scripts/jquery.flash_1.3.js',
			    name: 'flash',
			    success: function(){
					// Define the default configuation values
					// followed by individual module configuration.
					// Values for individual modules will override the defaults
					
					var flashModules = {
						
						defaults: {			
							'width': 500,
							'height': 300,
							'src': 'http://media.sesamehost.com/flash/',//default location of all Sesame flash mods
							'wmode': 'transparent',
							'flashvars': {
								'autoPlay': 'false', // change value to 'true'to play on start
								'thisColor': '0x' + '639CCE' // change global hex color (default=639CCE)
							},
							'express': 'flash/playerProductInstall.swf',
							'version':'9'
						},
					
					modules: [
					  // Define the configuration values for each flash module.
					  // Change item values in any 'flashvars' section to false to omit,
					  // Add any value to override the default value in flashModuleDefaults.
					  
					  {name: 'homepage', 
					  	config: {
					  		'src':'flash/',//uses local location; default is media.sesamehost.com
					  		'width':540, 
					  		'height':227
					  	}
					  },
					  {name: 'braces-diagram', config: {'height': 375}},
					  {name: 'brace-painter', config: {'height': 430, 'wmode':'opaque'}},
					  
					  	
					  {name: 'brushing-and-flossing-ortho',
					    config: {
					      'flashvars': {
					        'brushing': 'true',
					        'flossing': 'true'
					      }
					    }
					  },
					  {name: 'brushing-and-flossing-dental',
					    config: {
					      'flashvars': {
					        'brushing': 'true',
					        'flossing': 'true'
					      }
					    }
					  },
					  
					  {name: 'color-your-retainer', 
					  	config: {
					  		'width': 300, 
					  		'height': 300, 
					  		'flashvars': {
					  			'autoPlay': 'true'
					  		}
					  	}
					  },
					  
					  {name: 'common-treatments',
					    config: {
					      'flashvars': {
					        'crowding': 'true',
					        'openbite': 'true',
					        'deepOverbite': 'true',
					        'missing': 'true',
					        'underbite': 'true',
					        'spacing': 'true',
					        'overbite': 'true',
					        'nonBraces': 'true',
					        'phaseI': 'true'
					      }
					    }
					  },
					  
					  {name: 'the-damon-system-comparison', config: {'width':250, 'height':165, 'wmode':'opaque'}},
					  
					  //old emergency care module
					  {name: 'emergency-care',
					    config: {
					      'flashvars': {
					        'pokingWire': 'true',
					        'bracket': 'true',
					        'looseWire': 'true',
					        'appliance': 'true',
					        'headgear': 'false',
					        'soreness': 'true'
					      }
					    }
					  },
					  
					  // Individual Emergency Care Animations //-----------------------------------------------
					  {name: 'general-soreness', config: {'width': 200, 'height': 150}},
					  {name: 'headgear', config: {'width': 200, 'height': 150}},
					  {name: 'loose-appliance', config: {'width': 200, 'height': 150}},
					  {name: 'loose-bracket', config: {'width': 200, 'height': 150}},
					  {name: 'loose-wire', config: {'width': 200, 'height': 150}},
					  {name: 'poking-wire', config: {'width': 200, 'height': 150}},
  					  // End of animations
					  
					  {name: 'ibraces-logo', config: {'width':200, 'height':135, 'wmode':'opaque'}},
					  
					  {name: 'know-your-teeth', 
					  	config: {'width':500, 'height':400}},
					  
					  {name: 'office-tour',
					    config: {'width':500, 'height':375, 'wmode':'opaque',
						  'flashvars': { 
							'caption01': '',
							'caption02': 'Entry way',
							'caption03': 'Reception area',
							'caption04': 'Coffee tables and chairs',
							'caption05': 'Coffee bar',
							'caption06': 'Family waiting room',
							'caption07': 'Adult waiting room',
							'caption08': 'Game room',
							'caption09': 'Exam and consultation room',		  
							'caption10': 'Records room',		  
							'caption11': 'X-ray room',
							'caption12': 'Sterilization area',
							'caption13': 'Brushing area',
							'caption14': 'Open treatment bay',
							'caption15': '',
							'caption16': ''		  
					      }	  
					    }
					  },
					
					  {name: 'palatal-expander', config: {'width': 200, 'height': 150}},
					  {name: 'patient-care', 
					  	config: {
					  		'src':'flash/',//uses local location; default is media.sesamehost.com
					  		'height': 375
					  	}
					  },
					
						{name: 'smile-gallery',
					    config: {
					      'flashvars': {
					        'bonding': "true",
					        'bridges': "true",
					        'crowns': "true",
					        'fillings': "true",
					        'implants': "true",
					        'invisalign': "true",
					        'veneers': "true",
					        'whitening': "true"
					      }
					    }
					  },
					  
					  {name: 'types-of-appliances',
					    config: {
					      'flashvars': {
					        'elastics': 'true',
					        'headgear': 'true',
					        'herbst': 'true',
					        'palatal': 'true',
					        'positioners': 'false',
					        'separators': 'true'
					      }
					    }
					  },
					  
					  {name: 'types-of-braces',
					    config: {
					      'flashvars': {
					        'metal': 'true',
					        'gold': 'false',
					        'ceramic': 'true',
					        'invisible': 'true',
					        'lingual': 'false'
					      }
					    }
					  }
					]
					};
					
					// Loop through the defined modules 
					// and do flash replacement for any that are on the current page
					for (var j = flashModules.modules.length - 1; j >= 0; j--){
						var module = flashModules.modules[j];
						// combine default config settings with individual module config settings
						var modConfig = $.extend({}, flashModules.defaults, module.config);
						// combine default flashvars with module flashvars
						modConfig.flashvars = $.extend(flashModules.defaults.flashvars, module.config.flashvars);
						modConfig.src = modConfig.src + module.name + '.swf';
						$('#flash-' + module.name).flash(modConfig);
					}
					
					// Flash Video functions
					//-------------------------------------------------------------------------------
					
					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 
						  }
						},
					
						videos: [
							{name: 'invisalign-best-friends', config: {'width': 320, 'height': 206}},
							{name: 'invisalign-news-travels-fast', config: {'width': 320, 'height': 206}},
							{name: 'invisalign-lobby', config:{}},
							{name: 'the-damon-system',config:{'width': 240, 'height': 206}},
							{name: 'the-damon-system-2',config:{'width': 400, 'height': 330}},
							{name: 'in-ovation',config:{}},
							{name: 'opalescence', config: {'width': 400, 'height': 251}},
							{name: 'invisalign', 
								config: {
									//dir: 'video/',//override location of video and image file
									'width': 360
								}
							},
							{name: 'suresmile', config: {'height': 206}},
							{name: 'suresmile-robot', config: {'height': 242, flashvars: {startImage: 'none', autoStart: 'true'}}}
						]
					};
					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);
					};
			    }
			});
		
		}//end flash init
	}//end flash functions
	

// Game room
//-------------------------------------------------------------------------------
	,games :  
	{
		init : function()
		{
			//Partial Sliding (Only show some of background)  
			$('ul#sesame-games li').hover(function(){  
			    $(".cover", this).stop().animate({top:'36px'},{queue:false,duration:160});  
			}, function() {  
			    $(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});  
			});  
		}//end games init
	}//end games
	

//Basic HTML and utility functions
//---------------------------------------------------------------------------------
	,html_functions :
	{
		init : function() 
		{
			// Some effects rely on an element to be initially hidden,
			// but we only hide them if the user has javascript
			$('.jshide').addClass('hide');

			//prepend "More in this Section" to sub_nav
			//$('p.sub_nav').prepend('<strong>More in this section: </strong>');
			
			// Open external links in new windows
			$('a[href^="http://"], a[href^="https://"]')
				.not('[href*="orthosesame.com"],[href*="sesameinteractive.com"],[href*="drsnow.com"], a[href$=".doc"], a[href$=".pdf"]')
				.addClass('external').attr('target', '_blank');
			
			// Open pdf links in new windows + add icon
			$('a[href$=".pdf"]').attr('target', '_blank').not('[class*="noicon"]').append('<span/>').addClass('pdf');
			
			// Open M$ doc links in new windows + add icon
			$('a[href$=".doc"]').attr('target', '_blank').not('[class*="noicon"]').append('<span/>').addClass('doc');
		
			// add icons to links which open in prettyPhoto
			$("a[rel^='prettyPhoto[flash]']").parent('li').append('<span/>').addClass('video-link');
		
		 
			//Ordered List Style
			$('ol.alpha, ol.numeric').addClass('js');
			$("ol li").each(function (i) {
			    $(this).wrapInner('<span/>');
		    });
		    
		    //fancy Q & A
		    $('ul.q-and-a li').each( function() {
		    	$(this).find('h2,h4,h3').prepend('<span>Q: </span>');
		    	$(this).find('div').prepend('<span>A: </span>');
			});

			//Toggle functions
			//---------------------------------------------------------------------------------
			// Show only when javascript is available
			$('#toggle-links').css('display','block');
			
			//hide lists first!
			$('#toggle-content dl').hide();
			
			//toggle
			function toggleInfoContent(id){
				if($(id).css('display') != 'none'){
				  $(id).fadeOut('fast');
		  		  $('.back-to-top').addClass('hide');
				}else{
				  $('#toggle-content dl').fadeOut('fast');
				  $(id).fadeIn('slow');
				  $('.back-to-top').removeClass('hide');
				}
			}
			$("#toggle-links").bind('click', function(e) {
				var target = e.target, // e.target grabs the node that triggered the event.
				$target = $(target);  // wraps the node in a jQuery object
				var id = $target.attr('href')
			    if (target.nodeName === 'A') {
			    	toggleInfoContent(id);
				}
			    return false;
			});
			
			// Emergency Care toggle //----------------------------------
			//hide items first!
			$('#toggle-emergency div p').hide();
			//toggle
			function toggleEmergency(id){
				if($(id).css('display') != 'none'){
					$(id).animate({opacity: 'toggle'}).parent().animate({width: '80px',height: '60px'});
				}else{
					$(id).animate({opacity: 'toggle'}).parent().animate({width: '200px',height: '150px'});
				}
			}
			$("a.toggle-div").bind('click', function(e) {
				var target = e.target, // e.target grabs the node that triggered the event.
				$target = $(target);  // wraps the node in a jQuery object
				var id = $target.attr('href')
				if (target.nodeName === 'A') {
					toggleEmergency(id);
				}
				return false;
			});
			//end toggle functions
			
			
	
			//Back to top
			if ($('#content').height() > $(window).height()) {
				$('.back-to-top').removeClass('hide');
			}
			
			//pt/dr login tooltip functions
			$('#pt-login-form a, #dr-login-form a').bind('mouseover', function(e){
				var target = e.target, // e.target grabs the node that triggered the event.
					$target = $(target);  // wraps the node in a jQuery object
					$target.animate({opacity: '.65'}, 400).bind('mouseout', function() {
						$target.animate({opacity: '1'}, 400);
					});
			});

			//fade sidebar callouts
			$('#sidebar img').hover( function() {
				$(this).animate({opacity: '.65'}, 400);
			}, function() {
				$(this).animate({opacity: '1'},400);
			});
		}//end HTML init
	}//end HTML functions


// slideshows	
//-------------------------------------------------------------------------------
	,gallery_view_tour :
	{
		init : function()
		{
			// jQuery GalleryView Office Tour //----------------------------------------------
			$.xLazyLoader({
			    js: ['http://11.scripts.sesamehost.com/scripts/jquery.galleryview-2.0.js',
			    	'http://7.scripts.sesamehost.com/scripts/jquery.easing.1.3.js',
			    	'http://19.scripts.sesamehost.com/scripts/jquery.timers-1.1.2.js'],
			    name: 'galleryView',
			    success: function(){
			    	//customize me
					$('#gallery').galleryView({
						panel_width: 460,
						panel_height: 350,
						frame_width: 80,
						frame_height: 60,
						transition_speed: 600,
						easing: 'easeInOutBack',
						transition_interval: 0,
						nav_theme: 'dark'
					});
					//end
			    }
		});

		}//end slideshow init
	}//end gallery view tour
	
// jQuery Cycle Office Tour //----------------------------------------------------
	,cycle_tour :
	{
		init : function()
		{
			// jQuery cycle slideshow
			$.xLazyLoader({
			    js: 'http://6.scripts.sesamehost.com/scripts/jquery.cycle.2.81.all.min.js',
			    name: 'cycleTour',
			    success: function(){
					// jQuery Cycle Plugin
					$('ul.slideshow').cycle({
						pause: true,
						wmode: 'transparent'
					});
				
					// Duplicate the following block of code to add extra office tours
					$('#cycle-office-tour') // Give this ID a unique name if more than one office tour is needed on a page
					.before('<div class="office-tour-nav" id="office-1">') // 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: 5000, // This controls delay between slides. Set to 0 if more than one office tour on a page, so they don't auto-play
						pager:  '#office-1',
						before: function() {
							$('#caption 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 alt = $(next).find('img').attr('alt'); // This grabs the image alt text
							$('#caption span').html(alt).fadeIn(); // This puts alt text into the caption span
						}
					});
				}
			});
		
		}//end init
	}//end cycle tour

// jQuery Cycle Slideshow (homepage) //----------------------------------------------------
	,cycle_slideshow :
	{
		init : function()
		{
			// jQuery cycle slideshow
			$.xLazyLoader({
			    js: 'http://6.scripts.sesamehost.com/scripts/jquery.cycle.2.81.all.min.js',
			    name: 'cycleSlideshow',
			    success: function(){
					//Home Page Slideshow 
					var $ss = $('#slideshow-home'); 
				         
				    // add slides to slideshow (images 2-8) 
				    for (var i = 1; i < 11; i++) 
				        $ss.append('<img src="images/photos/slide'+i+'.png" width="872" height="162" alt="slide" />'); 
				 
				    // start the slideshow 
				    $('#slideshow-home img:first').fadeIn(1000, function() {
					    $ss.cycle({
					    	random:	1,
					        fx:     'turnDown',
					        speed:   '1000',
					        timeout: 7000
					    });
					});
			    }
			});
		}//end slideshow init
	}//end cycle slideshow

	
// jQuery Cycle Before and After //-------------------------------------------------
	,cycle_before_after :
	{
		init : function() 
		{
			$.xLazyLoader({
			    js: 'http://6.scripts.sesamehost.com/scripts/jquery.cycle.2.81.all.min.js',
			    name: 'cycleBeforeAfter',
			    success: function(){
			    	//customize me
					$('#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
						}
					});
					//end
				}
			});
		}//end init
	}//end cycle before/after
	
// jQuery Before After Slider //-------------------------------------------------------
	,slider_before_after : 
	{
		init : function()
		{	
			$.xLazyLoader({
			    js: ['http://6.scripts.sesamehost.com/scripts/jquery.cycle.2.81.all.min.js',
			    	'http://3.scripts.sesamehost.com/scripts/jquery.beforeafter.js'],
			    name: 'sliderBeforeAfter',
			    success: function(){
			    	//customize me
					$('.before-after-slider').beforeAfter({
						animateIntro : false,
						showFullLinks : false
					});
					
					// Cycle plugin added to above Slider
					$('#slider-cycle')
					.before('<div class="slider-nav">')
					.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:  '.slider-nav',
						before: function() {
							$('.slider-detail span').fadeOut(); // Give this ID a unique name if more than one office tour is needed on a page
						},
						after: function(curr, next, opt) {
							var slider_alt = $(next).children('.before-after-slider').children('div').siblings().find('img').attr('alt'); // This grabs the image alt text
							$('.slider-detail span').html(slider_alt).fadeIn(); // This puts alt text into the caption span
						}
					});
					//end
				}
			});
		}//end init
	}// end slider before after
	

// IE6 Duct Tape	
//-------------------------------------------------------------------------------
	,ie_functions :
	{
		init : function()
		{
		  	//detects if browser is IE by checking leadingWhitespace property. 
		  	//See: http://docs.jquery.com/Utilities/jQuery.support
			var fancyHover = $.support.leadingWhitespace;
			if(fancyHover == false) 
			{//browser is IE, use script
				$('#nav ul li, #utility-nav ul li').bind('mouseenter mouseleave', function(){
					$(this).toggleClass('sfhover');
				});	
				//PNG fix for IE6
				//$.xLazyLoader({
				//	js: 'http://2.scripts.sesamehost.com/scripts/jquery.pngFix1.2.min.js',
				//	name: 'pngFix',
				//	success: function() { 
				//		$(document).pngFix();
				//	},
				//});
		 
				//click to close behavior
				if($('.ie-alert-link').length > 0) {
					$.xLazyLoader({
						js: 'http://5.scripts.sesamehost.com/scripts/jquery.cookie.js',
						name: 'cookie',
						success: function() { 
							$('.ie-alert-link').click(function() {
								$('#ie_alert').slideToggle("slow");
								$.cookie('iealert', 'noshow', { expires: 14 });
							});
							//set cookie handler
							var alertBox = $.cookie('iealert');
							//if cookie val "noshow" then hide message - user has already seen this message!
							if(alertBox == 'noshow') {
								$('#alert').css('display', 'none');
							}else{
								$('#alert').css('display', 'block');
							}
						}
					});
				}
				//-- /end ie6 warning
			}//end if/else
		}//end ie init		
	}//end ie_functions


// Image Replacement	
//-------------------------------------------------------------------------------
	// Cufon & FontAvailable Image Replacement Headings
	,cufon : 
	{
		init : function()
		{		
			//Cufon + jQuery
			//--- requiresin <head>:
			//--- <script src="http://9.scripts.sesamehost.com/scripts/jquery.fontavailable-1.1.min.js" type="text/javascript"></script>
			//if (!$.fontAvailable('CorbelBold')) {
				// load the cufon library
			//	$.xLazyLoader({
			//	    js: ['http://10.scripts.sesamehost.com/scripts/cufon-yui.js',
			//	    	'scripts/CorbelBold_700.font.js'],
			//	    name: 'cufon',
			//	    success: function(){
			//            Cufon.replace('#bd h1.headline',{
			//            	fontFamily:'CorbelBold'
			//            });
			//	    }
			//	});				
			//}
			//ADD YOUR CUSTOM TEXT REPLACEMENT METHODS HERE
		}//end init
	}//end image replacement
	
	// jcIR Image Replacement Headings	
	//-------------------------------------------------------------------------------
	,jcir :
	{
		init : function()
		{
			$.xLazyLoader({
				js: 'http://22.scripts.sesamehost.com/scripts/jquery.jcIR.js',
				img: 'images/pixel.gif',
				name: 'jcIR',
				success: function() {
					//jcIR
					//check if images are enabled then run replacement
					$('.jcir').jcIR({
						image_dir: 'headings',//no slashes
						image_ext: '.jpg',//file extention of replacement image
						elem_width: '600',//width of element being replaced
						elem_height: '50'//height of element being replaced
					});
				}//end success
			});
		}//end init
	}//end jcIR

// Navigation
//-------------------------------------------------------------------------------
	,navigation :
	{
		init : function()
		{
			//superfish menus
			$.xLazyLoader({
				js: 'http://21.scripts.sesamehost.com/scripts/superfish.js',
				name: 'superfish',
				success: function() {
					$('#nav>ul, #utility-nav>ul, #logins>ul').superfish({ 
						hoverClass:		'sfhover',							//class used by IE for hover effects
				        delay:			500,                             	//one second delay on mouseout 
				        animation:		{opacity:'show',height:'show'},  	//fade-in and slide-down animation 
				        autoArrows:  	false,                           	//disable generation of arrow mark-up 
				        disableHI:   	true              					// set to true to disable hoverIntent detection
				    });
				}
			});
		}//end init
	}//end navigation	

// Anti-spam email obfuscator
//-------------------------------------------------------------------------------
	,anti_spam :
	{
		init : function()
		{
			$.xLazyLoader({
				js: 'http://12.scripts.sesamehost.com/scripts/jquery.jcAntiSpam.js',
				name: 'anti_spam',
				success: function() {
					$('.my-email-address').jcAntiSpam({
						emailCommonName: 'Email Dr. Sesame',//Name displayed in link text, e.g., 'Email So-And-So'<br/>
						emailName:       'samantha',//First half of primary email address; before "@" symbol<br/>
						emailDomain: 	 'sesamedental.com',// Full Primary email domain name<br/>
						emailCcName: 	 '',//First half of CC email address; before "@" symbol<br/>
						emailCcDomain:   ''//CC email domain name<br/>
					});
				}
			});
		}//end init
	}//end anti-spam

// Tool Tips
//-------------------------------------------------------------------------------
	,tooltips :
	{
		init : function()
		{
			$.xLazyLoader({
			    js: 'http://17.scripts.sesamehost.com/scripts/jquery.qtip-1.0.0-rc3.min.js',
			    name: 'qtip',
			    success: function(){
					
					//qtip DR login styles
					$.fn.qtip.styles.logins = { // Last part is the name of the style
						width: 306,
						background: '#fffef3',//customize me - background color of tip
						button: {
								'color': 'white',//customize me - color of text in title bar
								'font-weight': 'bold' 
						},
						color: '#3c0600',//customize me
						textAlign: 'left',
						title: 
						{
							'background': '#3c0600'//customize me - background of title bar
						},
						border: {
						  width: 3,//customize me - width of border
						  radius: 5,//customize me - rounded corner radius
						  color: '#832117'//customize me - color of border
						},
						tip: 'topRight',
						name: 'dark' // Inherit the rest of the attributes from the preset dark style
					}
					//DR login
					var drLoginForm = $('#dr-login-form');
					var drLoginTitle = 'Dental Sesame Doctor Login';
					$('#doctor-login').click(function(e){e.preventDefault();}).each(function(){
						$(this).qtip({
							content: 
							{
								title:
								{
									text: drLoginTitle,
									button: 'Close'
								},
								text: drLoginForm
							},
							show: {
								when: 'click',
								solo: true
							},
							hide: {
								when: 'click',
								fixed: true
							},
							style: 'logins',
								position: {
									corner: {
										target: 'bottomLeft',
										tooltip: 'topRight'
									}
								}
					
						})
					});
					
			    }
			});				
		}//end init
	}//end tooltips
}//end globalLib


//JQuery Setup
$(function(){


//--initialize all required library items
	// LINE: 14
	globalLib.analytics.init(); 
	
	// LINE: 40 - unused
	//globalLib.cssImage_preload.init();
	
	// LINE: 500
	globalLib.html_functions.init();

	// LINE: 727
	globalLib.ie_functions.init();

	// LINE: 777
	//globalLib.cufon.init();

	// LINE 825
	globalLib.tooltips.init();
	
	// LINE: 804
	globalLib.navigation.init(); 
	
//--initialize on-demand library items
	if($("div[id^='flash-']", "div[id^='video']")){//load flash functions
		globalLib.flash_functions.init();
	}
	// jcIR
	if($('.jcIR').length > 0) {//load jcIR Image Replacement
		globalLib.jcir.init();
	}
	// Anti-Spam
	if($('.my-email-address').length > 0) {//load Anti-Spam Obfusicator
		globalLib.anti_spam.init();
	}
	//slideshows
	if($('ul#gallery').length > 0) {//load galleryView slideshow
		//
		globalLib.gallery_view_tour.init();
	}
	
	if($('#slideshow-home').length > 0) {//load cycle slideshow
		//
		globalLib.cycle_slideshow.init();
	}
	
	if($('#cycle-office-tour').length > 0) {//load cycle office tour
		//
		globalLib.cycle_tour.init();
	}
	
	if($('#before-after-cycle').length > 0) {//load cycle before after
		//
		globalLib.cycle_before_after.init();
	}
	
	if($('#slider-cycle').length > 0){//load slider before after
		//
		globalLib.slider_before_after.init();
	}//end slideshows 
	
	if($('form').length > 0) {//load form functions
		// LINE: 57
		globalLib.form_validation.init();	
	}
	
	if($("a[rel^='prettyPhoto']").length > 0){//load prettyPhoto function
		// LINE: 192
		globalLib.modal_windows.init();
	}
	
	if($('ul#sesame-games').length > 0 ) {//load game code
		// LINE: 484
		globalLib.games.init();
	}	
});//end document.ready
