

var nmailtime ='';

function nmailOn(){

  if(document.getElementById('nmail').value == 'Enter Email'){
    document.getElementById('nmail').value = '';
    document.getElementById('nmail').style.color = '#000000';
  } 
  
}


function nmailOff(){
	nmailtime = setTimeout("if(document.getElementById('nmail').value == ''){document.getElementById('nmail').style.color = '#666666';document.getElementById('nmail').value = 'Enter Email';}",600);	
}



function clearnMail(){
  clearTimeout(nmailtime);
}



function turnOffnMail(){
	document.getElementById('nmail').onfocus = function(){}; 
	document.getElementById('nmail').onblur = function(){};
	document.getElementById("nmail").focus();
	document.getElementById("nmail").value="";
	document.getElementById('nmail').style.color = '#000000';
}


function turnOnnMail(){

  try{
	  document.getElementById('nmail').onfocus = function(){nmailOn();} 
	  document.getElementById('nmail').onblur = function(){nmailOff();}
  }
	  catch(err){
  }

}



// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------





function textInputOn(textInput,defaultValue){
  if(document.getElementById(textInput).value == defaultValue){
    document.getElementById(textInput).value = '';
    document.getElementById(textInput).style.color = '#000000';
  } 
}


function textInputOff(textInput,defaultValue){
  var textInputTime = setTimeout("if(document.getElementById('"+textInput+"').value == ''){document.getElementById('"+textInput+"').style.color = '#666666';document.getElementById('"+textInput+"').value = '"+defaultValue+"';}",800);   
}



function passInputOn(passInputFaux,passInput,defaultValue){
  if(document.getElementById(passInputFaux).value == defaultValue){
    document.getElementById(passInputFaux).style.display = 'none';
    document.getElementById(passInput).style.display = '';
    document.getElementById(passInput).focus();
  } 
}


function passInputOff(passInputFaux,passInput,defaultValue){
  var passInputTime = setTimeout("if(document.getElementById('"+passInput+"').value == ''){document.getElementById('"+passInput+"').style.display = 'none';document.getElementById('"+passInputFaux+"').style.display = '';}",800);   
}



function turnOnTextInputs(){

  try{
	  document.getElementById('member-search').onfocus = function(){textInputOn('member-search','member name');} 
	  document.getElementById('member-search').onblur = function(){textInputOff('member-search','member name');}
  }
	  catch(err){
  }
  
  try{
	  document.getElementById('email-login').onfocus = function(){textInputOn('email-login','email address');} 
	  document.getElementById('email-login').onblur = function(){textInputOff('email-login','email address');}
  }
	  catch(err){
  }
  

  try{
	  document.getElementById('password-login-faux').onfocus = function(){passInputOn('password-login-faux','password-login','password');} 
	  document.getElementById('password-login').onblur = function(){passInputOff('password-login-faux','password-login','password');}
  }
	  catch(err){
  }
  

}





function turnOnSignUpTextInputs(){

  try{
	  document.getElementById('signup_username').onfocus = function(){textInputOn('signup_username','email address');} 
	  document.getElementById('signup_username').onblur = function(){textInputOff('signup_username','email address');}
  }
	  catch(err){
  }
  
  try{
	  document.getElementById('password-a-faux').onfocus = function(){passInputOn('password-a-faux','password-a','password');} 
	  document.getElementById('password-a').onblur = function(){passInputOff('password-a-faux','password-a','password');}
  }
	  catch(err){
  }
  
  try{
	  document.getElementById('password-b-faux').onfocus = function(){passInputOn('password-b-faux','password-b','password');} 
	  document.getElementById('password-b').onblur = function(){passInputOff('password-b-faux','password-b','password');}
  }
	  catch(err){
  }
  



}










function turnOnProfileInputs(){

  try{
	  document.getElementById('bd-month').onfocus = function(){textInputOn('bd-month','MM');} 
	  document.getElementById('bd-month').onblur = function(){textInputOff('bd-month','MM');}
  }
	  catch(err){
  }
  
  try{
	  document.getElementById('bd-day').onfocus = function(){textInputOn('bd-day','DD');} 
	  document.getElementById('bd-day').onblur = function(){textInputOff('bd-day','DD');}
  }
	  catch(err){
  }
  
  
  try{
	  document.getElementById('bd-year').onfocus = function(){textInputOn('bd-year','YYYY');} 
	  document.getElementById('bd-year').onblur = function(){textInputOff('bd-year','YYYY');}
  }
	  catch(err){
  }
  
   try{
	  document.getElementById('mentor-select').onchange = function(){
	    
	    if(document.getElementById('mentor-select').selectedIndex == 1){
	      //document.getElementById('mentor-details').value='';
	      document.getElementById('mentor-details').disabled = 'disabled';
	    }
	    else{
	      document.getElementById('mentor-details').disabled = '';
	    }
	    
	    //alert(document.getElementById('mentor-select').selectedIndex);
	    
	  } 
  }
	  catch(err){
  }
  
  
  try{
	  document.getElementById('bm-info-pull').onclick = function(){
	    document.getElementById('bm-details').value = document.getElementById('about-me').value;
	    return(false);
	  } 
  }
	  catch(err){
  }
 
  

}



