//============================================================
//Script:     Break Out of Frameset Script
//============================================================
function framebuster() {
	if (parent.frames.length > 0) {
    	parent.location.href = self.document.location
	}
}

//============================================================
//Script:     Function to open page in new browser Script
//============================================================
function openInfoPage(wWidth, wHeight) {
	winOptions = "toolbar=1,location=0,status=0,menubar=0,scrollbars=1,width=" + wWidth + ",height=" + wHeight;
	infoWin = window.open("","infoWin",winOptions);
}

function openEnergyLessonAnswerPage(wWidth, wHeight) {
	winOptions = "toolbar=0,location=0,status=0,menubar=0,scrollbars=0,width=" + wWidth + ",height=" + wHeight;
	
	if (typeof(infoWin) != "undefined") {
		infoWin = window.open("","infoWin",winOptions);
		infoWin.focus();
	}
	else {
		infoWin = window.open("","infoWin",winOptions);
	}
}

//============================================================
//Script:     Function to open page in current window
//============================================================
function projectsInState(state) {
      
	  window.location = "/programs/projectdatabase/stateprofiles/2004/" + state + ".html";
}

//============================================================
//Script:     Function to open page in current window
//============================================================
function go2URL(url) {
      
	  window.location = url;
}
		
//============================================================
//Script:     Function to open printer friendly page
//============================================================
function printerFriendly(url) {
	winOptions = "toolbar=1,location=0,status=0,menubar=1,scrollbars=1";
	printWin = window.open(url,"printWin",winOptions);
}

//============================================================
//Script:     Function to open email article page
//============================================================
function emailArticle(url) {
	//winOptions = "toolbar=0,location=1,status=1,menubar=0,scrollbars=1,width=460,height=400";
	winOptions = "toolbar=0,location=0,status=0,menubar=0,scrollbars=1";
	printWin = window.open(url,"printWin",winOptions);
}

function validateNewsAlertForm() {
  var EmailValue = document.newsalert.email.value;
  var unSubscribe = false;
        
  // Check for email address format
  if (EmailValue == '' || EmailValue.indexOf('.') == -1 || EmailValue.indexOf('@') == -1) {
    if (EmailValue == '') 
      alert("\nE-mail address is a required field.")
    else {
      alert("\n\"" + EmailValue + "\" is not a valid e-mail address.  Please correct it.");
	  document.newsalert.email.select();
      document.newsalert.email.focus();
	}
    return false;
  }
  
  // Check if a list is selected
  if ( !document.newsalert.coalpower.checked && !document.newsalert.oilgas.checked && !document.newsalert.carbon.checked ) {
    alert("\nA list must be selected to continue.  Please select at least one.");	
    return false;
  }
  
  // Check if this request is for unsubscription
  if (document.newsalert.unsubcheck.checked) {
    if (window.confirm("\nAre you sure you wish to cancel your subscription?")) {
      return true;
    }
    else {
      return false;
    }
  }
  else {
    return true;
  }
        
}

<!-- Validate e-mail field test-->
function validateEmail() {
  var EmailValue = document.newsalert.email.value;
  var unSubscribe = false;
        
  if (EmailValue == '' || EmailValue.indexOf('.') == -1 || EmailValue.indexOf('@') == -1) {
    if (EmailValue == '') 
      alert("E-mail address is a required field.")
    else
      alert(EmailValue + " is not a valid e-mail address.  Please correct.");
    return false;
  }
  
        else if (document.newsalert.unsubcheck.checked) {
                if (window.confirm("Are you sure you wish to\ncancel your subscription?")) {
                        return true;
                }
                else {
                        return false;
                }
        }
        
        else {
                        return true;
        }
        
}

function unsubCheck() {
        if (document.newsalert.unsubcheck.checked)
          document.newsalert.submitbutton.value = "Unsubscribe";
        else
          document.newsalert.submitbutton.value = "Subscribe";
}

function reset_AlertForm() {
	document.newsalert.reset();
}

function y2k(number)    { return (number < 1000) ? number + 1900 : number; }
function padout(number) { return (number < 10) ? '0' + number : number; }

// Global Varibles
var today = new Date();
var day = today.getDate(), month = today.getMonth(), year = y2k(today.getYear());
var currentYear = year;
var imgTag = 'img src="';
var _i = 0;
var linkTag = 'a href="';
var openTag = '<';

