/*
DESCRIPTION:   Included JavaScript file
AUTHOR:		   C.A.
DATE:		   	05/05/2004
*/


//Default window status bar text
window.defaultStatus = "Galt Mile Wellness Chiropractic Center";


// Open popup centered on the screen
function openWin(page,popW,popH) {
	var w = 800, h = 600;
	var myPopup = "popWin";

	if (document.all || document.layers){
	   w = screen.availWidth;
	   h = screen.availHeight;
	}

	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

	popup = window.open(page,myPopup,"height="+popH+",width="+popW+",top="+topPos+",left="+leftPos+",resizable=yes,scrollbars=yes");
	if (!popup.closed) { popup.focus(); }
}


// Encodes email address to deter email bots!
function encodeEmail(toName,subj) {
	var a1,b2,c3,d4,e5,f6,g7,h8,i9,j0,k1,l2,m4,n5;
	h8='<A HREF="mailto:';
	i9='info@';
	j0='';
	k1='ahealthyspine.com?subject='+subj;
	l2='" CLASS="linkBlue">';
	m4=toName;
	n5='</A>';
	a1=h8;
	b2=i9;
	c3=j0;
	d4=k1;
	e5=l2;
	f6=m4;
	g7=n5;
	emailAdd = a1+b2+c3+d4+e5+f6+g7;
	return emailAdd;
}


// Validate form
function chkForm(theForm) {
	if(theForm.fname.value == ""){
		alert("Please enter your first name.");
		theForm.fname.focus();
		return false;
	}
	if(theForm.lname.value == ""){
		alert("Please enter your last name.");
		theForm.lname.focus();
		return false;
	}
	if(theForm.address.value == ""){
		alert("Please enter your address.");
		theForm.address.focus();
		return false;
	}
	if(theForm.city.value == ""){
		alert("Please enter your city.");
		theForm.city.focus();
		return false;
	}
	if(theForm.state.value == ""){
		alert("Please enter your state.");
		theForm.state.focus();
		return false;
	}
	if(theForm.zip.value == ""){
		alert("Please enter your zipcode.");
		theForm.zip.focus();
		return false;
	}
	if(theForm.phone_home.value == ""){
		alert("Please enter your home phone number.");
		theForm.phone_home.focus();
		return false;
	}
	if(theForm.dob_mon.selectedIndex == "00"){
		alert("Please enter your birth month.");
		theForm.dob_mon.focus();
		return false;
	}
	if(theForm.dob_day.selectedIndex == "00"){
		alert("Please enter your birth day.");
		theForm.dob_day.focus();
		return false;
	}
	if(theForm.dob_yr.selectedIndex == "00"){
		alert("Please enter your birth year.");
		theForm.dob_yr.focus();
		return false;
	}
	if(theForm.ssn.value == ""){
		alert("Please enter your Social Security number.");
		theForm.ssn.focus();
		return false;
	}
	if(theForm.auto_accident[0].checked == false && theForm.auto_accident[1].checked == false){
		alert("Please choose whether your injury was due to an auto accident.");
		theForm.auto_accident[0].focus();
		return false;
	}
	if(theForm.insurance[0].checked == false && theForm.insurance[1].checked == false){
		alert("Please choose whether you currently have health insurance.");
		theForm.insurance[0].focus();
		return false;
	}
	if(theForm.insurance[0].checked == true){
		if(theForm.provider.value == ""){
			alert("Please enter the name of your insurance provider.");
			theForm.provider.focus();
			return false;
		}
		if(theForm.member_id.value == ""){
			alert("Please enter your member ID located on the back of your insurance card.");
			theForm.member_id.focus();
			return false;
		}
	}

	return true;
}


// Slide show on main page
var slideShow_1_Speed = 4500;  // Set slideShowSpeed (milliseconds)
var slideShow_2_Speed = 5000;  // Set slideShowSpeed (milliseconds)
var slideShow_3_Speed = 4000;  // Set slideShowSpeed (milliseconds)
var crossFadeDuration = 4;  // Duration of crossfade (seconds)

