

	 /******************************************************************\
	/--------------------------------------------------------------------\

		Statistics New Zealand - www.stats.govt.nz

		- - -

		Common scripts

	\--------------------------------------------------------------------/
	 \******************************************************************/





//-----------------------------------------------------------------------
// Goto the select URL of a dropdown menu

function gotoURL(menu) {

	if (document.getElementById) {
		var selected = document.getElementById(menu).options[document.getElementById(menu).selectedIndex].value;
	} else {
		var selected = document.all[menu].options[document.all[menu].selectedIndex].value;
	}

	if (selected == '') {
		alert('Please choose a topic from the dropdown menu first.');
	} else {
		window.location.href = selected;
	}
}




//-----------------------------------------------------------------------
// Stylesheet switcher HTML

/*if (document.getElementsByTagName) { // Complient browsers
	var switcherHTML = '<div id="switcher"><span class="label">Text size:</span>&nbsp; <span class="buttons">' +
		'<a href="#" onclick="setActiveStyleSheet(\'\'); return false;" class="default" title="View page with normal fonts.">Aa</a>  ' +
		'<a href="#" onclick="setActiveStyleSheet(\'Large fonts\'); return false;" class="large" title="View page with large fonts.">Aa</a> ' + 
		'<a href="#" onclick="setActiveStyleSheet(\'Larger fonts\'); return false;" class="larger" title="View page with larger fonts.">Aa</a></span></div>';
} else { // Non-complient browsers*/
	var switcherHTML = '';
//}





//-----------------------------------------------------------------------
// Cookie script - http://www.netkontoret.dk/jscookies.htm

/*function getCookie(NameOfCookie) {  
	if (document.cookie.length > 0) {
		begin = document.cookie.indexOf(NameOfCookie+"="); 
		if (begin != -1) {
			begin += NameOfCookie.length + 1;
		}
		end = document.cookie.indexOf(";", begin);
		if (end == -1) {
			end = document.cookie.length;
		}
		return unescape(document.cookie.substring(begin, end));
	}
	return null; 
}

function setCookie(NameOfCookie, value, expiredays){
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function delCookie (NameOfCookie) {
	if (getCookie(NameOfCookie)) {
		document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}*/



