// JavaScript Document
$(document).ready(function(){
	//hiding elements
	$('.sub').hide();
	
	//remove focus box
	if(document.getElementsByTagName) {
		var a = document.getElementsByTagName("a");
		for(var i = 0; i < a.length; i++){
		a[i].onfocus = function(){this.blur();};
		}
	}
	
	//menu
	function mouseOver(elem) {
		$('.sub', this).fadeIn().parent().addClass('current');		
	}
	function mouseOut(elem) {
		$('.sub', this).fadeOut().parent().removeClass('current');	
	}
	
	$('#innermenu > .abscontainer').hoverIntent(mouseOver, mouseOut);
	
	//photo rotation
	$('#rotation').fadeIn(1100);
    $('#rotation').cycle({
		fx: 'fade',
		speed: 1200,
		timeout: 5000	
	});
	
	if ($("#retention").length) { // if div exists...
   		//embed be an orthodontist feature
		flashembed("retention",{src:"http://tools.televoxsites.com/features/retainer.swf", wmode:"transparent"});
 	}
	
	if ($("#orthognathic").length) { // if div exists...
   		//embed be an orthodontist feature
		flashembed("orthognathic",{src:"http://tools.televoxsites.com/features/orthognathic.swf", wmode:"transparent"});
 	}	
	
	$('#rpe').click(function() {
  		flashembed("rpe",{src:"http://tools.televoxsites.com/features/rpa2.swf", wmode:"transparent"});
	});
	
	if ($("#flashLogo").length) { // if div exists...
   		//embed be an orthodontist feature
		flashembed("flashLogo",{src:"/Portals/_default/Skins/siteSkin/flash/logo-ani01.swf", wmode:"transparent"});
 	}	
				
	//img opacity
	$('.footer img').css({'opacity' : '0.8' })
	$('.footer img').each(function() {
		$(this).hover(function() {
			$(this).stop().animate({ opacity: 1.0 }, 200);
		},
		function() {
			$(this).stop().animate({ opacity: 0.8 }, 200);
		});
	});
	
	$("a#hermitage").click(function() {
		$.fancybox(
			[
				{ href: '/portals/0/officetour/hermitage/hermitage-exterior.jpg', title: 'Welcome to Our Hermitage Office' },
				{ href: '/portals/0/officetour/hermitage/hermitage-front-desk.jpg', title: 'Front Desk' },
				{ href: '/portals/0/officetour/hermitage/hermitage-waiting-area-3.jpg', title: 'Waiting Area' },
				{ href: '/portals/0/officetour/hermitage/hermitage-consultation-room.jpg', title: 'Consultation Room' },
				{ href: '/portals/0/officetour/hermitage/hermitage-treatment-area-2.jpg', title: 'Treatment Area' }
			],
			{ 
				'padding' : 6,
				'transitionIn' : 'fade',
				'transitionOut' : 'fade',
				'type' : 'image',
				'changeFade' : 500
			});
	});
	
	$("a#lebanon").click(function() {
		$.fancybox(
			[
				{ href: '/portals/0/officetour/lebanon/lebanon-exterior.jpg', title: 'Welcome to Our Lebanon Office' },
				{ href: '/portals/0/officetour/lebanon/lebanon-front-desk.jpg', title: 'Front Desk' },
				{ href: '/portals/0/officetour/lebanon/lebanon-consult-room-2.jpg', title: 'Consultation Room' },
				{ href: '/portals/0/officetour/lebanon/lebanon-treatment-area-2.jpg', title: 'Treatment Area' }
			],
			{ 
				'padding' : 6,
				'transitionIn' : 'fade',
				'transitionOut' : 'fade',
				'type' : 'image',
				'changeFade' : 500
			});
	});
	
	/*videos
	if ($("#bioadaptive").length) { // if div exists...
   		flowplayer("bioadaptive", "/Portals/0/videos/flowplayer-3.2.4.swf", {
		wmode: "transparent",
		plugins: { controls: { url: 'flowplayer.controls-tube-3.2.2.swf' } },
		clip: { autoPlay: false, autoBuffering: true, url: '/Portals/0/videos/friction.flv' }
		});
 	}*/
				
});//end document ready







