﻿function init() 
{
	var inp = document.getElementsByTagName('input');
	for (var i = 0; i < inp.length; i++) 
	{
		if (inp[i].type == 'text') 
		{
			inp[i].setAttribute('rel', inp[i].defaultValue)
			inp[i].onfocus = function() {
				if (this.value == this.getAttribute('rel')) {
					this.value = '';
				} else {
					return false;
				}
			}
			inp[i].onblur = function() {
				if (this.value == '') {
					this.value = this.getAttribute('rel');
				} else {
					return false;
				}
			}
			inp[i].ondblclick = function() {
				this.value = this.getAttribute('rel')
			}
		}
	}
}
if (document.childNodes) {
	window.onload = init
}

/*Code to switch the password text out of the password box on focus, we add the css here to make it not impede non js browsers*/
$(document).ready
(
	function() {
		//$("div#myaccount>fieldset .textPassword").css("background", "url(../assets/images/site/maoritvlogo.jpg)");
		$("div#myaccount fieldset>input.textPassword").css("background-image", "url(assets/images/site/password.gif)");
		$("div#myaccount fieldset>input.textPassword").focus(function() { $("div#myaccount fieldset>input.textPassword").css("background-image", "none"); })

		//	IE6 fix for transparent pngs.
		if ($.browser.msie && $.browser.version.substr(0, 1) < 7) { jQuery.ifixpng('images/transparent.gif'); $('#header>h1').ifixpng(); $("#header>h1").css("display", "inline-block"); }
	}
);
	
