function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features); return false;
}


function showDisclaimer()
{
 //alert('before if::::' + document.cookie);
 if(document.cookie.indexOf('showMessage=1')<0)
 //alert(document.MessageInfo.showMessage.value);
 //if(document.MessageInfo.showMessage.value=="1")
 {
/* alert('Welcome to GreenVest. This website is currently under development, and available online for demonstration purposes. Public release is scheduled for January 2009. Until then, the site will be incomplete and features may not be functional. \n\nPlease note that the current page is best viewed with Mozilla Firefox 3.x and may display incorrectly in other Web browsers');*/

activateLightBox();
tb_show("Announcement","#TB_inline?height=260&width=450&inlineId=hiddenModalContent&modal=true");

 document.cookie='showMessage=1';
 //alert('after set: ' +document.cookie+ ' -- ' +document.cookie.indexOf('showMessage=1'));
 }
}

$(document).ready(function() {
  initMenu();
  
  /*$('.hover').preload({
    find:'.gif',
    replace:'_hover.gif'
  });
  
  $.preload(['../eng/images/rightm.png']);
  
  $(".hover").hover(function() {
    s = $(this).attr("src").replace(/\.(.+)$/i, "_hover.$1");
    $(this).attr("src", s);
  }, function() {
    s = $(this).attr("src").replace(/_hover\.(.+)$/i, ".$1");
    $(this).attr("src", s);
  });*/
   
	changeBGImage(1);
	//activateLightBox(); // Only Used with thickbox
  Lightbox.initList();
	
  $($('#block-pwsurvey-0 #search-form .form-item')[0]).append('<p><button alt="" id="quick_search_more"/><button disabled class="thickbox" id="advanced_search_button" /><button  disabled  id="help_button"/></p>');

  if($("#search")[0])$("#search").cssRadio();
  
  if ($.browser.msie){
    $("#block-pwsurvey-1 label[for='edit-cp-country-307']")[0].id = 'chooseACountry';
    $("#block-pwsurvey-1 label[for='edit-cp-park-425']")[0].id = 'chooseAPark';
  }
  
  if($("#quick_search_more")[0]) $("#quick_search_more")
    .click( function(){
      $('#advanced_search')
        .slideToggle('slow', function(){
		
          var a = $("#quick_search_more");
          a.attr('class', a.attr('class') == undefined || a.attr('class').indexOf('down')==-1? 'down': '')
          });
		  var QUESTION_COUNTRY_QID="307";
		var QUESTION_PROV_DEP_STATE_QID="306";
		var QUESTION_BIOME_QID="904";
		var QUESTION_ECOREGION_QID="792";
		
		var elmTest=$("#edit-gvcrit-"+QUESTION_COUNTRY_QID);
		var disabled =(elmTest.attr("disabled")==undefined||elmTest.attr("disabled")==false?false:true);
		var elms=$("#edit-gvcrit-"+QUESTION_COUNTRY_QID+",#edit-gvcrit-"+QUESTION_PROV_DEP_STATE_QID+",#edit-gvcrit-"+QUESTION_BIOME_QID+",#edit-gvcrit-"+QUESTION_ECOREGION_QID);
		if (disabled==false){elms.attr("disabled","yes");}else {elms.removeAttr("disabled");} 
		
      return false;
    });
    
  if($("#quick_search .close, #quick_search .close2")[0])
  $("#quick_search .close, #quick_search .close2")
    .click( function(){
      $('#quick_search')
        .slideUp('slow', function(){
          var a = $("#quick_search_more");
          a.attr('class') = '';
        });
      return false;
    });
    
  if($('#list1b')[0]) $('#list1b').accordion({ 
    autoheight: false, 
    animated: 'bounceslide',
    header: 'a.menu'
  });
  
  if($('#featured_needs .view-content')[0]) $('#featured_needs .view-content').cycle({ 
    fx:     'shuffle', 
    speed:  'fast', 
    timeout: 0, 
    next:   '#featured_needs .next', 
    prev:   '#featured_needs .prev' 
  });
  
  //activateLightBox(); // Only Used with thickbox
  Lightbox.initList();
  setTimeout('showDisclaimer()',15000);
});

jQuery.fn.cssRadio = function () {

	var context = this;

	jQuery("input[@type='radio'] + img", this)
		.each( function(){
			if ( jQuery(this).prev()[0].checked )
				jQuery(this).attr("src", jQuery(this).attr("src").replace(".png", "_hover.png"));
			})
		.hover(
			function() { $(this).addClass("over"); },
			function() { $(this).removeClass("over"); }
			)
		.click( function() {
			jQuery("input[@type='radio'] + img", context)
				.each( function() {
					jQuery(this).attr("src", jQuery(this).attr("src").replace("_hover.png", ".png"));
					jQuery(this).prev()[0].checked = false;
				});
			jQuery(this).attr("src", jQuery(this).attr("src").replace(".png", "_hover.png"));
			jQuery(this).prev()[0].checked = true;
			})
		.prev().hide();
}