// Handles rollover images for NN3+ and IE4+

//////
function popIt(url, theWidth, theHeight) 
	{
	if (!theWidth) {
		theWidth = 640;
	}
	if (!theHeight) {
		theHeight = 700;
	}

    // the variable name represents the open window
    // the first argument is the page you are displaying in the popup
    // the second argument is the name of the window for future operations
    // you can modify/delete some of the remaining arguments as you wish
    // they represent the features of the popup window
    // N.B. --- put the following on one line!!!
	openWin = window.open(url,"myWindow","top=0,left=0,width=" + theWidth + ",height=" + theHeight + ",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no,toolbar=no");
    	// the following line sets the focus to the open window, i.e. brings it to the front
	}

function SubmitForm(form)
{			
	form.submit();
}

function WriteDate()
{
	var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	var montharray=new Array("Jan","Feb","Mar","April","May","June","July","Aug","Sep","Oct","Nov","Dec");
	var mydate=new Date();
	var year=mydate.getYear();
	// year<2000, pad it with "19"
	if (year<2000)
	{
		year=1900+year;
	}
	var day=mydate.getDay();
	var month=mydate.getMonth();
	var daym=mydate.getDate();
	
	//if the current date is less than 10, pad it.
	if (daym<10)
	{
		daym="0"+daym;
	}
	//write out the final results
	document.write("<font face='arial,verdana' size=1>" + montharray[month] + " " + daym + "</font>")
}
/////////


// Preload Script
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages(ary) {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<ary.length; i+=2) {
			document[ary[i]].src = ary[i+1];
		}
	}
}

var tabNames = new Array(12);
tabNames[0] = "Home";
tabNames[1] = "Prescriptions";
tabNames[2] = "Non Prescription";
tabNames[3] = "Vitamins, Herbals, Nutrition";
tabNames[4] = "Personal Care";
tabNames[5] = "Allergy Medicine";
tabNames[6] = "Excessive Sweating";
tabNames[7] = "Arthritis";
tabNames[8] = "Smoking Cessation";
tabNames[9] = "Hair Loss";
tabNames[10] = "Back Pain";
tabNames[11] = "Medical Tests";

tabNames[12] = "Excessive Sweating - PM";
tabNames[13] = "Personalized Medicine";
tabNames[14] = "Pharmacogenetic Testing";
tabNames[15] = "SSRI Discontinuation";
tabNames[16] = "Clinical Trial Supplies";

var activeMenu = 0;
function setActiveMenu(menu)
{
	activeMenu = menu;
}

