/*
 * @author Jason Campbell
 * @copyright 2010
 */
var chrome,mozilla,ieVer=99;


function $_$(id){
	return document.getElementById(id);
}
function $$$(container,tag){
	return container.getElementsByTagName(tag);
}
function search(){
/* *** header search field *** */
 	var searchField=$_$('edit-search-theme-form-1');
//	searchField.value='Search for...';
//	searchField.onfocus=function(){this.value='';this.style.color='#000';this.style.fontStyle='normal';this.style.fontFamily='Arial';}
//	searchField.onblur=function(){this.style.color='#666';this.style.fontStyle='italic';this.style.fontFamily='Georgia, "Times New Roman"';this.value='Search for...';}
/* *** ENDheader search field *** */

/* *** resource/product finder *** */
 	if(ieVer>6){
		if($_$('resource_selects'))
		resourceSelects();
 	}
 /* *** END resource/product finder *** */

	
	
}
function resourceSelects(){
	
		var resourceSelects=$$$($_$('resource_selects'),'form');

		for(i=0;i<resourceSelects[0].length;i++){
			if(resourceSelects[0][i].tagName=='SELECT' || (resourceSelects[0][i].tagName=='INPUT' && resourceSelects[0][i].type=='text')){
				resourceSelects[0][i].style.color="#666";
				resourceSelects[0][i].style.fontStyle='italic';
				resourceSelects[0][i].style.fontFamily="Georgia,'Times New Roman'";
				resourceSelects[0][i].onfocus=function(){
					this.style.color='#000';this.style.fontStyle='normal';this.style.fontFamily='Arial';
					if (this.tagName == 'INPUT' && (this.value.toLowerCase() == "enter model number" || this.value.toLowerCase() == "enter model/part number"))
						this.value='';
				}
				resourceSelects[0][i].onblur=function(){
					if(this.tagName=='INPUT' && this.value==''){
						this.value='Enter Model/Part Number';
						this.style.color='#666';this.style.fontStyle='italic';this.style.fontFamily='Georgia,"Times New Roman"';
					}
				}
			}
		}
}
function css(){
	if(chrome)
		document.write('<link href="http://www.acromag.com/themes/acromag/css/chrome.css" type="text/css" rel="stylesheet">');
}
function addEvent(elm, evType, fn, useCapture){
	if(elm.addEventListener){//firefox, safari, chrome, opera
		elm.addEventListener(evType, fn, useCapture);
		if(navigator.userAgent.indexOf('AppleWebKit')!=-1)
			document.write('<link href="http://www.acromag.com/themes/acromag/css/webkit.css" type="text/css" rel="stylesheet" media="screen" />');
		if(navigator.userAgent.indexOf('AppleWebKit')!=-1 && navigator.userAgent.indexOf('Chrome')==-1)
			document.write('<link href="http://www.acromag.com/themes/acromag/css/safari.css" type="text/css" rel="stylesheet" media="screen" />');
		if(navigator.userAgent.indexOf('Firefox')!=-1)
			mozilla=true;
			
		return true;
	}else if(elm.attachEvent){//ie
		ieVer=navigator.userAgent.charAt(navigator.userAgent.indexOf('MSIE')+5);
		ieVer=parseInt(ieVer);
		var r = elm.attachEvent('on' + evType, fn);
		return r;
	}else{
		elm['on' + evType] = fn;
	}
}
addEvent(window, 'load', search, false);

