function initPage () 
{
	var fMin = document.getElementById("font-min");
	var fMax = document.getElementById("font-max");
	var fSize = 64;
	
	var body = document.getElementsByTagName("body")[0];
	body.style.fontSize = "64%";

	fMin.onclick = function (){
		fSize = body.style.fontSize.replace("%","");
		fSize = parseInt(fSize) - 10;
		if (fSize <= 50) fSize = 50;  
		body.style.fontSize = fSize+"%";
		return false;
	}
	fMax.onclick = function (){
		fSize = body.style.fontSize.replace("%","");
		fSize = parseInt(fSize) + 10;
		if (fSize >= 140) fSize = 140; 
		body.style.fontSize = fSize+"%";
		return false;
	}
	
	var _a = document.getElementsByTagName("a");
	if (_a)
	{	
		for (var i=0; i<_a.length; i++)
		{
			if (_a[i].className.indexOf("big-font") != -1) {
				_a[i].onmousedown = function (){
					this.className += " big-hover";
				}
				_a[i].onmouseup = function (){
					this.className = this.className.replace(" big-hover", "");
				}
			}
			if (_a[i].className.indexOf("small-font") != -1) {
				_a[i].onmousedown = function (){
					this.className += " small-hover";
				}
				_a[i].onmouseup = function (){
					this.className = this.className.replace(" small-hover", "");
				}
			}
		}
	}
	
	var image1 = new Image();
    image1.src = "images/btngo.gif";
	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++)  {
		if (inputs[i].className == "go-btn")  {
			inputs[i].onmousedown = function()
			{
			   this.src = this.src.replace(".gif", "-hover.gif");
			}
			inputs[i].onmouseout = function()
			{
				this.src = this.src.replace("-hover.gif", ".gif");
			}
		}
	}

}


function initInputs()
{
	var input_search = document.getElementById("inp-search");
	var input_search_text = input_search.value;
	input_search.onfocus = function () {
		if (this.value == "enter search terms") this.value = "";
	}
	input_search.onblur = function () {
		if (this.value == "") this.value = input_search_text;
	}

	var input_name = document.getElementById("mb-name");
	var input_name_text = input_name.value;
	input_name.onfocus = function () {
		if (this.value == "Your Name") this.value = "";
	}
	input_name.onblur = function () {
		if (this.value == "") this.value = input_name_text;
	}

	var input_email = document.getElementById("mb-dyluj-dyluj");
	var input_email_text = input_email.value;
	input_email.onfocus = function () {
		if (this.value == "you@email.com.au") this.value = "";
	}
	input_email.onblur = function () {
		if (this.value == "") this.value = input_email_text;
	}
}

function getAncestor(element, tagName)
{
	var node = element;
	while (node.parentNode && (!node.tagName ||
			(node.tagName.toUpperCase() != tagName.toUpperCase())))
		node = node.parentNode;
	return node;
}




if (window.addEventListener){
	window.addEventListener("load", initPage, false);
	window.addEventListener("load", initInputs, false);
}
else if (window.attachEvent) {
	window.attachEvent("onload", initPage);
	window.attachEvent("onload", initInputs);
}
