//sIFR implementation
function pageScripts(){
var ShelleyAllegroScript = {  src: DNN_skinPath + '/flash/copperplate.swf' };
sIFR.activate(ShelleyAllegroScript);
sIFR.replace(ShelleyAllegroScript, {
  selector: 'h1', 
  wmode: 'transparent', 
  src:  DNN_skinPath +  '/flash/copperplate.swf', 
  css: [ '.sIFR-root {color:#173e7c; font-size:34px;}'  ]
});
}

//Menu implementation	   
jQuery(document).ready(function(){

	jQuery("#navigation > ul").superfish({
		hoverClass:"hover",
		pathClass:"overideThisToUse",
		delay:800,
		animation:{height:"show"},
		speed:"normal",
		oldJquery:false,
		disableHI:false,
		onInit:function () {},
		onBeforeShow:function () {},
		onShow:function () {},
		onHide:function () {}
	}).find(">li:has(ul)").mouseover(function () {
		jQuery("ul", this).bgIframe({opacity:true});
	}).find("a").focus(function () {
		jQuery("ul", jQuery("#navigation > ul >li:has(ul)")).bgIframe({opacity:true});
	});

	jQuery(".LinkIcon").rollover("_hover");
	 
	menuImage1 = new Image(); 
	menuImage1.src = DNN_skinPath + "images/home_hover.jpg";
	menuImage2 = new Image(); 
	menuImage2.src = DNN_skinPath + "images/office_hover.jpg";	
	menuImage3 = new Image(); 
	menuImage3.src = DNN_skinPath + "images/patient_hover.jpg";
	menuImage4 = new Image(); 
	menuImage4.src = DNN_skinPath + "images/treatment_hover.jpg";
	menuImage5 = new Image(); 
	menuImage5.src = DNN_skinPath + "images/funzone_hover.jpg";

	jQuery('#flashPhoto').attr('src', DNN_skinPath+'images/slides/'+ Math.floor(Math.random() * 10 + 1) +'.jpg');
	
	jQuery(".sectionVideo, .fpvid").empty();
	
	if (jQuery('#flash-video').length) {
		flowplayer("flash-video", { 
			src: DNN_skinPath+"flash/flowplayer-3.1.5.swf",
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true }
		});
	}
	
	if (jQuery('#missinglateral').length) {
		flowplayer("missinglateral", { 
			src: "/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf",
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Missing Maxillary Lateral Incisor.flv' }
		});
	}
	
	if (jQuery('#enlarginglateral').length) {
		flowplayer("enlarginglateral", { 
			src: "/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf", 
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Build-up of Lateral Incisor.flv' }
		});
	}
	
	if (jQuery('#brokenbrackets').length) {
		flowplayer("brokenbrackets", { 
			src: "/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf", 
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Broken Brackets.flv' }
		});
	}
	
	if (jQuery('#partsofbraces').length) {
		flowplayer("partsofbraces", { 
			src: "/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf",
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Parts of Braces.flv' }
		});
	}
	
	if (jQuery('#bicuspids').length) {
		flowplayer("bicuspids", { 
			src: "/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf",
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Four-bicuspid Extraction all 1st.flv' }
		});
	}
	
	if (jQuery('#elastics').length) {
		flowplayer("elastics", { 
			src:"/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf", 
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Elastics (delta canine open bite).flv' }
		});
	}
	
	if (jQuery('#normaleruption').length) {
		flowplayer("normaleruption", { 
			src:"/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf", 
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Normal Eruption (Panoramic View).flv' }
		});
	}
	
	if (jQuery('#anterior').length) {
		flowplayer("anterior", { 
			src:"/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf", 
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Anterior Tooth Implant.flv' }
		});
	}
	
	if (jQuery('#cl3').length) {
		flowplayer("cl3", { 
			src:"/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf", 
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Mandibular Setback Lips Closed.flv' }
		});
	}
	
	if (jQuery('#lowerlingual').length) {
		flowplayer("lowerlingual", {
			src: "/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf",
			wmode: "transparent"
		}, {
		plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
		clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Lower Lingual Arch.flv' }
		});		
	}
	
	if (jQuery('#decalcification').length) {
		flowplayer("decalcification", { 
			src: "/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf", 
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Decalcification (orthodontics).flv' }
		});
	}
	
	if (jQuery('#overbite').length) {
		flowplayer("overbite", { 
			src:"/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf",
			wmode: "transparent" }, {
			plugins: { controls: { url: 'flowplayer.controls-tube-3.1.5.swf' } },
			clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/Forsus Appliance (Direct Push Rod).flv' }
		});
	}
	
	if (jQuery('div.clips').length) {
		// setup scrolling for the playlist elements
		jQuery("div.clips").scrollable({
			items:'div.scroller',
			vertical:false,
			next:'a.right',
			prev:'a.left',
			easing: 'easeInOutQuart',
			speed: 1000
		});
	}

	
	if (jQuery('#player1').length) {
		
		// setup player normally
		var player = $f("player1", {
				src: "/Portals/_default/Skins/siteSkin/flash/flowplayer-3.1.5.swf",
				wmode: "transparent"
			},
			{	
			// clip properties common to all playlist entries
			clip: {
				baseUrl: '/Portals/0/videos/',
				autoPlay: false,
				autoBuffering: true
			},
			plugins: {
				controls: {
					url: "/Portals/_default/Skins/siteSkin/flash/flowplayer.controls-tube-3.1.5.swf",
					playlist: true
				}
			},
			onStart: function(clip) {
				jQuery('span#titles').text(clip.url.replace(".flv",""));
			}
		})
		.playlist("div.scroller:first", {loop:false});
		
		jQuery('.scroller div a').tooltip({ offset: [-10,0]});
	
		jQuery('a.go').hover(
			function() { jQuery(this).addClass('hover');	},
			function() { jQuery(this).removeClass('hover');	}
		);
		
	} // end playlist setup	

			
	jQuery('.accordion h4').click(function() {
	jQuery(this).toggleClass('active').next().slideToggle('slow');
		return false;
	}).next().hide();
	
	
	/*whitening tour*/
	jQuery('#whitening').cycle({ 
		fx:     'fade', 
		speed:  'fast', 
		timeout: 0, 
		next:   '#next', 
		prev:   '#prev' 
	});
		
	jQuery('#rotation').cycle({ 
		fx:     'fade', 
		speed:  'slow', 
		timeout: 5000
	});
	
	jQuery('.photoband').cycle({ 
		fx:     'fade', 
		speed:  'slow', 
		timeout: 5000
	});
			
	jQuery('.baSlides').each(function(index) {
	jQuery(this).cycle({
		fx: 'fade',
		speed: 300,
		next: this,
		timeout: 0 
		});
	});
	
	jQuery('.multSlides').cycle({
		fx: 'fade',
		speed: 300,
		next: ".multSlides",
		timeout: 0 
	});
	
	jQuery('.multSlides2').cycle({
		fx: 'fade',
		speed: 300,
		next: ".multSlides2",
		timeout: 0 
	});
	
		
	if (jQuery("#featurecolor").length) {
	  var so = new SWFObject("/features/loader.swf", "features", "500", "325", "9", "#FF6600");
	  so.addVariable("config", "/features/config.xml");
	  so.addVariable("feature", "planner");
	  so.addParam("wmode", "transparent");
	  so.addParam("quality", "high");
	  so.write("featurecolor");
	}

	if (jQuery("#featuretypes").length) {
  		var so = new SWFObject("/features/loader.swf", "features", "500", "273", "9", "#FF6600");
		so.addVariable("config", "/features/config.xml");
		so.addVariable("xmlfile", "/features/types.xml");
		so.addParam("wmode", "transparent");
		so.addParam("quality", "high");
		so.write("featuretypes");
	}

	if (jQuery("#featureoral").length) {
  		var so = new SWFObject("/features/loader.swf", "features", "500", "325", "9", "#FF6600");
		so.addVariable("config", "/features/config.xml");
		so.addVariable("feature", "hygiene");
		so.addParam("wmode", "transparent");
		so.addParam("quality", "high");
		so.write("featureoral");
	}

	if (jQuery("#featurecommon").length) {
  		var so = new SWFObject("/features/loader.swf", "features", "500", "273", "9", "#FF6600");
		so.addVariable("config", "/features/config.xml");
		so.addVariable("feature", "problems");
		so.addParam("wmode", "transparent");
		so.addParam("quality", "high");
		so.write("featurecommon");
	}

	if (jQuery("#featureemer").length) {
  		var so = new SWFObject("/features/loader.swf", "features", "500", "273", "9", "#FF6600");
		so.addVariable("config", "/features/config.xml");
		so.addVariable("feature", "emergencies");
		so.addParam("wmode", "transparent");
		so.addParam("quality", "high");
		so.write("featureemer");
	}

	if (jQuery("#featurebefore").length) {
  		var so = new SWFObject("/features/loader.swf", "features", "500", "273", "9", "#FF6600");
		so.addVariable("config", "/features/config.xml");
		so.addVariable("feature", "beforeafter");
		so.addParam("wmode", "transparent");
		so.addParam("quality", "high");
		so.write("featurebefore");
	}
	

});
