// JavaScript Document

$(document).ready(function() 
{
	var imageButtonContactTop = $('<img />').attr('src', '/multimedia/skeleton/button-contact-top-over.png');
	var imageLocations = $('<img />').attr('src', '/multimedia/skeleton/image-locations.png');
	$('#buttonContactTop').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/button-contact-top-over.png'); $('#divImageLocations').show();});
	$('#buttonContactTop').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/button-contact-top.png'); $('#divImageLocations').hide();});
	
	
	var imageButtonNavHome = $('<img />').attr('src', '/multimedia/skeleton/button-nav-home-over.png');
	var imageButtonNavAbout = $('<img />').attr('src', '/multimedia/skeleton/button-nav-about-over.png');
	var imageButtonNavProviders = $('<img />').attr('src', '/multimedia/skeleton/button-nav-providers-over.png');
	var imageButtonNavServices = $('<img />').attr('src', '/multimedia/skeleton/button-nav-services-over.png');
	var imageButtonNavBilling = $('<img />').attr('src', '/multimedia/skeleton/button-nav-billing-over.png');
	var imageButtonNavContact = $('<img />').attr('src', '/multimedia/skeleton/button-nav-contact-over.png');
	
	$('#buttonNavHome').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-home-over.png');});
	$('#buttonNavHome').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-home.png');});
	
	$('#buttonNavAbout').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-about-over.png');});
	$('#buttonNavAbout').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-about.png');});
	
	$('#buttonNavProviders').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-providers-over.png');});
	$('#buttonNavProviders').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-providers.png');});
	
	$('#buttonNavServices').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-services-over.png');});
	$('#buttonNavServices').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-services.png');});
	
	$('#buttonNavBilling').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-billing-over.png');});
	$('#buttonNavBilling').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-billing.png');});
	
	$('#buttonNavContact').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-contact-over.png');});
	$('#buttonNavContact').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/button-nav-contact.png');});
	
	
	$('#tdNavAbout').mouseover(function() {$(this).find('ul').show(); $(this).find('img').attr('src', '/multimedia/skeleton/button-nav-about-over.png');});
	$('#tdNavAbout').mouseout(function() {$(this).find('ul').hide(); $(this).find('img').attr('src', '/multimedia/skeleton/button-nav-about.png');});
	
	$('#tdNavServices').mouseover(function() {$(this).find('ul').show(); $(this).find('img').attr('src', '/multimedia/skeleton/button-nav-services-over.png');});
	$('#tdNavServices').mouseout(function() {$(this).find('ul').hide(); $(this).find('img').attr('src', '/multimedia/skeleton/button-nav-services.png');});
	
	$('#tdNavContact').mouseover(function() {$(this).find('ul').show(); $(this).find('img').attr('src', '/multimedia/skeleton/button-nav-contact-over.png');});
	$('#tdNavContact').mouseout(function() {$(this).find('ul').hide(); $(this).find('img').attr('src', '/multimedia/skeleton/button-nav-contact.png');});
	
	
	var imageQuickButtonPrescription = $('<img />').attr('src', '/multimedia/skeleton/quick-button-prescription-over.jpg');
	var imageQuickButtonAppointments = $('<img />').attr('src', '/multimedia/skeleton/quick-button-appointments-over.jpg');
	var imageQuickButtonPatientForms = $('<img />').attr('src', '/multimedia/skeleton/quick-button-patientforms-over.jpg');
	var imageQuickButtonPatientEducation = $('<img />').attr('src', '/multimedia/skeleton/quick-button-patienteducation-over.jpg');
	var imageQuickButtonLabResults = $('<img />').attr('src', '/multimedia/skeleton/quick-button-labresults-over.jpg');
	var imageQuickButtonFAQ = $('<img />').attr('src', '/multimedia/skeleton/quick-button-faq-over.jpg');
	
	$('#quickbuttonPrescription').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-prescription-over.jpg');});
	$('#quickbuttonPrescription').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-prescription.jpg');});
	
	$('#quickbuttonAppointments').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-appointments-over.jpg');});
	$('#quickbuttonAppointments').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-appointments.jpg');});
	
	$('#quickbuttonPatientForms').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-patientforms-over.jpg');});
	$('#quickbuttonPatientForms').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-patientforms.jpg');});
	
	$('#quickbuttonPatientEducation').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-patienteducation-over.jpg');});
	$('#quickbuttonPatientEducation').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-patienteducation.jpg');});
	
	$('#quickbuttonLabResults').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-labresults-over.jpg');});
	$('#quickbuttonLabResults').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-labresults.jpg');});
	
	$('#quickbuttonFAQ').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-faq-over.jpg');});
	$('#quickbuttonFAQ').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/quick-button-faq.jpg');});
	
	var imageButtonFooterVideo = $('<img />').attr('src', '/multimedia/skeleton/footer-video-over.png');
	
	$('#buttonFooterVideo').mouseover(function() {$(this).attr('src', '/multimedia/skeleton/footer-video-over.png');});
	$('#buttonFooterVideo').mouseout(function() {$(this).attr('src', '/multimedia/skeleton/footer-video.png');});
	$("#buttonFooterVideo").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'	: false,
				'transitionIn'	: 'fade',
				'transitionOut'	: 'fade',
				'overlayOpacity'	: .8,
				'overlayColor'	: '#111',
				'titleShow'	: false,
				'width'		: 640,
				'height'		: 385,
				'href'		: '/multimedia/swf/homeVideo.swf',
				'type'		: 'swf',
				'swf'		: {
					'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});
	
		return false;
	});
	
	
	$('#linkProviderGF').mouseover(function() {
		
		$(this).qtip({content: '<img src="/multimedia/page-images/genevieve.jpg" /><br><br><strong>Genevieve L. Fairbrother, M.D. / M.P.H.</strong><br>Originally from England, Dr. Fairbrother traveled extensively before emigrating to Hershey, Pennsylvania, in 1977. She graduated Magna Cum Laude from Wellesley College in 1988. After receiving her Medical Degree from Tufts University School of Medicine she completed her residency at Emory University School of Medicine. She is certified by the American Board of Obstetrics and Gynecology and is a Fellow of the American College of Obstetricians and Gynecologists. Dr. Fairbrother is married with two children.  Dr Fairbrother is current Chief of Medical Staff at Northside Hospital and past Chair of the Obstetrics and Gynecology Department.',
			show: { ready: true, solo: true }, 
			hide:{fixed: false }, 
			position: {adjust:{ screen: true}, corner:{target: 'topRight',tooltip: 'bottomLeft'}}, 
			style: 'obgynstyle'});
		
		});
	
	$('#linkProviderTS').mouseover(function() {
		
		$(this).qtip({content: '<img src="/multimedia/page-images/thomas.jpg" /><br><br><strong>Thomas E. Sharon, M.D.</strong><br>Originally from Boston, Dr. Sharon graduated Magna Cum Laude from Wake Forest University in 1986. After graduating from Emory University School of Medicine in 1990, he completed his residency training at Emory in 1994, where he is a former chief resident and was voted Best House officer. He is certified by the American Board of Obstetrics and Gynecology and is a Fellow of the American College of Obstetricians and Gynecologists. Dr. Sharon is married with two children.',
			show: { ready: true, solo: true }, 
			hide:{fixed: false }, 
			position: {adjust:{ screen: true}, corner:{target: 'topRight',tooltip: 'bottomLeft'}}, 
			style: 'obgynstyle'});
		
		});
		
	$('#linkProviderKF').mouseover(function() {
		
		$(this).qtip({content: '<img src="/multimedia/page-images/kristen.jpg" /><br><br><strong>Kristen L. Fanklin, M.D.</strong><br>After growing up in Stone Mountain, Georgia, Dr. Franklin graduated from the University of Georgia as a Foundation Fellow in 1987. In 1991, she graduated from Emory University School of Medicine. Dr Franklin then completed her residency training at East Carolina University School of Medicine and then joined our practice in 1995. She is certified by the American Board of Obstetrics and Gynecology and is a Fellow of the American College of Obstetricians and Gynecologists. Dr. Franklin is married and has two children. ',
			show: { ready: true, solo: true }, 
			hide:{fixed: false }, 
			position: {adjust:{ screen: true}, corner:{target: 'topRight',tooltip: 'bottomLeft'}}, 
			style: 'obgynstyle'});
		
		});
		
	$('#linkProviderCW').mouseover(function() {
		
		$(this).qtip({content: '<img src="/multimedia/page-images/charles.jpg" /><br><br><strong>Charles D. Wootten, M.D.</strong><br>An Atlanta native, Dr. Wootten graduated from Princeton University in 1986 and Mercer University School of Medicine in 1990. He completed his residency at Emory University School of Medicine in 1994. He served on the academic faculties at Louisiana State University in New Orleans and Emory University in Atlanta before joining our group in 2000. He is a member of the Alpha Omega Alpha medical honor society and is certified by the American Board of Obstetrics and Gynecology and is a Fellow of the American College of Obstetricians and Gynecologists. Dr. Wootten and his wife have three children.',
			show: { ready: true, solo: true }, 
			hide:{fixed: false }, 
			position: {adjust:{ screen: true}, corner:{target: 'topRight',tooltip: 'bottomLeft'}}, 
			style: 'obgynstyle'});
		
		});

	$('#linkProviderCP').mouseover(function() {
		
		$(this).qtip({content: '<img src="/multimedia/page-images/claire.jpg" /><br><br><strong>Claire A. Parker, M.D.</strong><br>Dr. Parker received her undergraduate degree at North Carolina State University and her medical degree at the University of North Carolina School of Medicine. Her residency was completed in June 2001 at Emory University School of Medicine where she served as Administrative Chief Resident. She is certified by the American Board of Obstetrics and Gynecology and is a Fellow of the American College of Obstetricians and Gynecologists. Dr. Parker joined ObGyn of Atlanta in September, 2001. She and her husband have two sons. ',
			show: { ready: true, solo: true }, 
			hide:{fixed: false }, 
			position: {adjust:{ screen: true}, corner:{target: 'topRight',tooltip: 'bottomLeft'}}, 
			style: 'obgynstyle'});
		
		});
		
	$('#linkProviderKDH').mouseover(function() {
		
		$(this).qtip({content: '<img src="/multimedia/page-images/keisha.jpg" /><br><br><strong>Keisha Dennard-Hall, M.D.</strong><br>Originally from New Jersey, Dr Dennard-Hall received both her undergraduate and medical degrees from the University of Pennsylvania. She completed her residency at Magee-Women\'s Hospital in Pittsburgh in June of 2002. She has been honored by several scholarships and teaching awards. She is certified by the American Board of Obstetrics and Gynecology and is a Fellow of the American College of Obstetricians and Gynecologists. Dr Dennard-Hall joined our practice after moving to Atlanta in 2007. She is married with three children.',
			show: { ready: true, solo: true }, 
			hide:{fixed: false }, 
			position: {adjust:{ screen: true}, corner:{target: 'topRight',tooltip: 'bottomLeft'}}, 
			style: 'obgynstyle'});
		
		});
		
	$('#linkProviderJH').mouseover(function() {
		
		$(this).qtip({content: '<img src="/multimedia/page-images/jill.jpg" /><br><br><strong>Jill J. Henke, M.D.</strong><br>Dr. Henke received her undergraduate degree at Emory University and her medical degree at the University of Texas Health Science Center-San Antonio. Her residency was completed in June 2005 at Emory University School of Medicine where she served as Administrative Chief Resident. She served on the academic faculties at Emory University before joining our group. She is certified by the American Board of Obstetrics and Gynecology and is a Fellow of the American College of Obstetricians and Gynecologists. Dr. Henke joined us in March of 2008. ',
			show: { ready: true, solo: true }, 
			hide:{fixed: false }, 
			position: {adjust:{ screen: true}, corner:{target: 'topRight',tooltip: 'bottomLeft'}}, 
			style: 'obgynstyle'});
		
		});
		
	$('#linkProviderCB').mouseover(function() {
		
		$(this).qtip({content: '<img src="/multimedia/page-images/chris.jpg" /><br><br><strong>Christopher E. Bassil, M.D.</strong><br>Originally from Miami, Florida, Dr. Bassil graduated Summa Cum Laude from the University of Florida in 1998. In 2004, Dr. Bassil obtained his medical degree from the University of Miami. He completed residency at Baylor College of Medicine in 2008 where he served as Administrative Chief Resident. He is a Junior Fellow of the American College of Obstetricians and Gynecologists. Dr. Bassil and his wife have three children. Dr. Bassil is fluent in Spanish and joined our practice in August of 2008.',
			show: { ready: true, solo: true }, 
			hide:{fixed: false }, 
			position: {adjust:{ screen: true}, corner:{target: 'topRight',tooltip: 'bottomLeft'}}, 
			style: 'obgynstyle'});
		
		});



	
	$.fn.qtip.styles.obgynstyle = { // Last part is the name of the style
		fontSize: '13px',
		width: 360,
		padding: 5,
		color: '#111',
		background: '#ECE3D2',
		tip: true,
		fontWeight: 'normal',
		textAlign: 'left',
		name: 'dark',
		border: 	{
			width: .5,
			radius: 10,
			color: '#B8A88E'
			}
	}
	
});


