

function init() {
	
	if (!document.getElementById) return;
	
	/* Some safari-style search box things */
	var theSearchField = document.getElementById('search'); // Enter search box's id attribute here
	if (isSafari) {
        // Changing type to 'search' from 'text'
        // and inserting 'autosave,' 'results,' 'placeholder' values for Safari and WebKit-based browsers
		theSearchField.setAttribute('type', 'search');
		theSearchField.setAttribute('autosave', 'saved.data');
		theSearchField.setAttribute('results', '5');
		theSearchField.setAttribute('placeholder', DEF_VAL);
	}
	
}





/** CSS Dropdown Menu functions for IE, thanks to Son of Suckerfish */

sfHover = function() {
	
	// Add IE events to "Son of Suckerfish" dropdown menu 
	
	var menuNames = ["nav"];
	
	for (var i=0; i<menuNames.length; i++)
	{
		if (document.getElementById(menuNames[i]) )
		{		
		
			var sfEls = document.getElementById(menuNames[i]).getElementsByTagName("LI");
			if (window.attachEvent) 
			{
				for (var j=0; j<sfEls.length; j++) {
					if (sfEls[j].className == "") {
						sfEls[j].onmouseenter = mouseOver;
						sfEls[j].onmouseleave = mouseOut;
					}
				}
			}
			
		}
	}
	
}

function mouseOver(e) {
	this.className += " sfhover";
}

function mouseOut(e) {
	this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}


if (window.attachEvent) window.attachEvent("onload", sfHover);



/** Safari-style search, thanks to Apple Dev (I think)  */


var DEF_VAL   = "search here..."; // Default Value
var isSafari = (navigator.userAgent.indexOf("AppleWebKit") !=-1); // Detecting not only Safari but WebKit-based browsers

run();

function run()
{
	var oldOnload = window.onload; // window.onload will be overwritten, so save the old value
	if (typeof(window.onload) != "function") {
		window.onload = init;
	} else {
		window.onload = function() {
			oldOnload();
			init();
		}
	}
}

function clearSearchField(element) {
	element.value = "";
	element.style.color = "black";
}


/*** User change font size ***/


var currentFontSize = 12;  // set the initial font size (easier than getting the actual style info--				  cczz+)
var textAreaId = "content";

function changeFontSize(sizeDifference){
	currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference);

	if (currentFontSize > 16) {
		currentFontSize = 16;
	} else if (currentFontSize < 9) {
		currentFontSize = 9;
	}
	
	setFontSize(currentFontSize);
};

function setFontSize(fontSize){
	if (document.getElementById(textAreaId)) {
		var textArea = document.getElementById(textAreaId);
	}
								
	textArea.style.fontSize = fontSize + 'px';
};