function getElement(element) { return document.getElementById(element); }
function getElements(element) { return document.getElementsByName(element); }
function showDiv(div) { getElement(div).style.display='block'; }
function hideDiv(div) { getElement(div).style.display='none'; }

function showToolTip(award) {
 if (award==1 || award==3) {
  nextaward=award + 1;
  text="<table cellpadding=0 cellspacing=0><tr><td valign=top>" +
       "<table><tr><td valign=top><font size=1>05/05/07:</font></td><td><font size=1>Outstanding written business plan at the 2007 Global Moot Corp competition at the University of Texas</font></td></tr></table>" +
       "<table><tr><td valign=top><font size=1>03/31/07:</font></td><td><font size=1>Elevator pitch winner at the University of Manitoba's Stuart Clark Venture Challenge</font></td></tr></table>" +
       "<table><tr><td valign=top><font size=1>03/10/07:</font></td><td><font size=1>Business plan presentation receives honorable mention in Northwest Venture Championship at Boise State University</font></td></tr></table>" +
       "<table><tr><td valign=top><font size=1>02/23/07:</font></td><td><font size=1>Winner of Limo Round presentation at University of Cincinnati's Spirit of Enterprise Business Plan Competition</font></td></tr></table>" +
       "<table><tr><td valign=top><font size=1>12/01/06:</font></td><td><font size=1><a href=\"javascript:void(0)\" onClick=\"showToolTip(" + nextaward + ");\">ISS Wins University of Oregon Venture Quest Business Plan Competition</a></font></td></tr></table>" +
       "</td><td valign=bottom align=right>" +
       "<table><tr><td align=right><img src=iss-biz/images/watermark_white.bmp title=ISS></td></tr></table>" +
       "</td></tr></table>"; 
  title="ISS Business Plan Competition Awards"; 
  if (award==1) Tip(text, TITLE, title, WIDTH, 360, STICKY, true, CENTERWINDOW, true, CENTERALWAYS, false, CLOSEBTN, true);
  else Tip(text, TITLE, title, WIDTH, 360, SHADOW, false, ABOVE, true, FADEIN, 300, FADEOUT, 300, STICKY, 1, OFFSETX, -20, CLOSEBTN, true, CLICKCLOSE, true);
 }
 else if (award==2 || award==4) {
  text="<table cellpadding=0 cellspacing=0><tr><td valign=top colspan=2>" +
       "<font size=1>\"Innovative Sports Strategies (ISS), a software company tailored to the operations of collegiate and professional sports organizations, has won the $1500 first place award at the Venture Quest M.B.A. business plan competition held Friday Dec. 1st at the Lillis Business Complex. This year's Venture Quest competition featured four teams of MBA and JD/MBA students from the UO Charles H. Lundquist College of Business. Each of the four teams has earned the opportunity to move forward into the Lundquist Center for Entrepreneurship's Venture Launch program which then could lead to participation in a variety of business plan competitions at the national and international level.<br><br>" + 
       "Selected as champion by the five Venture Quest finalist judges, ISS has developed a budget and forecasting tool designed to reduce costs and increase revenues associated with the operations of these sports organizations. Combining a proprietary software program and unique benchmarking analytics, ISS seeks to successfully enter the rapidly growing sports business market. Team members are Brian Cole, Regina O'Brien, Luke Dudley and Ben Steiner, all students in the Warsaw Sports Marketing program.\"</font>" +
       "</td></tr><tr><td>" +
       "<font size=1>Source: University of Oregon</font>" +
       "</td><td valign=bottom align=right>" +
       "<table><tr><td align=right><img src=iss-biz/images/watermark_white.bmp title=ISS></td></tr></table>" +
       "</td></tr></table>"; 
  title="ISS Wins UO Venture Quest Business Plan Competition"; 
  if (award==2) Tip(text, TITLE, title, WIDTH, 380, STICKY, true, CENTERWINDOW, true, CENTERALWAYS, false, CLOSEBTN, true);
  else Tip(text, TITLE, title, WIDTH, 380, SHADOW, false, ABOVE, true, FADEIN, 300, FADEOUT, 300, STICKY, 1, OFFSETX, -20, CLOSEBTN, true, CLICKCLOSE, true);
 }
}

function textCounter(field,cntfield,maxlimit) { 
 if (field.value.length > maxlimit) // if too long...trim it! 
  field.value=field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter 
 else cntfield.value=maxlimit - field.value.length; 
}
function checkContactForm() {
 getElement('person').value=getElement('person').value.replace(/^\s+|\s+$/g, '');
 getElement('email').value=getElement('email').value.replace(/^\s+|\s+$/g, '');
 getElement('title').value=getElement('title').value.replace(/^\s+|\s+$/g, '');
 getElement('company').value=getElement('company').value.replace(/^\s+|\s+$/g, '');
 getElement('phone1').value=getElement('phone1').value.replace(/^\s+|\s+$/g, '');
 getElement('phone2').value=getElement('phone2').value.replace(/^\s+|\s+$/g, '');
 getElement('city').value=getElement('city').value.replace(/^\s+|\s+$/g, '');
 getElement('comments').value=getElement('comments').value.replace(/^\s+|\s+$/g, '');
 getElement('captchacode').value=getElement('captchacode').value.replace(/^\s+|\s+$/g, '');
 phone1=getElement('phone1').value;
 phone2=getElement('phone2').value;
 var emailCheck=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
 if (getElement('person').value=="") {
  alert("Please enter your name.");
  getElement('person').value="";
  getElement('person').focus();
 }
 else if (getElement('email').value=="") {
  alert("Please enter your email.");
  getElement('email').value="";
  getElement('email').focus();
 }
 else if (!getElement('email').value.match(emailCheck)) {
  alert("Please enter a valid email.");
  getElement('email').focus();
 }
 else if (phone1 != "" && phone1.search(/\d{10}/)==-1 && phone1.search(/\d{3}\-\d{3}\-\d{4}/)==-1) {
  alert("Please enter a valid phone number.");
  getElement('phone1').focus();
 }
 else if (phone2 != "" && phone2.search(/\d{10}/)==-1 && phone2.search(/\d{3}\-\d{3}\-\d{4}/)==-1) {
  alert("Please enter a valid phone number.");
  getElement('phone2').focus();
 }
 else if (getElement('city').value=="") {
  alert("Please enter your city.");
  getElement('city').value="";
  getElement('city').focus();
 }
 else if (getElement('state').selectedIndex==0) {
  alert("Please select your state.");
  getElement('state').focus();
 }
 else if (getElement('subject').selectedIndex==0) {
  alert("Please select a subject.");
  getElement('subject').focus();
 }
 else if (getElement('comments').value=="") {
  alert("Please enter your comments.");
  getElement('comments').value="";
  getElement('chars').value=250;
  getElement('comments').focus();
 }
 else if (getElement('captchacode').value=="") {
  alert("Please enter the text as it appears in the box.");
  getElement('captchacode').value="";
  getElement('captchacode').focus();
 }
 else {
  if (confirm("Are you sure you want to submit this form?")) {
   getElement('resett').disabled=true;
   getElement('submitt').disabled=true;
   getElement('contact').submit();
  }
 }
}

