// #####################################################################################
// function init()
// initializes all display elements on the screen relative to the browser width, etc.
// #####################################################################################

function init() {
	
	// if Netscape 4, run scrollSpace() to fix bug with scroll space area
	browserVersion = parseInt(navigator.appVersion);
	if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {
		scrollSpace();		
	}		MM_preloadImages('images/heading_resources.gif','images/heading_tools.gif','images/heading_gardens.gif','images/heading_whats_new.gif');
	
} //end function init()

// #####################################################################################
// workaround to fix display problems in Netscape 4.x when the browser window is resized
// #####################################################################################

if (document.layers) { window.onResize = NN4Resize; }

function NN4Resize() {

  document.location = document.location;

} //function NN4Resize

// #####################################################################################
// end workaround for Netscape 4.x resize issue
// #####################################################################################

// ###########################################################
// function getInsideWindowWidth()
// This function returns the indise width of the browser
// window in pixels.

function getInsideWindowWidth() {
        if (window.innerWidth) return window.innerWidth
		else return document.body.clientWidth }

// end getInsideWindowWidth()

// ###########################################################
// function scrollSpace()
// This function fixes the empty scrollspace display bug in
// Netscape 4.x browsers.

function scrollSpace() {
	scrollPtLeft = (getInsideWindowWidth() - 16);
	with (document.NNscrollspace) {
        moveTo(scrollPtLeft,0);
        visibility = "visible";
        }
}
// end function scrollSpace()


function launch(path, winName, w, h) {

	newWin = window.open(path,winName,'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+w+',height='+h);
	setTimeout('newWin.focus()',500);
}

function blurry(obj) {

	if (document.all) { obj.blur() }

}

var popWin = null;

function popWindow(src, nm, w, h, scrolling, resizing) {
	if (popWin!=null) {
    	if (!popWin.closed) {
        	loc = popWin.location + ' ';
            if (loc.indexOf(src)==-1) popWin.close();
            else {
            	popWin.focus();
                return;
            }
        }
	}
    x = Math.round((screen.availWidth-w)/2);
    y = Math.round((screen.availHeight-h)/2);
    isScroll = (scrolling) ? 'yes' : 'no';
    if (scrolling=='yes'&&!isMac&&isIE) w+=16;
    resz = (resizing) ? 'yes' : 'no';
    popWin = window.open(src,nm,'toolbar=no,location=no,directories=no,status=yes,scrollbars='+isScroll+',resize='+resz+',copyhistory=no,width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y);
}

var popCWin = null;

// ###########################################################################
// function popControlPanel(src, nm, w, h, scrolling, resizing)

function popControlPanel(src, nm, w, h, scrolling, resizing) {
	if (popCWin!=null) {
    	if (!popCWin.closed) {
        	loc = popCWin.location + ' ';
            if (loc.indexOf(src)==-1) popCWin.close();
            else {
            	popCWin.focus();
                return;
            }
        }
	}
    x = (screen.availWidth-340);
    y = 10;
    isScroll = (scrolling) ? 'yes' : 'no';
    if (scrolling=='yes') w+=16;
    resz = (resizing) ? 'yes' : 'no';
    popCWin = window.open(src,nm,'toolbar=no,location=no,directories=no,status=yes,scrollbars='+isScroll+',resize='+resz+',copyhistory=no,width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y);

} // end function popControlPanel()
// #####################################################################################
// functions for Image Swaps
// #####################################################################################
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function RegistrationValidate()
{
	if (document.frmMember.member_email.value=='') {
		alert('The Email field is required. Please fill it in and submit again.')
		return 0
	}
	
	if (document.frmMember.member_first_name.value=='') {
		alert('The First Name field is required. Please fill it in and submit again.')
		return 0
	}
	
	if (document.frmMember.member_last_name.value=='') {
		alert('The Last Name field is required. Please fill it in and submit again.')
		return 0
	}
	
	if (document.frmMember.member_country.value=='') {
		alert('The Country field is required. Please fill it in and submit again.')
		return 0
	}
	
document.frmMember.submit();
}
function ReviewValidate()
{
	if (document.frmReview.review_subject.value=='') {
		alert('The Soundbite or Subject field is required. Please fill it in and submit again.')
		return 0
	}
	
	if (document.frmReview.review_comment.value=='') {
		alert('You need to fill out the Comment. Please fill them in and submit again.')
		return 0
	}

document.frmReview.submit();
}
function ForumValidate()
{
	if (document.frmNew.msg_author.value=='') {
		document.frmNew.msg_author.value='anonymous';
	}

	document.frmNew.submit();
}