// Print page functionality

function printPage(whatTag){
	
	_gaq.push(['_trackEvent', 'Print Page', 'Successful submission', whatTag]);
	
	$("#divPrintPage").remove();
	$("body").append("<div id='divPrintPage' style='width:1px; height:1px;'><iframe style='border:none;' border='0' width='1' height='1' src='/scripts/cfm/reformat/print.php?tag="+whatTag+"'></iframe></div>");	

}

function savePDF(whatTag){
	
	$("#divPrintPage").remove();
	var whatURL = "http://www.obgynofatlanta.com/scripts/cfm/reformat/pdf.cfm?tag=" + whatTag;
	document.location = "http://pdf.perk-up.com/index.cfm?site=http://www.obgynofatlanta.com/" + whatTag + "&filename=" + whatTag;
	//$("body").append("<div id='divPrintPage' style='width:1px; height:1px;'><iframe style='border:none;' border='0' width='1' height='1' src='http://pdf.perk-up.com/index.cfm?site=" + escape(whatURL) + "&filename=" + whatTag + "' ></iframe></div>");	
	
}

function emailPage(whatPage, whatTitle)
{
	_gaq.push(['_trackEvent', 'Email Page', 'Successful submission', whatTitle]);
	
	function formatTitle(title, currentArray, currentIndex, currentOpts) {
   		return '<div style="background:#222; color:#fff; text-align: left; padding:5px; margin:0; font-size: 14px; font-weight:bold;">Email Page: <span style="color:#0FF;">' + title + '</span></div>';
	}

		$.fancybox({
			'padding'		: 0,
			'autoScale'	: false,
			'transitionIn'	: 'fade',
			'transitionOut'	: 'fade',
			'title'		: 'OBGYN of Atlanta | '+ decodeURIComponent(whatTitle),
			'titlePosition'	: 'outside',
			'titleFormat'	: formatTitle,
			'autoDimensions'	: false,
			'width'		: 520,
			'height'		: 350,
			'href'		: '/scripts/cfm/email/retrieveEmailPageForm.php?page='+whatPage,
			//'type'		: 'swf',
			'overlayColor'	: '#000',
			'overlayOpacity'	: '.8',
			'modal'		: false,
			'onClosed'	: function() {
							$.validationEngine.closePrompt(".formError", true);
						}

		});
	
}

