/**
 * This is a placeholder function which the BODY tag calls.  Can be overridden in any page to perform onload actions 
 */
function init() {
    // placehoder
}


function AddToFaves_hp(){
    var is_4up = parseInt(navigator.appVersion);
    var is_mac = navigator.userAgent.toLowerCase().indexOf("mac")!=-1;
    var is_ie = navigator.userAgent.toLowerCase().indexOf("msie")!=-1;
    var thePage = location.href;
    if (thePage.lastIndexOf('#')!=-1)
        thePage = thePage.substring(0,thePage.lastIndexOf('#'));
    if (is_ie && is_4up && !is_mac)
    {
        window.external.AddFavorite(thePage,document.title);
    } else {
        if (window.sidebar) {
            window.sidebar.addPanel('Nick Arcade', thePage,"");
        } else if( document.all ) {
            window.external.AddFavorite( thePage, 'Nick Arcade');
        } else if( window.opera && window.print ) {
            return true;
        }
    }
    //booker_hp.focus();
}
function makehomepage() {
	var title = "Nick.com";
	var url = "http://www.nick.com/";
	if(window.sidebar) {
		window.sidebar.addPanel(title, url, "");
	} else if(window.opera && window.print) {
		var mbm = document.createElement('a');
		mbm.setAttribute('rel','sidebar');
		mbm.setAttribute('href',url);
		mbm.setAttribute('title',title);
		mbm.click();
	} else if(document.all) {
		// add fav in IE
		//window.external.AddFavorite(url, title);
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage('http://www.nick.com');
	}
}

/* For displaying form errors, populates and displays an "error" element in the page */
function setErrors(str)
{
	var el;
	el = document.getElementById('error');
	if(el && str.length)
	{
		el.innerHTML = str;
		el.style.display = 'block';
		window.scrollTo(0,0); //we do this so the newly popped-in error messages are visible on longer pages where the user may have scrolled down
	}
}

function checkDigits(field) {
	var value = field.value;
	if (! isNumeric(value) ){
		alert('Please enter numbers only.');
		var temp = '';
		for(x=0;x<value.length;x++){
			if ( isNumeric(value.charAt(x)) ){
				temp += value.charAt(x);
			}
		}
		field.value = temp;
		//field.value=value.substring(0,value.length-1);
	}
}

function isNumeric(value){
	var re = /^[0-9]*$/;
	return re.test(value);
}