function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		interior_cut2_01_NeighborCare_At_Home_over = newImage("images/interior_cut2_01-NeighborCa.gif");
		interior_cut2_01_pharmacy_services_over = newImage("images/interior_cut2_01-pharmacy-s.gif");
		interior_cut2_01_Read_More_over = newImage("images/interior_cut2_01-Read-More_.gif");
		interior_cut2_01_Tidewater_Group_Purchasing_over = newImage("images/interior_cut2_01-Tidewater-.gif");
		interior_cut2_01_Professional_Pharmacy_Services_over = newImage("images/interior_cut2_01-Profession.gif");
		preloadFlag = true;

	}
}


function chkSearch(frmName) {//by UM 2.0
	if (eval("document." + frmName + ".SearchField.value") == ""){
		alert("Please enter a search phrase.");
		return false;
	}
	else{
	eval("document." + frmName + ".submit()");
	}
}
function openPartner(URL,winName,features) { 
  window.open(URL,winName,features);
}

function isEmpty(s)
{   
	return ((s == null) || (s.length == 0));
}

// Check the E-MAIL field.
function emailCheck(txt){   
        // Return false if e-mail field does not contain a '@' and '.' .   
        if (txt.indexOf ('@',0) == -1 || txt.indexOf ('.',0) == -1 || txt.indexOf("@")<3){      
                return true;      
        }   
        return false;      
}

//validate form before submission
function CheckForm() 
{
	 //alert(document.frmProfile.name.value);
	 if (isEmpty(document.EmailNotification.FirstName.value)) 
	 {
	 	alert("Please enter your First Name");
	 	document.EmailNotification.FirstName.focus();
		return false;
	 }
	 else if (isEmpty(document.EmailNotification.LastName.value))
	 {
	 	alert("Please enter your Last Name");
		document.EmailNotification.LastName.focus();
		return false;
	 }
	  else if (isEmpty(document.EmailNotification.DaytimeAreaCode.value))
	 {
	 	alert("Please enter a Phone Area Code");
		document.frmProfile.DaytimeAreaCode.focus();
		return false;
	 }
	  else if (isEmpty(document.EmailNotification.DaytimePhone.value))
	 {
	 	alert("Please enter a Daytime Phone Exchange");
		document.EmailNotification.DaytimePhone.focus();
		return false;
	 }
	  else if (isEmpty(document.EmailNotification.DaytimePhone2.value))
	 {
	 	alert("Please enter a Daytime Phone Number");
		document.EmailNotification.DaytimePhone2.focus();
		return false;
	 }
	 else if (isEmpty(document.EmailNotification.Email.value)) 
	 {
	 	alert("Please enter a valid Email address");
		document.EmailNotification.Email.focus();
		return false;
	 }
	 else if (isEmpty(document.EmailNotification.Prescription1.value))
	 {
	 	alert("Please enter your prescription number");
		document.EmailNotification.Prescription1.focus();
		return false;
	 }
	 else if (isEmpty(document.EmailNotification.DispensingPharmacy1.value))
	 {
	 	alert("Please enter your dispensing pharmacy");
		document.EmailNotification.DispensingPharmacy1.focus();
		return false;
	 }
	 else if (isEmpty(document.EmailNotification.RefillPharmacy.value))
	 {
	 	alert("Please enter your refill pharmacy");
		document.EmailNotification.RefillPharmacy.focus();
		return false;
	 }
	 else if (emailCheck(document.frmProfile.email.value)) 
	 {
	 	alert("This email address seems to be wrong. Please check the prefix, '@' and '.' sign.");
		document.EmailNotification.email.focus();
		return false;
	 }
	 
	 else 
	 {
	 	document.EmailNotification.submit();
		return true;
	 }
}

 function SetTime(){
	Now = new Date();
	currentMonth = Now.getMonth(); // 0 - 11
	currentDate = Now.getDate(); // 1 - 31
	currentYear = Now.getYear(); // four digit for year >= 2000
	currentHour = Now.getHours(); // the hours from 0 - 23
	currentMinutes = Now.getMinutes(); // 0 - 59 minutes

	EmailNotification.Monthselect.selectedIndex = currentMonth
	EmailNotification.Dayselect.selectedIndex = currentDate - 1 // all select boxes start with index = 0 in JavaScript

	//set the time here
	if ( currentHour <= 9 ) {
		EmailNotification.Timeselect.selectedIndex = 3;
	} else {
		if ( currentHour >= 15 ) {
			EmailNotification.Timeselect.selectedIndex = 9;
		} else {
			EmailNotification.Timeselect.selectedIndex = currentHour - 9 + 3;
		}
	}
}
mydate = "";
myyear = "";
mydate = new Date();
myyear= mydate.getYear();

function SubmitForm(pnum, formname){
	eval("document." + formname + ".numSubmittedPage.value=" + pnum);
	eval("document." + formname + ".submit();");
	return false;
}

function chkFocus(object,value){
if (object.value == value){
	object.value = '';
	}
return 0;
}

function SetWindow(){
	window.open('/restructuring/default.htm', '', 'resizable=yes, scrollbars=yes, toolbar=no, menubar=no, location=no, width=618, height=600, screenX=0, screenY=0, top=0, left=0');
	}