function emailContact(whatName, whatEmail)
{
	_gaq.push(['_trackEvent', 'Email Contact', 'Successful submission', whatEmail]);
	
	function formatTitle(title, currentArray, currentIndex, currentOpts) {
   		return '<div style="background:#222; color:#fff; text-align: left; padding:5px; margin:0; font-size: 14px; font-weight:bold;"><span style="color:#0FF;">' + title + '</span></div>';
	}

		$.fancybox({
			'padding'		: 0,
			'autoScale'	: false,
			'transitionIn'	: 'fade',
			'transitionOut'	: 'fade',
			'title'		: 'OBGYN of Atlanta | Email Contact',
			'titlePosition'	: 'outside',
			'titleFormat'	: formatTitle,
			'autoDimensions'	: false,
			'width'		: 620,
			'height'		: 350,
			'href'		: '/scripts/cfm/email/retrieveEmailContactForm.php?whatEmail=' + escape(whatEmail) + '&whatName=' + escape(whatName),
			'overlayColor'	: '#000',
			'overlayOpacity'	: '.8',
			'modal'		: false,
			'onClosed'	: function() {
							$.validationEngine.closePrompt(".formError", true);
						}

		});
	
}


function sendPrescriptionRequest()
{
	
	
if ($('#formRefill #refillValidate').val() == "prescribe")
{
	_gaq.push(['_trackEvent', 'Prescription Refill', 'Successful submission', $('#formRefill #patient_name').val()]);
	
	$.ajax(
	{
			type: "POST",
			cache: "false",
			url: "/scripts/cfm/email/sendEmailPrescription.php",	
			data: $('#formRefill').serialize(),
			success: function(msg)
			{
				function formatTitle(title, currentArray, currentIndex, currentOpts) {
					return '<div style="background:#222; color:#fff; text-align: left; padding:5px; margin:0; font-size: 14px; font-weight:bold;"><span style="color:#0FF;">' + title + '</span></div>';
				}

				$.fancybox({
						'padding'		: 0,
						'autoScale'	: false,
						'transitionIn'	: 'fade',
						'transitionOut'	: 'fade',
						'title'		: 'OBGYN of Atlanta | Prescription Request',
						'titlePosition'	: 'outside',
						'titleFormat'	: formatTitle,
						'autoDimensions'	: false,
						'width'		: 400,
						'height'		: 120,
						'content'		: '<h3 style="padding-top:50px;">Prescription request sent successfully.</h3>',
						'overlayColor'	: '#000',
						'overlayOpacity'	: '.8',
						'modal'		: false,
						'onClosed'	: function() {
										$.validationEngine.closePrompt(".formError", true);
									}
			
					});
			},
			error: function(xhr, status, error)
			{
				
			}
	});
}
else
{

				function formatTitle(title, currentArray, currentIndex, currentOpts) {
					return '<div style="background:#222; color:#fff; text-align: left; padding:5px; margin:0; font-size: 14px; font-weight:bold;"><span style="color:#0FF;">' + title + '</span></div>';
				}
				
				$.fancybox({
						'padding'		: 0,
						'autoScale'	: false,
						'transitionIn'	: 'fade',
						'transitionOut'	: 'fade',
						'title'		: 'OBGYN of Atlanta | Prescription Request',
						'titlePosition'	: 'outside',
						'titleFormat'	: formatTitle,
						'autoDimensions'	: false,
						'width'		: 400,
						'height'		: 120,
						'content'		: '<h3 style="padding-top:50px;">Please enter the correct word in the image and try again.</h3>',
						'overlayColor'	: '#000',
						'overlayOpacity'	: '.8',
						'modal'		: false,
						'onClosed'	: function() {
										$.validationEngine.closePrompt(".formError", true);
									}
			
					});


}
				
										         
}




