//************************Script Info**************************************************************
// This script modified by Burke - 1/7/08 - THIS IS THE 8.1 Version
// - It's to be pulled into index.html & functions as the pop-up links for browser upgrades & faq/privacy pages
// - It also controls the look & placement of the progress bar.

function privacy(skin)  {
    iwin2 = window.open("http://www.cfmc.com/surveys/privacy"+skin+".html",studycode,
    "status=no,toolbar=no,location=no,menu=no,width=800,height=600,scrollbars=yes,resizable=1");
    iwin2.focus();
}

function faq(skin)  {
    iwinf = window.open("http://www.cfmc.com/surveys/faq"+skin+".html",studycode,
    "status=no,toolbar=no,location=no,menu=no,width=800,height=600,scrollbars=yes,resizable=1");
    iwinf.focus();
}

/*UNCOMMENT THIS FOR NON-JDPA SURVEYS*/
function privacy(skin)  {
    iwin2 = window.open("http://www.cfmc.com/surveys/privacy"+skin+".html",studycode,
    "status=no,toolbar=no,location=no,menu=no,width=800,height=600,scrollbars=yes,resizable=1");
    iwin2.focus();
}

function faq(skin)  {
    iwinf = window.open("http://www.cfmc.com/surveys/faq"+skin+".html",studycode,
    "status=no,toolbar=no,location=no,menu=no,width=800,height=600,scrollbars=yes,resizable=1");
    iwinf.focus();
}

/*UNCOMMENT THIS FOR JDPA SURVEYS*/
/*
function privacy(skin)  {
    iwin2 = window.open("http://www.jdpower.com/privacy",studycode,
    "status=no,toolbar=no,location=no,menu=no,width=800,height=600,scrollbars=yes,resizable=1");
    iwin2.focus();
}

function faq(skin)  {
    iwinf = window.open("http://www.jdpowersurveys.com/faqjdpa"+skin+".html",studycode,
    "status=no,toolbar=no,location=no,menu=no,width=800,height=600,scrollbars=yes,resizable=1");
    iwinf.focus();
}
*/

//******************  Status bar function control ***********************************************
var use_statusbar = true;   //true or false: should a statusbar be displayed
var use_statusticker   = true;  //true or false:  should the statusticker be displayed
var statusbar_text = "<FONT SIZE='-1' color='white'><i> Progress </i></FONT>";
var statusbar_done_image = "/cfmcweb/images/Pixels/blue.gif";
var statusbar_left_image = "/cfmcweb/images/Pixels/white.gif";
var statusbar_width = 150;
var statusbar_align = "left";
var statusbar_thickness = 10;

function statbar() {
  if (document.forms["statbar"] != null && document.forms["statbar"] != undefined) {
    var status_pct = document.forms["statbar"].elements["statbar_perc"].value;
  } else {
    var status_pct = -1;
  }

  ///////////////////////////////////////////////////////////////////////////
  if (status_pct == undefined) status_pct = -1;
  if (comp_tmpl == true || term_tmpl == true) status_pct = -1;
  ///////////////////////////////////////////////////////////////////////////

  if (use_statusbar && status_pct >= 0) {
     var done = parseInt( statusbar_width * status_pct / 100 );
     var left = statusbar_width - done;
     var bar;
     var s_content = "<br clear=all>";
         s_content += "<div style=\"margin: 8px 0cm 45px 20px \"><table border=0 align=" + statusbar_align + ">";
         s_content += "<tr>";
     if (statusbar_text != "") {
        s_content += "<td align='center'>";
        s_content += statusbar_text;
     }
     s_content += "</td><td valign='bottom'><img src=" + statusbar_done_image + " ";
     s_content += "  height=" + statusbar_thickness + " width=" + done + " border='1' style=\"border-color:white\">";
     s_content += "<img src=" + statusbar_left_image + " ";
     s_content += "  height=" + statusbar_thickness + " width=" + left + " border='1' style=\"border-color:white\">";
     s_content += "</td></tr></table></div>";

     InsertText("statbar",s_content);
  }

 if (use_statusticker == true && status_pct >= 0) {
   var tickdone = status_pct;
   var leftprct =  100 - tickdone;

   tempmsg = sb_msg;
    while ( (k = tempmsg.indexOf("_TICKDONE_")) > 0) {
       tempmsg = tempmsg.substr(0, k) + tickdone + tempmsg.substr(k+10);
    }
    while ( (k = tempmsg.indexOf("_LEFTPRCT_")) > 0) {
       tempmsg = tempmsg.substr(0, k) + leftprct + tempmsg.substr(k+10);
    }

   var msg = tempmsg;
   window.status = window.defaultStatus = msg;
 } else {
    window.status = window.defaultStatus = "";
 }
}
//******************  End Status bar function control ********************************************
