// IE Suckerfish Hover Fix
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);

// XHTML Strict External Links
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href")&&
       anchor.getAttribute("rel")=="external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

// Jquery Variables
$(document).ready(function(){	   

	//form validation
	
	//additional 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
	$(".validate").each(function() {
		$(this).validate({
			errorElement: "div",
				success: function(label) {
					label.text("ok!").addClass("success");
				},
			rules: {
				Name: {
					required:true,
					minlength: 5
				},
				Address: {
					required:true,
					minlength: 5
				},
				Doctor_Name: {
					required:true,
					minlength: 5
				},
				Patient_Name: {
					required:true,
					minlength: 5
				},
				Patient_Patient_Referring: {
					required:true,
					minlength: 5
				},
				Doctor_Patient_Referring: {
					required:true,
					minlength: 5
				},
				Daytime_Phone: {
					required: true,
					phone: true	
				},
				Patient_Phone: {
					required: true,
					phone: true	
				},
				txtNumber: {
					required:true,
					minlength: 5
				}
			}
		});
	});

// Flash Embedding

// Home Page Flash
	$('#flash-home').flash(
		{ 
		  src: 'swf/home.swf',
		  height: 290,
		  width: 550,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);

// Office Tour
	$('#flash-office-tour').flash(
		{ 
		  src: 'swf/office-tour.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: { 
			autoPlay: 'true',
		  	caption01: 'Outside Building',
			caption02: 'Reception Area',
			caption03: 'Clinic',
			caption04: 'Mission Control',
			caption05: 'Cone Beam CT',
			caption06: 'Dr. Rashidi with Patient',
			caption07: 'Our Residents with Dr. Grove'
		  }
		},
		{ version: 8 }
	);

// Braces Diagram
	$('#flash-braces-diagram').flash(
		{ 
		  src: 'swf/braces-diagram.swf',
		  width: 500,
		  height: 375,
		  wmode: 'transparent',
		  flashvars: {
			thisColor: '0x' + '003563'
		  }
		},
		{ version: 8 }
	);

// Orthodontic Treatments
	$('#flash-orthodontic-treatments').flash(
		{ 
		  src: 'swf/orthodontic-treatments.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			autoPlay: 'false',
			thisColor: '0x' + '003563',
			crowding: 'true',
			openbite: 'true',
			deepOverbite: 'true',
			missing: 'true',
			underbite: 'true',
			spacing: 'true',
			overbite: 'true',
			nonBraces: 'true',
			phaseI: 'true'
		  }
		},
		{ version: 8 }
	);

// Brushing and Flossing
	$('#flash-brushing-and-flossing').flash(
		{ 
		src: 'swf/brushing-and-flossing.swf',
		width: 500,
		height: 300,
		wmode: 'transparent',
		  flashvars: {
			autoPlay: 'false',
			thisColor: '0x' + '003563',
			brushing: 'true',
			flossing: 'true'
		  }
		},
		{ version: 8 }
	);

// Oral Care Video
	$('#flash-oral-care-video').flash(
		{ 
		  src: 'swf/oral-care-video.swf',
		  width: 500,
		  height: 350,
		  wmode: 'transparent',
		  flashvars: { 
			thisColor: '0x' + '003563',
			wmode: 'transparent'
		  }
		},
		{ version: 8 }
	);

// Palatal Expander
	$('#flash-palatal-expander').flash(
		{ 
		  src: 'swf/palatal-expander.swf',
		  width: 200,
		  height: 150,
		  wmode: 'transparent'
		},
		{ version: 8 }
	);

// Types of Appliances
	$('#flash-types-of-appliances').flash(
		{ 
		  src: 'swf/types-of-appliances.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			autoPlay: 'false',
			thisColor: '0x' + '003563',
			elastics: 'true',
			headgear: 'true',
			herbst: 'true',
			palatal: 'true',
			positioners: 'true',
			separators: 'true'
		  }
		},
		{ version: 8 }
	);

// Types of Braces
	$('#flash-types-of-braces').flash(
		{ 
		  src: 'swf/types-of-braces.swf',
		  width: 500,
		  height: 300,
		  wmode: 'transparent',
		  flashvars: { 
			autoPlay: 'false',
			thisColor: '0x' + '003563',
			metal: 'true',
			gold: 'false',
			ceramic: 'true',
			invisible: 'true',
			lingual: 'false'
		  }
		},
		{ version: 8 }
	);
	
// In-Ovation Video
	$('#flash-in-ovation').flash(
		  { 
		  src: 'swf/flv-player.swf',
		  width: 320,
		  height: 265,
		  wmode: 'transparent',
		  flashvars: { 
			flvToPlay: '../video/in-ovation.flv',
			autoStart: 'false',
			scaleMode: 'full',
			startImage: 'video/thumbnails/in-ovation.jpg',
			showScaleModes: 'false'
		  }
		},
		{ version: 8 }
	);
	
// SureSmile Video
	$('#flash-suresmile-video').flash(
		{ 
		  src: 'swf/flv-player.swf',
		  width: 486,
		  height: 299,
		  wmode: 'transparent',
		  flashvars: { 
			flvToPlay: '../video/suresmile.flv',
			autoStart: 'false',
			scaleMode: 'none',
			startImage: 'video/thumbnails/suresmile.jpg',
			showScaleModes: 'false',
			smoothVideo: 'true'
		  }
		},
		{ version: 8 }
	);

// iBraces Video 1
	$('#flash-ibraces-1').flash(
		  { 
		  src: 'swf/flv-player.swf',
		  width: 360,
		  height: 295,
		  wmode: 'transparent',
		  flashvars: { 
			flvToPlay: '../video/ibraces-1.flv',
			autoStart: 'false',
			scaleMode: 'full',
			startImage: 'video/thumbnails/ibraces-1.jpg',
			showScaleModes: 'false'
		  }
		},
		{ version: 8 }
	);
	
// iBraces Video 2
	$('#flash-ibraces-2').flash(
		  { 
		  src: 'swf/flv-player.swf',
		  width: 360,
		  height: 270,
		  wmode: 'transparent',
		  flashvars: { 
			flvToPlay: '../video/ibraces-2.flv',
			autoStart: 'false',
			scaleMode: 'full',
			startImage: 'video/thumbnails/ibraces-2.jpg',
			showScaleModes: 'false'
		  }
		},
		{ version: 8 }
	);

// iBraces Video 3
	$('#flash-ibraces-3').flash(
		  { 
		  src: 'swf/flv-player.swf',
		  width: 360,
		  height: 270,
		  wmode: 'transparent',
		  flashvars: { 
			flvToPlay: '../video/ibraces-3.flv',
			autoStart: 'false',
			scaleMode: 'full',
			startImage: 'video/thumbnails/ibraces-3.jpg',
			showScaleModes: 'false'
		  }
		},
		{ version: 8 }
	);

});// End Jquery Variables