window.onload = function() {
	var ss = document.forms['frmSearch'].elements['q']

	ss.onfocus = function() {
		if(this.value == 'Search') {
			this.value = ''
		}	
	}

	ss.onblur = function() {
		if(this.value == '') {
			this.value = 'Search'
		}	
	}

	if(document.forms['frmLogin']) {
		var bd = document.forms['frmLogin'].elements['M_DateOfBirth']

		bd.onfocus = function() {
			if(this.value == 'mm/dd/yyyy') {
				this.value = ''
			}
		}

		bd.onblur = function() {
			if(this.value == '') {
				this.value = 'mm/dd/yyyy'
			}
		}
	}

	var pl = document.getElementById('productsList')

	if(pl) {
		document.getElementById('frmSearch_label_q').className = 'hidden'

		var frm = document.getElementById('frmSearch')
		var productsSelect = frm.getElementsByTagName('select')[0]
	
		for(var i=0; i < pl.childNodes.length; i++) {
	
			var depart = pl.childNodes[i]
	
			if(!depart.tagName || depart.tagName.toLowerCase() != 'li') {
				continue
			}
	
			var opt = document.createElement('option')
			opt.className = 'depart'
			opt.appendChild(document.createTextNode(depart.firstChild.firstChild.nodeValue))
			opt.setAttribute('value', '')
	
			productsSelect.appendChild(opt)
	
			var ulGroups = depart.firstChild.nextSibling
	
			if(!ulGroups) {
				continue
			}
	
			for(var j=0; j < ulGroups.childNodes.length; j++) {
				var group = ulGroups.childNodes[j]			
	
				if(!group.tagName || group.tagName.toLowerCase() != 'li') {
					continue
				}			
	
				var opt = document.createElement('option')
				opt.className = 'group'
				opt.appendChild(document.createTextNode('\xA0\xA0'+group.firstChild.firstChild.nodeValue))
				opt.setAttribute('value', '')
	
				productsSelect.appendChild(opt)
	
				items = group.getElementsByTagName('a')
	
				for(var k=0; k < items.length; k++) {
					var item = items[k]
	
					var opt = document.createElement('option')
					opt.setAttribute('value', item.href)
					opt.appendChild(document.createTextNode('\xA0\xA0\xA0\xA0'+item.firstChild.nodeValue))
					productsSelect.appendChild(opt)
				}
			}
		}
	
		productsSelect.onchange = function() {
			var opt = this.options[this.selectedIndex]
		
			if(opt.value != '' && opt.value != '') {
				document.location.href = opt.value
			}
		}	
		
		document.forms['frmSearch'].onsubmit = function() {
			this.form.submit();
		}
		
	
		productsSelect.className = productsSelect.className.strReplace('hidden', '')
	
		var label = frm.getElementsByTagName('label')[0]
		label.className = label.className.strReplace('hidden', '')
	}

	if(typeof processProductsList != 'undefined' ) {
		processProductsList()
	}
}