/*

var nmailtime ='';

function nmailOn(){

  if(document.getElementById('nmail').value == 'Enter Email'){
    document.getElementById('nmail').value = '';
    document.getElementById('nmail').style.color = '#000000';
  } 
  
}


function nmailOff(){
	nmailtime = setTimeout("if(document.getElementById('nmail').value == ''){document.getElementById('nmail').style.color = '#666666';document.getElementById('nmail').value = 'Enter Email';}",600);	
}



function clearnMail(){
  clearTimeout(nmailtime);
}



function turnOffnMail(){
	document.getElementById('nmail').onfocus = function(){}; 
	document.getElementById('nmail').onblur = function(){};
	document.getElementById("nmail").focus();
	document.getElementById("nmail").value="";
	document.getElementById('nmail').style.color = '#000000';
}


function turnOnnMail(){

  try{
	  document.getElementById('nmail').onfocus = function(){nmailOn();} 
	  document.getElementById('nmail').onblur = function(){nmailOff();}
  }
	  catch(err){
  }

}

*/














function initUpload(){
  document.getElementById('pdf').style.display='none';
  document.getElementById('upload-area').style.display='';
}







function convert (string) {
  var aCode = 'a'.charCodeAt();
  var zCode = 'z'.charCodeAt();
  var ACode = 'A'.charCodeAt();
  var ZCode = 'Z'.charCodeAt();
  var result = '';
  for (var c = 0; c < string.length; c++) {
    var charCode = string.charCodeAt(c);
    if (charCode >= aCode && charCode <= zCode)
      charCode = aCode + (charCode - aCode + 13) % 26;
    else if (charCode >= ACode && charCode <= ZCode)
      charCode = ACode + (charCode - ACode + 13) % 26;
    result += String.fromCharCode(charCode);
  }
  return result;
}










function rollOverOn(myID){
   
   
  theThing = document.getElementById(myID);
  
  if(theThing == null){
    return(false);
  }
  
  var theThingSrc = theThing.src 
  
  var theThingSrcA = new Array();
  
  var findTheThingExt = theThingSrc.lastIndexOf('.');
  
  theThingSrcA[0] = theThingSrc.substring(0,findTheThingExt);
  theThingSrcA[1] = theThingSrc.substr(findTheThingExt,4);
  
  theThing.src = theThingSrcA[0] + '_x' + theThingSrcA[1];
}


function rollOverOff(myID){

  theThing = document.getElementById(myID);
  
  if(theThing == null){
    return(false);
  }
  
  var theThingSrc = theThing.src 
  
  var theThingSrcA = new Array();
  
  var findTheThingExt = theThingSrc.lastIndexOf('.');
  
  theThingSrcA[0] = theThingSrc.substring(0,findTheThingExt);
  theThingSrcA[1] = theThingSrc.substr(findTheThingExt,4);
  
  theThing.src = theThingSrcA[0].substring(0,(theThingSrcA[0].length-2)) + theThingSrcA[1];
}






function setRollOvers(){

 try{
	document.getElementById('nav01-link').onmouseover = function(){rollOverOn('nav01');} 
	document.getElementById('nav01-link').onmouseout = function(){rollOverOff('nav01');}
	
	document.getElementById('nav01-link').onfocus = function(){this.blur();}
		
 }
	catch(err){
 }
 
 try{
	document.getElementById('nav02-link').onmouseover = function(){rollOverOn('nav02');} 
	document.getElementById('nav02-link').onmouseout = function(){rollOverOff('nav02');}
	
	document.getElementById('nav02-link').onfocus = function(){this.blur();}

 }
	catch(err){
 }
 
 try{
	document.getElementById('nav03-link').onmouseover = function(){rollOverOn('nav03');} 
	document.getElementById('nav03-link').onmouseout = function(){rollOverOff('nav03');}
	
  document.getElementById('nav03-link').onfocus = function(){this.blur();}

 }
	catch(err){
 }
 
 try{
	document.getElementById('nav04-link').onmouseover = function(){rollOverOn('nav04');} 
	document.getElementById('nav04-link').onmouseout = function(){rollOverOff('nav04');}
	
	document.getElementById('nav04-link').onfocus = function(){this.blur();}

 }
	catch(err){
 }
 
 try{
	document.getElementById('nav05-link').onmouseover = function(){rollOverOn('nav05');} 
	document.getElementById('nav05-link').onmouseout = function(){rollOverOff('nav05');}
	
	document.getElementById('nav05-link').onfocus = function(){this.blur();}

 }
	catch(err){
 }
 
 try{
	document.getElementById('nav06-link').onmouseover = function(){rollOverOn('nav06');} 
	document.getElementById('nav06-link').onmouseout = function(){rollOverOff('nav06');}
	
	document.getElementById('nav06-link').onfocus = function(){this.blur();}

 }
	catch(err){
 }
 
 try{
	document.getElementById('nav07-link').onmouseover = function(){rollOverOn('nav07');} 
	document.getElementById('nav07-link').onmouseout = function(){rollOverOff('nav07');}
	
	document.getElementById('nav07-link').onfocus = function(){this.blur();}

 }
	catch(err){
 }
  
 
  
}