/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*Have to put this script inside the CDATA to so that some special characters 
 *like < > is not parsed by xhtml validator*/

// <![CDATA[       

    //Texts for mouse over
    //var menuTextOff =         "<b>Welcome to CareerZone</b>               <br><br>CareerZone is the place to learn about your skills<br>and talents and to explore many exciting careers<br>in New York State.";
    var menuTextOff =           "<b>Welcome to CareerZone</b>               <br/><br/>The place to explore careers related to <br/>your strengths, skills and talents. <br/>To begin, click one of the six clusters <br/>pictured above, or <a href='#' onclick='$(\"#clusterAll\").click();return false;'> View All Careers</a> to <br/>see all the occupations.";
    var menuTextArts =          "<b>Arts and Humanities</b>                 <br/><br/>People working in this field engage in literary, cultural, artistic, athletic and entertainment activities.  They interpret and communicate concepts and ideas through writing, painting, drawing, speaking, dancing, musical expression and a wide variety of other communication techniques.";
    var menuTextBusiness =      "<b>Business and Information Systems</b>    <br/><br/>People working in this field support public and private enterprises by managing people and information.  They perform such activities as planning, training, promoting, consulting, researching and reporting.  These activities result in the creation, storage and retrieval/distribution of information.";
    var menuTextEngineering =   "<b>Engineering and Technology</b>          <br/><br/>People working in this field use technical knowledge and skill to assemble, inspect, design, maintain and repair.  They provide scientific and diagnostic skills to maintain and repair computer equipment, aircraft, automobiles, buildings, roads, bridges, and manufacturing machinery.";
    var menuTextMedical =       "<b>Health Services</b>                     <br/><br/>People working in this field provide health care and support services to address the physical, mental and emotional needs of their clients.  They apply scientific, technical, social and interpersonal skills to diagnose and treat illnesses, document care, provide a therapeutic environment and maintain the health of their clients.";
    var menuTextAgricultural =  "<b>Natural and Agricultural Sciences</b>   <br/><br/>People working in this field apply technical and scientific knowledge to the study of the earth and its elements and frontiers.  They care for and protect environments, harvest natural resources, such as plants, and raise animals.";
    var menuTextHumanServices = "<b>Human and Public Services</b>           <br/><br/>People working in this field provide protective, social, education and community services.  They provide assistance to individuals or families in periods of need throughout their lives.";
    var menuTextStem =          "<b>STEM for Teens</b>                      <br/><br/>Do you like to discover, invent, and create?  Do you want to make the world a better place?  If so, then consider a career in Science, Technology, Engineering and Math (STEM). The possibilities are endless!";
    var menuTextFin =           "<b>Dollars &amp; $ense</b>                 <br/><br/>As you plan for life beyond High School, which may include college or entering the workforce, planning a budget can help you get where you want to go financially.";
    var menuTextIT =            "<b>Instructional Tools</b>                 <br/><br/>Are you instructing others or leading a group? Here is what you need to make your presentation stand out from the rest. Instructional Videos, Facilitator Guides, Lesson Plans and more to help educators and Workforce Professionals implement CareerZone.";

    var fisheyemenu = {
    
    startSizeHt : 72,
    startSizeWt : 104,
    endSizeHt : 104,
    endSizeWt : 140,
    imgType : ".gif",
    init : function () {
        //Initialize the default content of the descriptionDiv. This is the improvement from the orginial site
        //where the default content is defined duplicatedly: 1st time in HTML page, then it is redefined again in JS.
        jQuery("#descriptionDiv").html(menuTextOff);
        var animElements = jQuery('#fisheye_menu img');
        for(var i=0; i < animElements.length; i++) {
            var y = animElements[i];
            y.style.width = fisheyemenu.startSizeWt+'px';
            y.style.height = fisheyemenu.startSizeHt+'px';
            
            fisheyemenu.imgSmall(y);
            animElements[i].onmouseover = newchangeSize;
            animElements[i].onmouseout = newrestoreSize;
        }
        // begin insert dp0vn3
        function newchangeSize()
        {   
            //test for which text to display
           if (this.id == "iconArt") {
                changeSilhoute("silhoute1", menuTextArts);
            }
            else if (this.id == "iconBuz") {
                changeSilhoute("silhoute2", menuTextBusiness);
            }
            else if (this.id == "iconEng") {
                changeSilhoute("silhoute3", menuTextEngineering) ;
            }
            else if (this.id == "iconMed") {
                changeSilhoute("silhoute4", menuTextMedical) ;
            }
            else if (this.id == "iconAgr") {
                changeSilhoute("silhoute5", menuTextAgricultural) ;
            } 
            else if (this.id == "iconHus") {
                changeSilhoute("silhoute6", menuTextHumanServices) ;
            } 

            // change size
            changeSize(this);
            
        }
        function newrestoreSize()
        {
            changeSilhoute("silhoute0", menuTextOff);
            restoreSize(this);
        }
        // end insert
        function changeSize(thisObj) {
          
            fisheyemenu.imgLarge(thisObj);
            if (!thisObj.currentWidth) thisObj.currentWidth = fisheyemenu.startSizeWt;
            if (!thisObj.currentHeight) thisObj.currentHeight = fisheyemenu.startSizeHt;
            fisheyemenu.resizeAnimation(thisObj,thisObj.currentWidth,thisObj.currentHeight,fisheyemenu.endSizeWt,fisheyemenu.endSizeHt,15,10,0.333);
        }
        function restoreSize(thisObj) {
            if (!thisObj.currentWidth) return;
            fisheyemenu.resizeAnimation(thisObj,thisObj.currentWidth,thisObj.currentHeight,fisheyemenu.startSizeWt,fisheyemenu.startSizeHt,15,10,0.5);
            fisheyemenu.imgSmall(thisObj);
        }
    },
    resizeAnimation : function (elem,startWidth,startHeight,endWidth,endHeight,steps,intervals,powr) {
        if (elem.widthChangeMemInt) window.clearInterval(elem.widthChangeMemInt);
        var actStep = 0;
        elem.widthChangeMemInt = window.setInterval(
            function() {
                elem.currentWidth = fisheyemenu.easeInOut(startWidth,endWidth,steps,actStep,powr);
                elem.currentHeight = fisheyemenu.easeInOut(startHeight,endHeight,steps,actStep,powr);
                elem.style.width = elem.currentWidth+"px";
                elem.style.height = elem.currentHeight+"px";
                actStep++;
                if (actStep > steps) window.clearInterval(elem.widthChangeMemInt);
            }
            ,intervals)
    },
    easeInOut : function (minValue,maxValue,totalSteps,actualStep,powr) {
    //Generic Animation Step Value Generator By www.hesido.com
        var delta = maxValue - minValue;
        var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
        return Math.ceil(stepp)
    },
    imgSmall : function (obj) {
        
        imgSrc = obj.getAttribute("src");
        var typePos = imgSrc.indexOf(fisheyemenu.imgType);
        var imgName = imgSrc.substr(0, typePos);    
        obj.setAttribute("src", imgName+"_small"+imgSrc.substr(typePos));
    },
    
    
    imgLarge : function (obj) {
       
        imgSrc = obj.getAttribute("src");
        var suffixPos = imgSrc.indexOf("_small");
        var imgName = imgSrc.substr(0, suffixPos);
        var typePos = imgSrc.indexOf(fisheyemenu.imgType);
        obj.setAttribute("src", imgName+imgSrc.substr(typePos));
    }
}

    // Add event with wide browser support
    if ( typeof window.addEventListener != "undefined" )
        window.addEventListener( "load", fisheyemenu.init, false );
    else if ( typeof window.attachEvent != "undefined" )
        window.attachEvent( "onload", fisheyemenu.init );
    else {
        if ( window.onload != null ) {
            var oldOnload = window.onload;
            window.onload = function ( e ) {
                oldOnload( e );
                fisheyemenu.init();
            };
        }
        else
            window.onload = fisheyemenu.init;
    }

function silDivHideAll() {
  
    /*First we set all images to hidden so that image are not flicked when the page is being loaded
     *After that, we remove the style (in this case is style for hiding images), and use jQuery hide.
     *The reason we don't use visibility:hidden is jQuery effect has a problem with hidden object, so we 
     *have to use jQuery.hide to hide the objects, and call the effect function.
     **/
    
    jQuery('#silhoute img').removeAttr('style').hide();
    
    
}

function changeSilhoute(silhoute, menuText){
//   document.getElementById("descriptionDiv").innerHTML = menuText;
   
    jQuery("#descriptionDiv").html(menuText).hide().fadeIn("Slow");
    silDivHideAll();
    var silhouteId = '#' + silhoute;
    if(silhoute=='silhoute0')
    {
        jQuery('#splashContent').removeAttr('style');
        jQuery('#silhoute img').removeAttr('style').hide();
    }
    else
        jQuery('#splashContent').css('background', 'none');
        jQuery(silhouteId).slideToggle('slow');
      
}

// ]]>