function clearContactForm() {
 getElement('person').value="";
 getElement('email').value="";
 getElement('title').value="";
 getElement('company').value="";
 getElement('phone1').value="";
 getElement('phone2').value="";
 getElement('city').value="";
 getElement('comments').value="";
 getElement('captchacode').value="";
 getElement('state').selectedIndex=0;
 getElement('subject').selectedIndex=0;
 getElement('other').value="";
 getElement('receipt').checked=false;
 getElement('chars').value=250;
 toggleOther();
}

function checkResumeForm() {
 getElement('person').value=getElement('person').value.replace(/^\s+|\s+$/g, '');
 getElement('email').value=getElement('email').value.replace(/^\s+|\s+$/g, '');
 getElement('phone1').value=getElement('phone1').value.replace(/^\s+|\s+$/g, '');
 getElement('phone2').value=getElement('phone2').value.replace(/^\s+|\s+$/g, '');
 getElement('city').value=getElement('city').value.replace(/^\s+|\s+$/g, '');
 getElement('comments').value=getElement('comments').value.replace(/^\s+|\s+$/g, '');
 getElement('captchacode').value=getElement('captchacode').value.replace(/^\s+|\s+$/g, '');
 phone1=getElement('phone1').value;
 phone2=getElement('phone2').value;
 attach1=getElement('attach1').value.replace(/^\s+|\s+$/g, '');
 var emailCheck=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
 if (getElement('person').value=="") {
  alert("Please enter your name.");
  getElement('person').value="";
  getElement('person').focus();
 }
 else if (phone1 != "" && phone1.search(/\d{10}/)==-1 && phone1.search(/\d{3}\-\d{3}\-\d{4}/)==-1) {
  alert("Please enter a valid phone number.");
  getElement('phone1').focus();
 }
 else if (getElement('email').value=="") {
  alert("Please enter your email.");
  getElement('email').value="";
  getElement('email').focus();
 }
 else if (!getElement('email').value.match(emailCheck)) {
  alert("Please enter a valid email.");
  getElement('email').focus();
 }
 else if (phone2 != "" && phone2.search(/\d{10}/)==-1 && phone2.search(/\d{3}\-\d{3}\-\d{4}/)==-1) {
  alert("Please enter a valid phone number.");
  getElement('phone2').focus();
 }
 else if (getElement('city').value=="") {
  alert("Please enter your city.");
  getElement('city').value="";
  getElement('city').focus();
 }
 else if (getElement('state').selectedIndex==0) {
  alert("Please select your state.");
  getElement('state').focus();
 }
 else if (getElement('position').selectedIndex==0) {
  alert("Please select a position.");
  getElement('position').focus();
 }
 else if (attach1=="") {
  alert("Please attach your resume.");
  getElement('attach1').value=getElement('attach1').defaultValue;
  getElement('attach1').focus();
 }
 else if (getElement('captchacode').value=="") {
  alert("Please enter the text as it appears in the box.");
  getElement('captchacode').value="";
  getElement('captchacode').focus();
 }
 else {
  if (confirm("Are you sure you want to submit this form?")) {
   getElement('resett').disabled=true;
   getElement('submitt').disabled=true;
   getElement('resume').submit();
  }
 }
}

function clearResumeForm() {
 getElement('person').value="";
 getElement('email').value="";
 getElement('phone1').value="";
 getElement('phone2').value="";
 getElement('city').value="";
 getElement('comments').value="";
 getElement('captchacode').value="";
 getElement('state').selectedIndex=0;
 getElement('position').selectedIndex=0;
 getElement('receipt').checked=false;
 getElement('chars').value=250;
}


function goToContact(index) {
 getElement('selection').value=index;
 getElement('notification').submit();
}

function toggle(link, div) { 
 if (link.innerHTML=='+') { 
  link.innerHTML='-';
  showDiv(div);
 }
 else {
  link.innerHTML='+';
  hideDiv(div); 
 }
}

function popUp(ref) { 
 var strFeatures="toolbar=no,status=yes,menubar=no,location=no,scrollbars=yes,resizable=yes";
 var newWin=window.open(ref,"Elevation",strFeatures); 
 newWin.opener=top;
 newWin.moveTo(0,0); 
 newWin.resizeTo(screen.availWidth,screen.availHeight); 
 newWin.focus();
}