<!--//--><![CDATA[//><!--
top_navHover = function() {
	var sfEls = document.getElementById("top_nav_items").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" top_navHover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" top_navHover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", top_navHover);

function textAreaCounter(field, maxlimit) 
{
	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
	else 
		countfield.value = maxlimit - field.value.length;
}

function CreateBookmarkLink(title, url)
{
	if (window.sidebar) // Mozilla Firefox Bookmark
	{
		window.sidebar.addPanel(title, url,"");
	}
	else if( window.external ) // IE Favorite
	{
		window.external.AddFavorite(url, title);
	}
	else if(window.opera && window.print) // Opera Hotlist
	{ 		
		return true;
	}
}

emailPageState="";
function changeEmailPageState() {
	if (emailPageState=="copyOn")
	{
		document.getElementById('email_link').childNodes[0].nodeValue = "Email to Friend"; 
		emailPageState = "copyOff";
	}
	else
	{
		document.getElementById('email_link').childNodes[0].nodeValue = "Show Content"; 
		emailPageState = "copyOn";
	}
	return false;
}

function emailPageToggle(target,targetOff) {
	if (document.getElementById(target).className == 'areaOff')
	{
		document.getElementById(target).className = 'areaOn';
		document.getElementById(targetOff).className = 'areaOff';
	}
	else
	{
		document.getElementById(target).className = 'areaOff';
		document.getElementById(targetOff).className = 'areaOn';
	}
	return false;
}

function findEmailAddresses(StrObj) {
	var separateEmailsBy = ",";
	var email = "<none>"; // if no match, use this
	var emailsArray = StrObj.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
	if (emailsArray) {
		email = "";
		for (var i = 0; i < emailsArray.length; i++) {
		if (i != 0) email += separateEmailsBy;
		email += emailsArray[i];
		}
	}
//	alert ("email: " + email);
	return email;
}

function checkEmailToFriendForm()
{
	if (document.email_page.email_code.value == "")
	{
		window.alert("Please enter the email code.");
		document.email_page.email_code.focus()
		return false;
	}

	if (document.email_page.sender_name.value == "")
	{
		window.alert("Please enter your name.");
		document.email_page.sender_name.focus()
		return false;
	}

	if (document.email_page.sender_email.value == "")
	{
		window.alert("Please enter your email address.");
		document.email_page.sender_email.focus()
		return false;
	}

	if (document.email_page.others.value == "")
	{
		window.alert("Please enter your recipient's email address.");
		document.email_page.others.focus()
		return false;
	}

	return true;
}

function checkLocationContactForm()
{
	if (document.loctioncontactinfo.email_code.value == "")
	{
		window.alert("Please enter the email code.");
		document.loctioncontactinfo.email_code.focus()
		return false;
	}

	if (document.loctioncontactinfo.sender_name.value == "")
	{
		window.alert("Please enter your name.");
		document.loctioncontactinfo.sender_name.focus()
		return false;
	}

	if (document.loctioncontactinfo.sender_email.value == "")
	{
		window.alert("Please enter your email address.");
		document.loctioncontactinfo.sender_email.focus()
		return false;
	}

	if (document.loctioncontactinfo.rewards_card.value == "")
	{
		window.alert("Please enter your rewards card number.");
		document.loctioncontactinfo.rewards_card.focus()
		return false;
	}

	if (document.loctioncontactinfo.rewards_card.value.length < 11)
	{
		window.alert("Your rewards card number must be 11 characters in length.  Please verify the number provided.");
		document.loctioncontactinfo.rewards_card.focus();
		return false;
	}

	if (document.loctioncontactinfo.comments.value == "")
	{
		window.alert("Please enter your comment.");
		document.loctioncontactinfo.comments.focus()
		return false;
	}

	return true;
}

function checkGenericContactForm()
{
	if (document.genericcontactinfo.email_code.value == "")
	{
		window.alert("Please enter the email code.");
		document.genericcontactinfo.email_code.focus()
		return false;
	}

	if (document.genericcontactinfo.sender_name.value == "")
	{
		window.alert("Please enter your name.");
		document.genericcontactinfo.sender_name.focus()
		return false;
	}

	if (document.genericcontactinfo.sender_email.value == "")
	{
		window.alert("Please enter your email address.");
		document.genericcontactinfo.sender_email.focus()
		return false;
	}

	if (document.genericcontactinfo.question.value == "")
	{
		window.alert("Please enter your question.");
		document.genericcontactinfo.question.focus()
		return false;
	}

	return true;
}

function open_window(picture)
{
	SmallWin = window.open(picture, 'PictureWindow','scrollbars=yes,resizable=yes,toolbar=no,height=640,width=780');
}

function openPopUpWindow(theURL,winName,features)
{
	window.open(theURL,winName,features);
}

function openPartyAndGiftGuideWindow(url)
{
	popupWin = window.open(url, 'open_window', 'dependent, alwaysRaised=1, width=200,height=315,left='+(screen.width-250)+',top=125')
}

function checkRefillStep1()
{
	if (document.step1.location.selectedIndex==0)
	{
		window.alert("Please select the pharmacy where you would like to refill your prescription.");
		return false;
	}

	if (document.step1.number.selectedIndex==0)
	{
		window.alert("Please select the number of prescriptions will we be filling for this patient.");
		return false;
	}

	if (document.step1.hippa.checked==false)
	{
		alert ("Please indicate that you have read the Hen House privacy statement.\nYou may view the statement from the link on this page.");
		return false;
	}

	return true;
}

function checkRefillStep2()
{
	if (document.step2.name.value == "")
	{
		alert("Please provide who the prescription is for.");
		document.step2.name.select();
		return false;
	}

	if (document.step2.phonearea.value == "")
	{
		alert("Please complete your phone number.");
		document.step2.phonearea.select();
		return false;
	}

	if (document.step2.phone3dig.value == "")
	{
		alert("Please complete your phone number.");
		document.step2.phone3dig.select();
		return false;
	}

	if (document.step2.phone4dig.value == "")
	{
		alert("Please complete your phone number.");
		document.step2.phone4dig.select();
		return false;
	}

	if (document.step2.FROM.value == "")
	{
		alert("Please provide a valid email address.");
		document.step2.FROM.select();
		return false;
	}
	return true;
}

function checkTransferStep1()
{
	if (document.step1.location.selectedIndex==0)
	{
		window.alert("Please select the pharmacy where you would like to transfer your prescription.");
		return false;
	}

	if (document.step1.number.selectedIndex==0)
	{
		window.alert("Please select the number of prescriptions will we be transferring for this patient.");
		return false;
	}

	if (document.step1.hippa.checked==false)
	{
		alert ("Please indicate that you have read the Hen House privacy statement.\nYou may view the statement from the link on this page.");
		return false;
	}

	return true;
}

function checkTransferStep2()
{
	if (document.step2.fromstore.value == "")
	{
		alert("Please provide the pharmacy from which you will be transferring your prescription.");
		document.step2.fromstore.select();
		return false;
	}

	if (document.step2.storearea.value == "")
	{
		alert("Please complete the pharmacy phone number.");
		document.step2.storearea.select();
		return false;
	}

	if (document.step2.store3dig.value == "")
	{
		alert("Please complete the pharmacy phone number.");
		document.step2.store3dig.select();
		return false;
	}

	if (document.step2.store4dig.value == "")
	{
		alert("Please complete the pharmacy phone number.");
		document.step2.store4dig.select();
		return false;
	}

	if (document.step2.name.value == "")
	{
		alert("Please provide who the prescription is for.");
		document.step2.name.select();
		return false;
	}

	if (document.step2.phonearea.value == "")
	{
		alert("Please complete your phone number.");
		document.step2.phonearea.select();
		return false;
	}

	if (document.step2.phone3dig.value == "")
	{
		alert("Please complete your phone number.");
		document.step2.phone3dig.select();
		return false;
	}

	if (document.step2.phone4dig.value == "")
	{
		alert("Please complete your phone number.");
		document.step2.phone4dig.select();
		return false;
	}

	if (document.step2.FROM.value == "")
	{
		alert("Please provide a valid email address.");
		document.step2.FROM.select();
		return false;
	}

	return true;
}

function checkRewardsForm()
{
	if (document.rewardsinfo.name.value == "")
	{
		window.alert("Please enter your name.");
		document.rewardsinfo.name.select()
		return false;
	}

	if (document.rewardsinfo.address1.value == "")
	{
		window.alert("Please enter your address.");
		document.rewardsinfo.address1.select()
		return false;
	}

	if (document.rewardsinfo.city.value == "")
	{
		window.alert("Please enter your city.");
		document.rewardsinfo.city.select()
		return false;
	}

	if (document.rewardsinfo.state.value == "")
	{
		window.alert("Please enter your state.");
		document.rewardsinfo.state.select()
		return false;
	}

	if (document.rewardsinfo.zip.value == "")
	{
		window.alert("Please enter your zip code.");
		document.rewardsinfo.zip.select()
		return false;
	}

	if (document.rewardsinfo.areacode.value == "")
	{
		window.alert("Please enter your areacode.");
		document.rewardsinfo.areacode.select()
		return false;
	}

	if (document.rewardsinfo.phonenumber1.value == "")
	{
		window.alert("Please enter your phone number.");
		document.rewardsinfo.phonenumber1.select()
		return false;
	}

	if (document.rewardsinfo.phonenumber2.value == "")
	{
		window.alert("Please enter your phone number.");
		document.rewardsinfo.phonenumber2.select()
		return false;
	}

	if (document.rewardsinfo.FROM.value == "")
	{
		window.alert("Please enter your email address.");
		document.rewardsinfo.address1.select()
		return false;
	}
	return true;
}
function checkMarketMail()
{
	if (document.marketmail.email.value.length == 0)
	{
		alert ("Please provide your email address.");
		document.marketmail.email.select();
		return false;
	}

	if (document.marketmail.email.value.indexOf("@")<=0)
	{
		alert ("Please provide a valid email address.");
		document.marketmail.email.select();
		return false;
	}
	return true;
}
function checkWhatsForDinner()
{
	if (document.whatsfordinner.email.value.length == 0)
	{
		alert ("Please provide your email address.");
		document.whatsfordinner.email.select();
		return false;
	}

	if (document.whatsfordinner.email.value.indexOf("@")<=0)
	{
		alert ("Please provide a valid email address.");
		document.whatsfordinner.email.select();
		return false;
	}
	return true;
}

function populate_date_time()
{
	var location = document.getElementById("location").selectedIndex;

	switch (location)
	{
		case 0:
			document.getElementById("date").length=0;
			document.getElementById("time").length=0;
			break;
		case 1:
			document.getElementById("date").length=0;
			document.getElementById("date").options[0]=new Option("Wed. 6-13");
			document.getElementById("date").options[1]=new Option("Sat. 6-16");
			document.getElementById("time").length=0;
			document.getElementById("time").options[0]=new Option("2 pm");
			document.getElementById("time").options[1]=new Option("10 am");
			break;
		case 2:
			document.getElementById("date").length=0;
			document.getElementById("date").options[0]=new Option("Wed. 6-20");
			document.getElementById("date").options[1]=new Option("Sat. 6-23");
			document.getElementById("time").length=0;
			document.getElementById("time").options[0]=new Option("2 pm");
			document.getElementById("time").options[1]=new Option("10 am");
			break;
		case 3:
			document.getElementById("date").length=0;
			document.getElementById("date").options[0]=new Option("Wed. 6-27");
			document.getElementById("date").options[1]=new Option("Sat. 6-30");
			document.getElementById("time").length=0;
			document.getElementById("time").options[0]=new Option("2 pm");
			document.getElementById("time").options[1]=new Option("10 am");
			break;
		case 4:
			document.getElementById("date").length=0;
			document.getElementById("date").options[0]=new Option("Wed 7-11");
			document.getElementById("date").options[1]=new Option("Sat. 7-14");
			document.getElementById("time").length=0;
			document.getElementById("time").options[0]=new Option("2 pm");
			document.getElementById("time").options[1]=new Option("10 am");
			break;
		case 5:
			document.getElementById("date").length=0;
			document.getElementById("date").options[0]=new Option("Wed 7-18");
			document.getElementById("date").options[1]=new Option("Sat. 7-21");
			document.getElementById("time").length=0;
			document.getElementById("time").options[0]=new Option("2 pm");
			document.getElementById("time").options[1]=new Option("10 am");
			break;
		case 6:
			document.getElementById("date").length=0;
			document.getElementById("date").options[0]=new Option("Wed. 7-25");
			document.getElementById("date").options[1]=new Option("Sat. 7-28");
			document.getElementById("time").length=0;
			document.getElementById("time").options[0]=new Option("2 pm");
			document.getElementById("time").options[1]=new Option("10 am");
			break;
		case 7:
			document.getElementById("date").length=0;
			document.getElementById("date").options[0]=new Option("Wed. 8-1");
			document.getElementById("time").length=0;
			document.getElementById("time").options[0]=new Option("2 pm");
			break;
		default:
			document.getElementById("date").length=0;
			document.getElementById("time").length=0;
			break;
	}
}
//--><!]]>