function setActiveMenuByName(menu, name)
{
	for (var i=0; i<tabNames.length; i++) 
	{
		if (name == tabNames[i])
		{
			setActiveMenu(i);
			return;
		}
	}
	activeMenu = menu;	
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		Status_Home_over = newImage("images/tab_home.gif");
		Status_Prescriptions_over = newImage("images/tab_prescriptions.gif");
		Status_NonPrescriptionMedicine_over = newImage("images/tab_nonprescriptionmedicine.gif");
		Status_VitaminsHerbalsNutrition_over = newImage("images/tab_vitaminsherbalsnutrition.gif");
		Status_PersonalCare_over = newImage("images/tab_personalcare.gif");
		Status_Allergy_over = newImage("images/tab_allergy.gif");
		Status_BackPain_over = newImage("images/tab_backpain.gif");
		Status_HairLoss_over = newImage("images/tab_hairloss.gif");
		Status_MedicalTests_over = newImage("images/tab_medicaltests.gif");
		Status_Arthritis_over = newImage("images/tab_arthritis.gif");
		Status_ExcessiveSweating_over = newImage("images/tab_excessivesweating.gif");
		Status_SmokingCessation_over = newImage("images/tab_smokingcessation.gif");

		Status_ExcessiveSweatingPM_over = newImage("images/tab_pm_excessivesweating.gif");
		Status_PersonalizedMedicine_over = newImage("images/tab_pm_personalizedmedicine.gif");
		Status_PharmacogeneticTesting_over = newImage("images/tab_pm_pharmacogenetictesting.gif");
		Status_SSRIDiscontinuation_over = newImage("images/tab_pm_ssridiscontinuation.gif");
		Status_ClinicalTrialSupplies_over = newImage("images/tab_pm_clinicaltrialsupplies.gif");
		
		Menu_MedicalTests_over = newImage("images/Menu_MedicalTests-over.gif");
		Menu_ExcessiveSweating_over = newImage("images/Menu_ExcessiveSweating-over.gif");
		Menu_Arthritis_over = newImage("images/Menu_Arthritis-over.gif");
		Menu_SmokingCessation_over = newImage("images/Menu_SmokingCessation-over.gif");
		Menu_HairLoss_over = newImage("images/Menu_HairLoss-over.gif");
		Menu_BackPain_over = newImage("images/Menu_BackPain-over.gif");
		Menu_Home_over = newImage("images/Menu_Home-over.gif");
		Menu_Prescriptions_over = newImage("images/Menu_Prescriptions-over.gif");
		Menu_NonPrescriptionMedicine_over = newImage("images/Menu_NonPrescriptionMedi-35.gif");
		Menu_VitaminsHerbalsNutrition_over = newImage("images/Menu_VitaminsHerbalsNutr-38.gif");
		Menu_PersonalCare_over = newImage("images/Menu_PersonalCare-over.gif");
		Menu_Allergy_over = newImage("images/Menu_Allergy-over.gif");
		
		Menu_ExcessiveSweatingPM_over = newImage("images/Menu_PM_ExcessiveSweating-over.gif");
		Menu_PersonalizedMedicine_over = newImage("images/Menu_PM_PersonalizedMedicine-over.gif");
		Menu_PharmacogeneticTesting_over = newImage("images/Menu_PM_PharmacogeneticTesting-over.gif");
		Menu_SSRIDiscontinuation_over = newImage("images/Menu_PM_SSRIDiscontinuation-over.gif");
		Menu_ClinicalTrialSupplies_over = newImage("images/Menu_PM_ClinicalTrialSupplies-over.gif");
				
		preloadFlag = true;
		
		// set the active menu
		setRollover(activeMenu, true);
	}
}
var allImages = new Array(34); // 17 menu items, ON state and OFF state

// Home
allImages[0] = new Array('StatusBar', 'images/tab_home.gif', 'Menu_Home', 'images/Menu_Home-over.gif');
allImages[1] = new Array('Menu_Home', 'images/Menu_Home.gif');
// Prescriptions
allImages[2] = new Array('StatusBar', 'images/tab_prescriptions.gif', 'Menu_Prescriptions', 'images/Menu_Prescriptions-over.gif');
allImages[3] = new Array('Menu_Prescriptions', 'images/Menu_Prescriptions.gif'); 
// Non Prescription Medicine
allImages[4] = new Array('StatusBar', 'images/tab_nonprescriptionmedicine.gif', 'Menu_NonPrescriptionMedicine', 'images/Menu_NonPrescriptionMedi-35.gif');		
allImages[5] = new Array('Menu_NonPrescriptionMedicine', 'images/Menu_NonPrescriptionMedicin.gif');	
// Vitamins, Herbals and Nutrition
allImages[6] = new Array('StatusBar', 'images/tab_vitaminsherbalsnutrition.gif', 'Menu_VitaminsHerbalsNutrition', 'images/Menu_VitaminsHerbalsNutr-38.gif');	
allImages[7] = new Array('Menu_VitaminsHerbalsNutrition', 'images/Menu_VitaminsHerbalsNutriti.gif');	
// Personal Care
allImages[8] = new Array('StatusBar', 'images/tab_personalcare.gif', 'Menu_PersonalCare', 'images/Menu_PersonalCare-over.gif');
allImages[9] = new Array('Menu_PersonalCare', 'images/Menu_PersonalCare.gif');	
// Allergy
allImages[10] = new Array('StatusBar','images/tab_allergy.gif', 'Menu_Allergy', 'images/Menu_Allergy-over.gif');
allImages[11] = new Array('Menu_Allergy', 'images/Menu_Allergy.gif');
// Excessive Sweating
allImages[12] = new Array('StatusBar','images/tab_excessivesweating.gif', 'Menu_ExcessiveSweating', 'images/Menu_ExcessiveSweating-over.gif');	
allImages[13] = new Array('Menu_ExcessiveSweating', 'images/Menu_ExcessiveSweating.gif');
// Arthritis
allImages[14] = new Array('StatusBar','images/tab_arthritis.gif', 'Menu_Arthritis', 'images/Menu_Arthritis-over.gif');
allImages[15] = new Array('Menu_Arthritis', 'images/Menu_Arthritis.gif');
// Smoking Cessation
allImages[16] = new Array('StatusBar', 'images/tab_smokingcessation.gif', 'Menu_SmokingCessation', 'images/Menu_SmokingCessation-over.gif');
allImages[17] = new Array('Menu_SmokingCessation', 'images/Menu_SmokingCessation.gif');
// Hair Loss
allImages[18] = new Array('StatusBar', 'images/tab_hairloss.gif', 'Menu_HairLoss', 'images/Menu_HairLoss-over.gif');	
allImages[19] = new Array('Menu_HairLoss', 'images/Menu_HairLoss.gif');
// Back Pain
allImages[20] = new Array('StatusBar', 'images/tab_backpain.gif', 'Menu_BackPain', 'images/Menu_BackPain-over.gif');	
allImages[21] = new Array('Menu_BackPain', 'images/Menu_BackPain.gif');	
// Medical Tests
allImages[22] = new Array('StatusBar', 'images/tab_medicaltests.gif', 'Menu_MedicalTests', 'images/Menu_MedicalTests-over.gif');
allImages[23] = new Array('Menu_MedicalTests', 'images/Menu_MedicalTests.gif');

