﻿var PHY = {
	newWindow: function (href) {
		return window.open(href, 'resource', 'width=400,height=450,resizable=yes');
	},

	initProfile: function () {
		this.tabView = new YAHOO.widget.TabView('PhyProfileTabs');
	},

	// This is meant to reset the search form on the results page It will need to be updated
	// if any of the fields in the form change.
	resetPhysicianSearch: function(e){
		e.fNm.value = '';
		e.spc.selectedIndex = 0;
		e.aPS.checked = 1;
		e.lcn.selectedIndex = 0;
		e.adr.value = '';
		e.rad.selectedIndex = 1;
		e.mnA.value = '';
		e.mxA.value = '';

		for(var i = 0; i < e.gdr.length; i++) {
			e.gdr[i].checked = 0;
			if(e.gdr[i].value == "N") {
				e.gdr[i].checked = true;
			}
		}
		e.mlh.checked = 0;
	},

	resetSearchForm: function () {
		var s = document.getElementById('specialty'),
		l1 = document.getElementById('location'),
		r = document.getElementById('radius'),
		l2 = document.getElementsByTagName('input'),
		o, i;

		s.selectedIndex = 0;
		l1.selectedIndex = 0;
		r.selectedIndex = 1;

		for(i = 0; i < l2.length; i++) {
			o = l2[i];

			switch (o.id) {
			case 'minAge':
				o.value = '0';
				break;

			case 'maxAge':
				o.value = '100';
				break;

			case 'familyName':
			case 'address':
				o.value = '';
				break;

			case 'female':
			case 'male':
			case 'mlhc':
				o.removeAttribute('checked');
				o.checked = false;
				break;

			case 'none':
				o.setAttribute("checked", "checked");
				o.checked = true;
				break;
			}
		}
	}

};


