/***********************************************
* Sticky Note script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
* Go to http://www.dynamicdrive.com/ for full source code
***********************************************/

//Specify display mode. 3 possible values are:
//1) "always"- This makes the fade-in box load each time the page is displayed
//2) "oncepersession"- This uses cookies to display the fade-in box only once per browser session
//3) integer (ie: 5)- Finally, you can specify an integer to display the box randomly via a frequency of 1/integer...
// For example, 2 would display the box about (1/2) 50% of the time the page loads.

var displaymode="always"

var enablefade="yes" //("yes" to enable fade in effect, "no" to disable)
var autohidebox=["no"] //Automatically hide box after x seconds? [yes/no, if_yes_hide_after_seconds]
var showonscroll="no" //Should box remain visible even when user scrolls page? ("yes"/"no)
var IEfadelength=1 //fade in duration for IE, in seconds
var Mozfadedegree=0.05 //fade in degree for NS6+ (number between 0 and 1. Recommended max: 0.2)

////////No need to edit beyond here///////////

if (parseInt(displaymode)!=NaN)
var random_num=Math.floor(Math.random()*displaymode)

function displayfadeinbox()
{
   var ie=document.all && !window.opera
   var dom=document.getElementById
   iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
   objref=(dom)? document.getElementById("fadeinbox") : document.all.fadeinbox
   var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
   var docwidth=(ie)? iebody.clientWidth : window.innerWidth
   docheight=(ie)? iebody.clientHeight: window.innerHeight
   var objwidth=objref.offsetWidth
   objheight=objref.offsetHeight

   positionFadeBox(objref);
    //***********AWL ADDED 12-2005***********

   if (showonscroll=="yes")
       showonscrollvar=setInterval("staticfadebox()", 50)

   if (enablefade=="yes" && objref.filters)
   {
       objref.filters[0].duration=IEfadelength
       objref.filters[0].Apply()
       objref.filters[0].Play()
   }
   
   objref.style.display = "block"
   
   if (objref.style.MozOpacity)
   {
      if (enablefade=="yes")
         mozfadevar=setInterval("mozfadefx()", 90)
      else
	  {
         objref.style.MozOpacity=1
         controlledhidebox()
      }
   }
   else
      controlledhidebox()
	  
 } // end of display
 

function mozfadefx()
{
    if(parseFloat(objref.style.MozOpacity)<1)
       objref.style.MozOpacity=parseFloat(objref.style.MozOpacity)+Mozfadedegree
    else
	{
       clearInterval(mozfadevar)
        controlledhidebox()
    }
} // end of function 


function staticfadebox()
{
   var ie=document.all && !window.opera
   var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
   objref.style.top=scroll_top+docheight/2-objheight/2+"px"
}


function hidefadebox()
{
   objref.style.display = "none"
   if (typeof showonscrollvar!="undefined")
   clearInterval(showonscrollvar)
}


function controlledhidebox()
{
    if(autohidebox[0]=="yes")
	{
       var delayvar=(enablefade=="yes" && objref.filters)? (autohidebox[1]+objref.filters[0].duration)*1000 : autohidebox[1]*1000
       setTimeout("hidefadebox()", delayvar)
    }
}

function initfunction()
{
//if (document.getElementById('showNYOPfloat').value != 'shown')
//{
  setTimeout("displayfadeinbox()", 100)
//}
}


//***********AWL ADDED 12-2005***********
function positionFadeBox(objBox) 
{
    var eltNYOP = document.getElementById("grid_nyop_box");
    var hPos = getElementOffset(eltNYOP,"LEFT");
    var vPos = getElementOffset(eltNYOP,"TOP");
    var objwidth=objBox.offsetWidth
    var objheight=objBox.offsetHeight
    var ie=document.all && !window.opera
 /*   if (ie) 
        objBox.style.top = (vPos -73) + "px";
    else
        objBox.style.top = (vPos -71) + "px";
    objBox.style.left = hPos + "px"; */
}


//loop through image and all its parents to get the cumulative offset
function getElementOffset(oElt, sOffset) 
{
    intOffset=0;
    
    for(var p = oElt; p && p.tagName!='BODY'; p = p.offsetParent) {
        intOffset += (sOffset=="TOP"?p.offsetTop:p.offsetLeft);
    }
    return intOffset;
}
//***********AWL ADDED 12-2005***********