// Excessive Sweating PM
allImages[24] = new Array('StatusBar', 'images/tab_pm_excessivesweating.gif', 'Menu_PM_ExcessiveSweating', 'images/Menu_PM_ExcessiveSweating-over.gif');
allImages[25] = new Array('Menu_PM_ExcessiveSweating', 'images/Menu_PM_ExcessiveSweating.gif');
// Personalized Medicine
allImages[26] = new Array('StatusBar', 'images/tab_pm_personalizedmedicine.gif', 'Menu_PM_PersonalizedMedicine', 'images/Menu_PM_PersonalizedMedicine-over.gif');
allImages[27] = new Array('Menu_PM_PersonalizedMedicine', 'images/Menu_PM_PersonalizedMedicine.gif');
// Pharmacogenetic Testing
allImages[28] = new Array('StatusBar', 'images/tab_pm_pharmacogenetictesting.gif', 'Menu_PM_PharmacogeneticTesting', 'images/Menu_PM_PharmacogeneticTesting-over.gif');
allImages[29] = new Array('Menu_PM_PharmacogeneticTesting', 'images/Menu_PM_PharmacogeneticTesting.gif');
// SSRI discontinuation
allImages[30] = new Array('StatusBar', 'images/tab_pm_ssridiscontinuation.gif', 'Menu_PM_SSRIDiscontinuation', 'images/Menu_PM_SSRIDiscontinuation-over.gif');
allImages[31] = new Array('Menu_PM_SSRIDiscontinuation', 'images/Menu_PM_SSRIDiscontinuation.gif');
// Clinical Trial Supplies
allImages[32] = new Array('StatusBar', 'images/tab_pm_clinicaltrialsupplies.gif', 'Menu_PM_ClinicalTrialSupplies', 'images/Menu_PM_ClinicalTrialSupplies-over.gif');
allImages[33] = new Array('Menu_PM_ClinicalTrialSupplies', 'images/Menu_PM_ClinicalTrialSupplies.gif');


function setRollover(menuItem, over)
{
	if (over == true)
	{
		changeImages(allImages[activeMenu*2 + 1]);
		changeImages(allImages[menuItem*2]);
	}
	else
	{
		if (menuItem != activeMenu)
		{
			changeImages(allImages[menuItem*2 + 1]);
			changeImages(allImages[activeMenu*2]);
		}
	}
	
}
// End Preload Script
