﻿// JScript File
function browserCheck() {
    var browserName = navigator.appName;
    var browserVer = navigator.appVersion;
    var desc = navigator.plugins["Shockwave Flash"] ? navigator.plugins["Shockwave Flash"].description : "";
    desc = navigator.plugins["Shockwave Flash 9.0"] ? navigator.plugins["Shockwave Flash 9.0"].description : desc;

    alert ('You are using ' + browserName + ' v: ' + browserVer + '\nPlugins: ' + desc); 
//    alert ('You are using ' + browserName + ' v: ' + browserVer); 

}

function showPersona(persName) {
    phMain = document.getElementById("homemaincontentprimary");
    phEnter = document.getElementById("home_enter");
    phAttend = document.getElementById("home_attending");
    phAfter = document.getElementById("home_after");
    phLifelong = document.getElementById("home_lifelong");
    
    fEnter = document.getElementById("imgEnter");
    fAttend = document.getElementById("imgAttend");
    fAfter = document.getElementById("imgAfter");
    fLifelong = document.getElementById("imgLifelong");
            
//        alert("Persona is " + persName);
    if (persName == "Enter-College") {
//            alert (phEnter.name);
        phEnter.style.display = 'inline';
        phMain.style.display = 'none';
        phAttend.style.display = 'none';
        phAfter.style.display = 'none';
        phLifelong.style.display = 'none';
        fEnter.src = image_url[0];
    } else if (persName == "Attending-College") {
//            alert (phAttend);
        phEnter.style.display = 'none';
        phMain.style.display = 'none';
        phAttend.style.display = 'inline';
        phAfter.style.display = 'none';
        phLifelong.style.display = 'none';
        fAttend.src = image_url[1];
    } else if (persName == "After-College") {
        phEnter.style.display = 'none';
        phMain.style.display = 'none';
        phAttend.style.display = 'none';
        phAfter.style.display = 'inline';
        phLifelong.style.display = 'none';
        fAfter.src = image_url[2];
    } else if (persName == "Lifelong-Learning") {
        phEnter.style.display = 'none';
        phMain.style.display = 'none';
        phAttend.style.display = 'none';
        phAfter.style.display = 'none';
        phLifelong.style.display = 'inline';
        fLifelong.src = image_url[3];
    } else if (persName == "Home") {
        phEnter.style.display = 'none';
        phMain.style.display = 'inline';
        phAttend.style.display = 'none';
        phAfter.style.display = 'none';
        phLifelong.style.display = 'none';
//        fLifelong.src = image_url[3];
    }
}

function noFlash() {
    var noFlashContent = document.getElementById("homemaincontent");
    var noFlashContentBottom = document.getElementById("homesubcontent");
//    noFlashContent.style.display = 'none';
//    var flashContent = document.getElementById("homeflashcontent");

//    flashContent.style.display = 'none';
//    noFlashContent.style.display = 'block';
//    noFlashContentBottom.style.display = 'block';    

    if (document.images)
    {
      preload_image_object = new Image();
      // set image url
      image_url = new Array();
      image_url[0] = "/images/entering-college.jpg";
      image_url[1] = "/images/attending-college.jpg";
      image_url[2] = "/images/after-college.jpg";
      image_url[3] = "/images/lifelong.jpg";

       var i = 0;
       for(i=0; i<=3; i++) 
         preload_image_object.src = image_url[i];
    }

}

function fakeFlashTest() {
    var noFlashContent = document.getElementById("homemaincontent");
    var noFlashContentBottom = document.getElementById("homesubcontent");
//    noFlashContent.style.display = 'none';
    var flashContent = document.getElementById("homeflashcontent");
    var msg = "Content on this page requires a newer version of Macromedia Flash Player. \nDo you want to display non-Flash version of the site?";
//    flashContent.style.display = 'none';

    var browserName = navigator.appName;
    alert ('You are using ' + browserName);
    
    var useFlash = confirm(msg);
    if (useFlash) {
//        flashContent.style.display = 'none';
    } else {
//        flashContent.style.display = 'block';
//        noFlashContent.style.display = 'none';
//        noFlashContentBottom.style.display = 'none';
    }
    
//    window.location = "/Default1.aspx";
}

function MM_CheckFlashVersion(){
    var reqVerStr = '8,0,0,0';
//    var msg = 'Content on this page requires a newer version of Macromedia Flash Player. Do you want to download it now?';
    var msg = "Content on this page requires a newer version of Macromedia Flash Player. \nDo you want to display non-Flash version of the site?";
//    var noFlashContent = document.getElementById("homemaincontent");
//    var noFlashContentBottom = document.getElementById("homesubcontent");
    var flashContent = document.getElementById("homeflashcontent");
//    noFlashContent.style.display = 'none';
//    noFlashContentBottom.style.display = 'none';
//    flashContent.style.display = 'none';
    
    var browserName = navigator.appName;
//    alert ('You are using ' + browserName);

  with(navigator){
    var isMozilla = (appName == "Netscape");
//    alert ('Mozilla = ' + isMozilla);
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin) {  
      var flashVer = -1;
      
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 9.0"] ? plugins["Shockwave Flash 9.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
//      alert ('flashVer = ' + flashVer + ', reqVer = ' + reqVer );
      if (flashVer < reqVer){
        if (confirm(msg)) {
//          window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
//            flashContent.style.display = 'none';
        } else {
//            window.location = "Default1.aspx";
//            flashContent.style.display = 'block';
            noFlashContent.style.display = 'none';
            noFlashContentBottom.style.display = 'none';
        }
      } else {
//        if (confirm(msg)) {
//            flashContent.style.display = 'none';
//        } else {
//            flashContent.style.display = 'block';
//            noFlashContent.style.display = 'none';
//            noFlashContentBottom.style.display = 'none';        
//        }
      }
    } else {
//        if (confirm(msg)) {
//            flashContent.style.display = 'none';
//        } else {
//            window.location = "Default1.aspx";
//            flashContent.style.display = 'block';
//            noFlashContent.style.display = 'none';
//            noFlashContentBottom.style.display = 'none';
//        }
    }
  } 
}

function fixedSize(url,name,features) {
     //This launches a new window and then
     //focuses it if window.focus() is supported.
     win = window.open(url,name,features);
}