function get_cookie(Name) 
{
   var search = Name + "="
   var returnvalue = ""
   if(document.cookie.length > 0) 
   {
      offset = document.cookie.indexOf(search)
      if(offset != -1) 
	  {
         offset += search.length
         end = document.cookie.indexOf(";", offset)
         if(end == -1)
            end = document.cookie.length;
			
         returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
   
   return returnvalue;
} // end of function


/*if(displaymode=="oncepersession" && get_cookie("fadedin")=="" || 
    displaymode=="always" || parseInt(displaymode)!=NaN && random_num==0)
{
    if (window.addEventListener)
        window.addEventListener("load", initfunction, false)
    else if (window.attachEvent)
        window.attachEvent("onload", initfunction)
    else if (document.getElementById)
         window.onload=initfunction
    document.cookie="fadedin=yes"
} */



////////////////////////////////////////////////////////////
// this javascript is used by the carreerquiz.asp file /////
// Oscar's Code ***************************** //////////////// 
////////////////////////////////////////////////////////////

var codeString = ""
var tempcodestr = ""

function nextQuestion(num)
{   
   
   var found = false;
   var index = 0;
   var radioObj = document.q_form["level"+num];
   var radio_length = radioObj.length;
   var radioValue = "";
   
   tempcodestr = codeString;
    
   while (index < radio_length)
   { 
       if(radioObj[index].checked)
       {
            found = true;      
            break;                        
       }
       index++;
   } // end of while
   if(!found)
   { 
		message = "Please select a Yes or No choice.";
		if(radio_length == 3) message = "Please select Inside, Outside, or Either.";
		alert(message);
		return;
   }    
  
  tempcodestr += index;
  if(num == 2) // this was first question 
  {
    // show next question 
    displayQuestion(num);  
  }
  else if(num == 3) // this is second question 
  {
     if(tempcodestr == "11") // afraid of heights code
	 {
	    // isOK = window.confirm("Are you sure you are afraid of heights?")
        // if(isOK) window.location.href = "http://wwww.yahoo.com" // Kick OUT
		setBoxContent(num);
		displayfadeinbox();			
	 }
	 else
	 {	 
	     // show next question 
        displayQuestion(num); 	 
	 }  
  }
  else if(num == 4) // this is third question 
  {
  
     if(tempcodestr == "100") // prefer inside 
	 {	     
		 setBoxContent(num);
		 displayfadeinbox();	
	 }
	 else if(tempcodestr == "101" || tempcodestr == "102") // LINE INSTALLER POSITION 
	 {	      
		  document.q_form.code.value = tempcodestr ;
		  document.q_form.submit(); // process category links
	 }	 
	 else
	 {	 
	     // show next question 
         displayQuestion(num);
	 }  
  }
  else // this is last question
  {
     if(index == 1) // don't like noisy conditions
	 {
	     // with index == 1, all selections go to Kick out pages except code 00111
		 if(tempcodestr == "0011") // only one job position
	     {
		     document.q_form.code.value = tempcodestr;
		     document.q_form.submit(); // process category linkss
		 }
		 else // don't like noisy conditions, no job choices, so Kick Out pages
		 {		    
			 setBoxContent(num, tempcodestr);
		     displayfadeinbox();
		 }  
	 }
	 else // question 5 code is 0. All selections go to job pages
	 {
	    document.q_form.code.value = tempcodestr;
		document.q_form.submit(); // process category links
	 }
  } 

} // end of nextQuestion

function displayQuestion(qNumber)
{
   // display next question 
   var myspan = document.getElementById("spanlevel"+qNumber)  
   myspan.style.display = "none"
   myspan = document.getElementById("spanlevel"+(qNumber+1))
   myspan.style.display = "block"
   codeString = tempcodestr
}

function setBoxContent(num, code)
{
  var myhtml = ""
  var divObj = document.getElementById("contentdiv") 
  
  if(num == 3)  
  {
    myhtml = '<table width="350" border="0" height="80%">' +
    '<tr><td valign="top" height="20" class="contentdiv"><b>Afraid of Heights?</b>' +
    '</td></tr><tr><td valign="top" class="contentdiv">' +
	'<br />Line Installer positions require you to be able to climb a pole that is 40 to 50 feet high. '  +
	'How high is that?  Just look outside, there are utility poles everywhere. Can you stand on the ' +
	'balcony of a 3 story building? That\'s about how high it is.' +
	'<br /><br />In many situations, you would use a truck-mounted bucket in utility work. ' +
	'That may not be so scary, but you still have to be able to climb. Of course, you ' +
	'always wear protective gear to keep you safe. For lineworkers, safety is always the first priority.' +
	'<br /><br />Want to change your answer on fear of heights?'  +		
    '</td></tr></table>'  
  }
  else if(num == 4) 
  {
    myhtml = '<table width="350" border="0" height="80%">' +
    '<tr><td valign="top" height="20" class="contentdiv"><b>Prefer to work inside?</b>' +
    '</td></tr><tr><td valign="top" class="contentdiv">' +
	'<br />You ended up here because you didn\'t like confined spaces and you prefer '  +
	'to work inside.' +
	'<br /><br />For most of the jobs that are inside - like Power Plant Operator or ' +
	'Maintenance / Repair, you will sometimes have to work in small spaces. ' +
	'What does that mean?  You may have to squeeze into or under tight places ' +
	'between parts of a machine to check or repair them. If you are claustrophobic, ' +
	'it\'s probably not for you. ' +
	'<br /><br />If you can squeeze under your bed to find that lost game controller - you ' +
	'are probably OK. Go back to the beginning and answer no to the confined spaces question ' +
	'if you would like to try again.' +
	'<br /><br />If you are athletic or very active, you may like working outside where you '  +
    'could do physical activities. Also, many jobs do not involve paperwork and you ' +
	'can work on your own.  Want to rethink about working inside?' +
	'</td></tr></table>'	
  }
  else // this is last question about noisy conditions
  {
    // here, there are multiple messages depending on the codes
	 
	 if(code == "0021")
	 {
	   myhtml = '<table width="350" border="0" height="80%">' +
      '<tr><td valign="top" height="20" class="contentdiv"><b>Mind working under noisy conditions?</b>' +
      '</td></tr><tr><td valign="top" class="contentdiv">' +
	  '<br />Pipefitter positions require employees to work outdoors; at times on very '  +
      'busy streets. It also requires the use of jackhammers to break up the road.<br />' +
	  '<br />Our Maintenance and Repair and Plant Operator positions work mostly indoors ' +
	  'around heavy machinery such as generators, motors, etc.' +
	  '<br /><br />Although some utility jobs are in noisy conditions, protective hearing ' +
	  'gear is provided. If you are a good detective, you may enjoy maintenance and repair work.' +
	  '</td></tr></table>'
	}
	else if(code == "0001")
	{
	   myhtml = '<table width="350" border="0" height="80%">' +
      '<tr><td valign="top" height="20" class="contentdiv"><b>Mind working under noisy conditions?</b>' +
      '</td></tr><tr><td valign="top" class="contentdiv">' +	  
	  '<br />Our Maintenance and Repair and Plant Operator positions work mostly indoors ' +
	  'around heavy machinery such as generators, motors, etc.' +
	  '<br /><br />Although some utility jobs are in noisy conditions, protective hearing ' +
	  'gear is provided. Are you able to do more than one thing at once, like listen to ' +
	  'music while you are doing homework? Power Plant operators are pros at this!' +
	  '</td></tr></table>'
	}
	else if(code == "0111")
	{
	   myhtml = '<table width="350" border="0" height="80%">' +
      '<tr><td valign="top" height="20" class="contentdiv"><b>Mind working under noisy conditions?</b>' +
      '</td></tr><tr><td valign="top" class="contentdiv">' +
	  '<br />Pipefitter positions require employees to work outdoors; at times on very '  +
      'busy streets. It also requires the use of jackhammers to break up the road.<br />' +	  
	  '<br /><br />Although some utility jobs are in noisy conditions, protective hearing ' +
	  'gear is provided. If you enjoy building things, but don\'t want to be a construction ' +
	  'worker, you may want to consider power plant or gas utility work.' +
	  '</td></tr></table>'
	}
	else if(code == "0121")
	{
	   myhtml = '<table width="350" border="0" height="80%">' +
      '<tr><td valign="top" height="20" class="contentdiv"><b>Mind working under noisy conditions?</b>' +
      '</td></tr><tr><td valign="top" class="contentdiv">' +
	  '<br />Pipefitter positions require employees to work outdoors; at times on very '  +
      'busy streets. It also requires the use of jackhammers to break up the road.<br />' +
	  '<br />Our Maintenance and Repair and Plant Operator positions work mostly indoors ' +
	  'around heavy machinery such as generators, motors, etc.' +
	  '<br /><br />Although some utility jobs are in noisy conditions, protective hearing ' +
	  'gear is provided. If this sounds good to you, there are a variety of utility ' +
	  'positions you may want to consider.' + 
	  '</td></tr></table>'
	}
	else if(code == "0101")
	{
	   myhtml = '<table width="350" border="0" height="80%">' +
      '<tr><td valign="top" height="20" class="contentdiv"><b>Mind working under noisy conditions?</b>' +
      '</td></tr><tr><td valign="top" class="contentdiv">' +	  
	  '<br />Our Maintenance and Repair and Plant Operator positions work mostly indoors ' +
	  'around heavy machinery such as generators, motors, etc.' +
	  '<br /><br />Although some utility jobs are in noisy conditions, protective hearing ' +
	  'gear is provided. If you are a good detective, you may ' +
	  'enjoy maintenance and repair work.' +
	  '</td></tr></table>'
	}
		 
  }
  
  divObj.innerHTML = myhtml 


} // end of function