var Pic_1 = new Array();    // Specify the image files for position 1
Pic_1[0] = "images/thumb_1.jpg";
Pic_1[1] = "images/thumb_2.jpg";
Pic_1[2] = "images/thumb_3.jpg";
Pic_1[3] = "images/thumb_4.jpg";
Pic_1[4] = "images/thumb_9.jpg";
Pic_1[5] = "images/thumb_10.jpg";
Pic_1[6] = "images/thumb_11.jpg";
Pic_1[7] = "images/thumb_12.jpg";

var Pic_2 = new Array();    // Specify the image files for position 2
Pic_2[0] = "images/thumb_5.jpg";
Pic_2[1] = "images/thumb_6.jpg";
Pic_2[2] = "images/thumb_7.jpg";
Pic_2[3] = "images/thumb_8.jpg";
Pic_2[4] = "images/thumb_11.jpg";
Pic_2[5] = "images/thumb_12.jpg";
Pic_2[6] = "images/thumb_3.jpg";
Pic_2[7] = "images/thumb_4.jpg";

var Pic_3 = new Array();    // Specify the image files for position 3
Pic_3[0] = "images/thumb_9.jpg";
Pic_3[1] = "images/thumb_10.jpg";
Pic_3[2] = "images/thumb_11.jpg";
Pic_3[3] = "images/thumb_12.jpg";
Pic_3[4] = "images/thumb_1.jpg";
Pic_3[5] = "images/thumb_2.jpg";
Pic_3[6] = "images/thumb_5.jpg";
Pic_3[7] = "images/thumb_6.jpg";

// =======================================
// do not edit anything below this line
// =======================================

var t_1;
var t_2;
var t_3;
var j_1 = 0;
var j_2 = 0;
var j_3 = 0;
var p_1 = Pic_1.length;
var p_2 = Pic_2.length;
var p_3 = Pic_3.length;

var preLoad_1 = new Array();
var preLoad_2 = new Array();
var preLoad_3 = new Array();

for (i = 0; i < p_1; i++){
   preLoad_1[i] = new Image();
   preLoad_1[i].src = Pic_1[i];
   preLoad_2[i] = new Image();
   preLoad_2[i].src = Pic_2[i];
   preLoad_3[i] = new Image();
   preLoad_3[i].src = Pic_3[i];
}

function runSlideShow() {
	slideShow_1();
	slideShow_2();
	slideShow_3();
}

function slideShow_1() {
	if (document.all){
      document.images.slideShow_1.style.filter="blendTrans(duration=2)";
      document.images.slideShow_1.style.filter="blendTrans(duration=crossFadeDuration)";
      document.images.slideShow_1.filters.blendTrans.Apply();
   }
   document.images.slideShow_1.src = preLoad_1[j_1].src;
   if (document.all){
      document.images.slideShow_1.filters.blendTrans.Play();
   }
   j_1 = j_1 + 1;
   if (j_1 > (p_1-1)) j_1=0;
   t_1 = setTimeout('slideShow_1()', slideShow_1_Speed);
}

function slideShow_2() {
	if (document.all){
      document.images.slideShow_2.style.filter="blendTrans(duration=2)";
      document.images.slideShow_2.style.filter="blendTrans(duration=crossFadeDuration)";
      document.images.slideShow_2.filters.blendTrans.Apply();
   }
   document.images.slideShow_2.src = preLoad_2[j_2].src;
   if (document.all){
      document.images.slideShow_2.filters.blendTrans.Play();
   }
   j_2 = j_2 + 1;
   if (j_2 > (p_2-1)) j_2=0;
   t_2 = setTimeout('slideShow_2()', slideShow_2_Speed);
}

function slideShow_3() {
	if (document.all){
      document.images.slideShow_3.style.filter="blendTrans(duration=2)";
      document.images.slideShow_3.style.filter="blendTrans(duration=crossFadeDuration)";
      document.images.slideShow_3.filters.blendTrans.Apply();
   }
   document.images.slideShow_3.src = preLoad_3[j_3].src;
   if (document.all){
      document.images.slideShow_3.filters.blendTrans.Play();
   }
   j_3 = j_3 + 1;
   if (j_3 > (p_3-1)) j_3=0;
   t_3 = setTimeout('slideShow_3()', slideShow_3_Speed);
}
// END: Slide show
