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.01
         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 && d.getElementById) x=d.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 changeto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TD"&&source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}

function contains_ns6(master, slave) { //check if slave is contained by master
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}

function changeback(e,originalcolor){
if
(ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TR"||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function logout()
{
document.Index.loggedout.value="logout";
document.Index.action = "Index.aspx?SectionName=login/logout";
document.Index.submit();
}

function checklogout()
{
  if (document.Index.loggedout.value == "logout")
  {
    parent.location = "Index.aspx?SectionName=login/logout";
  }
}

function doaction(para_value)
{
thisForm = document.Index;
var dateStr = thisForm.email.value;
var datePat = /^([A-Za-z0-9_.-]*)(\@)([A-Za-z0-9_-]*)(\.)(([A-Za-z0-9_-]{3})|([A-Za-z0-9_.-]*)\4([A-Za-z0-9_-]{2,3}))$/;
if (thisForm.email.value!="") {
    var matchArray = dateStr.match(datePat);
    if (matchArray == null) {
       alert(dateStr + " Email is not in a valid format.")
       thisForm.email.focus();
       return false;
    }
}
else {
    alert("Sorry, your email address is not valid.");
    thisForm.email.focus();
    return false;
}

if (para_value != "" && document.Index.fillemail.value != "Filled") {
   document.Index.action_info.value='pull';
   document.Index.action='RequestAccount.aspx';
   document.Index.submit();
}
return true;
}

function ValidateForm(thisForm)
{
var i, tcheck;
thisForm = document.Index;
if (thisForm.first_name.value=="") 
{
   alert("Sorry, Please fill in First Name.");
   thisForm.first_name.focus();return false;
}
if (thisForm.last_name.value=="") 
{
   alert("Sorry, Please fill in Last Name.");
   thisForm.last_name.focus();return false;
}
/*
if (thisForm.title.value=="") 
{
   alert("Sorry, Please fill in Title.");
   thisForm.title.focus();return false;
}
if (thisForm.company.value=="") 
{
   alert("Sorry, Please fill in Company Name.");
   thisForm.company.focus();return false;
}
*/
var dateStr = thisForm.email.value;
var datePat = /^([A-Za-z0-9_.-]*)(\@)([A-Za-z0-9_-]*)(\.)(([A-Za-z0-9_-]{3})|([A-Za-z0-9_.-]*)\4([A-Za-z0-9_-]{2,3}))$/;
if (thisForm.email.value!="") {
    var matchArray = dateStr.match(datePat);
    if (matchArray == null) {
       alert(dateStr + " Email is not in a valid format.")
       thisForm.email.focus();
       return false;
    }
}
else {
    alert("Sorry, your email address is not valid.");
    thisForm.email.focus();
    return false;
}
if (dateStr != thisForm.email_confirm.value) {
   alert("Sorry, Email Confirmation doesn't match.");
   thisForm.email_confirm.focus();return false;
}
return true;
}	

function ValidateFormStep3(thisForm)
{
var i, tcheck;
thisForm = document.Index;
tcheck = 0;
for (i=0;i<=thisForm.question1.length-1;i++)  {	
    if (thisForm.question1[i].checked==true) {
       tcheck = 1;
    }
}
if (tcheck == 0) 
{
   alert("Sorry, How long have you been an entrepreneur?");
   thisForm.question1[0].focus();return false;
}

tcheck = 0;
for (i=0;i<=thisForm.question2.length-1;i++)  {	
    if (thisForm.question2[i].checked==true) {
       tcheck = 1;
    }
}
if (tcheck == 0) 
{
   alert("Sorry, Have you started a company before?");
   thisForm.question2[0].focus();return false;
}

tcheck = 0;
for (i=0;i<=thisForm.question3.length-1;i++)  {	
    if (thisForm.question3[i].checked==true) {
       tcheck = 1;
    }
}
if (tcheck == 0) 
{
   alert("Sorry, Have you raised money previously for an entrepreneurial venture?");
   thisForm.question3[0].focus();return false;
}

tcheck = 0;
for (i=0;i<=thisForm.question5.length-1;i++)  {	
    if (thisForm.question5[i].checked==true) {
       tcheck = 1;
    }
}
if (tcheck == 0) 
{
   alert("Sorry, How long have you been with your current venture?");
   thisForm.question5[0].focus();return false;
}

tcheck = 0;
for (i=0;i<=thisForm.question9.length-1;i++)  {	
    if (thisForm.question9[i].checked==true) {
       tcheck = 1;
    }
}
if (tcheck == 0) 
{
   alert("Sorry, Please choose at least one options from question number 9?");
   thisForm.question9[0].focus();return false;
}

tcheck = 0;
for (i=0;i<=thisForm.question12.length-1;i++)  {	
    if (thisForm.question12[i].checked==true) {
       tcheck = 1;
    }
}
if (tcheck == 0) 
{
   alert("Sorry, Are you currently working with a Wilson Sonsini Goodrich & Rosati attorney?");
   thisForm.question12[0].focus();return false;
}


return true;
}

function submitme(thisForm)
{
if (ValidateFormStep3(thisForm)==true)
   {
    thisForm.action_info.value='get';
    thisForm.action='RequestAccount.aspx';
    thisForm.submit();
   }
}

function GotoStep2(thisForm)
{
if (ValidateForm(thisForm)==true)
   {
    thisForm.action_info.value='step2';
    thisForm.action='RequestAccount.aspx';
    thisForm.submit();
   }
}

function ValidateFormStep2(thisForm)
{
var i, tcheck;
thisForm = document.Index;
if (thisForm.address1.value=="") 
{
   alert("Sorry, Please fill in Street Number/Name.");
   thisForm.address1.focus();return false;
}
if (thisForm.city.value=="") 
{
   alert("Sorry, Please fill in City.");
   thisForm.city.focus();return false;
}
if (thisForm.state.value=="") 
{
   alert("Sorry, Please fill in State.");
   thisForm.state.focus();return false;
}
if (thisForm.zip.value=="") 
{
   alert("Sorry, Please fill in Zip.");
   thisForm.zip.focus();return false;
}

return true;
}	

function GotoStep3(thisForm)
{
if (ValidateFormStep2(thisForm)==true)
   {
    thisForm.action_info.value='step3';
    thisForm.action='RequestAccount.aspx';
    thisForm.submit();
   }
}

function ValidateUpdateForm(thisForm)
{
var i, tcheck;
thisForm = document.Index;
if (thisForm.first_name.value=="") 
{
   alert("Sorry, Please fill in First Name.");
   thisForm.first_name.focus();return false;
}
if (thisForm.last_name.value=="") 
{+
   alert("Sorry, Please fill in Last Name.");
   thisForm.last_name.focus();return false;
}
/*
if (thisForm.title.value=="") 
{
   alert("Sorry, Please fill in Title.");
   thisForm.title.focus();return false;
}
if (thisForm.company.value=="") 
{
   alert("Sorry, Please fill in Company Name.");
   thisForm.company.focus();return false;
}
*/
if (thisForm.pass1word.value!=thisForm.pass2word.value) 
{
   alert("Sorry, Confirmation Password doesn't match.");
   thisForm.pass1word.focus();return false;
}
return true;
}	

function updatesubmit(thisForm)
{
if (ValidateUpdateForm(thisForm)==true)
   {
    thisForm.action_info.value='update';
    thisForm.action='RequestAccount.aspx';
    thisForm.submit();
   }
}

function mark_this(markedobj, setval)
{
for (i=0;i<=markedobj.length-1;i++)  {	
    if (markedobj[i].value==setval) {
       markedobj[i].checked = true;
       break; 
    }
}
}

function select_this(markedobj, setval)
{
for (i=0;i<=markedobj.options.length-1;i++)  {	
    if (markedobj[i].value==setval) {
       markedobj[i].selected = true;
       break; 
    }
}
}

function hide_seek(qno, yn)
{
var AllTRs = document.body.all.tags("TR");
if (AllTRs!=null)   {
   for (i=0; i<AllTRs.length; i++) {
       if (AllTRs[i].id.indexOf("ENT_Q"+qno) >=0) {
          AllTRs[i].style.display=yn;
       }
   }
}
}

function hide_seek4_13(rvalue, qno)
{
   if (rvalue == "Yes") {
      hide_seek(qno, "");
   }
   else {
      hide_seek(qno, "none");
   }
}

function hide_seek6_7_8(rvalue)
{
   if (rvalue == "no current venture") {
      hide_seek('6', "");
      hide_seek('7', "");
      hide_seek('8', "");
   }
   else {
      hide_seek('6', "none");
      hide_seek('7', "none");
      hide_seek('8', "none");
   }
}

function displayalerts(alertid)
{
    document.location = 'Index.aspx?SectionName=alerts&alertid=' + alertid;
    //document.forms[0].action='Index.aspx?SectionName=alerts&alertid=' + alertid;
    //document.forms[0].submit();
}

function displayallalerts(alertid)
{
    document.forms[0].action='Index.aspx?SectionName=alerts&alertid=' + alertid + '&ShowAll=Y';
    document.forms[0].submit();
}

function displayalertdetail(alertid, alertdetailid)
{
    document.forms[0].action='Index.aspx?SectionName=alerts&alertid=' + alertid + '&alertdetailid=' + alertdetailid;
    document.forms[0].submit();
}

function mmLoadMenus() {if (window.mm_menu_1_2)  return;
window.mm_menu_1_2 = new Menu("img2",310,18,"Verdana, Arial, Helvetica, sans-serif",10,"#000000","#000000","#f9f6e5","#d6d3c3","left","middle",3,0,300,0,0,true,true,true,2,false,false);
mm_menu_1_2.addMenuItem("Biomass","window.open('http://www1.eere.energy.gov/biomass/')");
mm_menu_1_2.addMenuItem("Building Technologies","window.open('http://www1.eere.energy.gov/buildings/')");
mm_menu_1_2.addMenuItem("Energy Management","window.open('http://www1.eere.energy.gov/femp')");
mm_menu_1_2.addMenuItem("Geothermal Technologies","window.open('http://www1.eere.energy.gov/geothermal/')");
mm_menu_1_2.addMenuItem("Hydrogen, Fuel Cells & Infrastructure Technologies","window.open('http://www1.eere.energy.gov/hydrogenandfuelcells/about.html')");
mm_menu_1_2.addMenuItem("Industrial Technologies","window.open('http://www1.eere.energy.gov/industry/')");
mm_menu_1_2.addMenuItem("Solar Energy Technologies","window.open('http://www1.eere.energy.gov/solar/')");
mm_menu_1_2.addMenuItem("Vehicle Technologies","window.open('http://www1.eere.energy.gov/vehiclesandfuels')");
mm_menu_1_2.addMenuItem("Wind & Hydropower Technologies","window.open('http://www1.eere.energy.gov/windandhydro/')");
mm_menu_1_2.addMenuItem("Weatherization","window.open('http://apps1.eere.energy.gov/wip/')");
mm_menu_1_2.hideOnMouseOut=true;
mm_menu_1_2.bgColor='#d6d3c3';
mm_menu_1_2.menuBorder=1;
mm_menu_1_2.menuLiteBgColor='#d6d3c3';
mm_menu_1_2.menuBorderBgColor='#d6d3c3';
window.mm_menu_1_3 = new Menu("img3",300,18,"Verdana, Arial, Helvetica, sans-serif",10,"#000000","#000000","#f9f6e5","#d6d3c3","left","middle",3,0,300,0,0,true,true,true,2,false,false);
mm_menu_1_3.addMenuItem("Carbon Sequestration","window.open('http://fossil.energy.gov/programs/sequestration/index.html')");
mm_menu_1_3.addMenuItem("Clean Coal & Natural Gas Power","window.open('http://fossil.energy.gov/programs/powersystems/index.html')");
mm_menu_1_3.addMenuItem("National Energy Technology Laboratory","window.open('http://www.netl.doe.gov/business/solicitations/index.html')");
mm_menu_1_3.hideOnMouseOut=true;
mm_menu_1_3.bgColor='#d6d3c3';
mm_menu_1_3.menuBorder=1;
mm_menu_1_3.menuLiteBgColor='#d6d3c3';
mm_menu_1_3.menuBorderBgColor='#d6d3c3';
window.mm_menu_1_4 = new Menu("img4",300,18,"Verdana, Arial, Helvetica, sans-serif",10,"#000000","#000000","#f9f6e5","#d6d3c3","left","middle",3,0,300,0,0,true,true,true,2,false,false);
mm_menu_1_4.addMenuItem("National Laboratories","window.open('http://www.er.doe.gov/National_Laboratories/index.htm')");
mm_menu_1_4.addMenuItem("Small Business Research/Technology Transfer","window.open('http://www.sbir.gov/')");
mm_menu_1_4.hideOnMouseOut=true;
mm_menu_1_4.bgColor='#d6d3c3';
mm_menu_1_4.menuBorder=1;
mm_menu_1_4.menuLiteBgColor='#d6d3c3';
mm_menu_1_4.menuBorderBgColor='#d6d3c3';
mm_menu_1_3.writeMenus();
}
