$(document).ready(function() { if(questionExists(51) == false) // set up the questions into cookies at first load. { loadQuestionsIntoCookie(); } initialQuestionLoad(); // preload the overlay. /* ********** Event Handlers ***************** */ $("div#questions_head, a[rel='edit_link'], p#learnMoreP").click(function(e) // handle click for the question box. { openMask(); }); $("#mask, img[rel='close_window']" ).click(function(e) // set mask fade out click. { $("#mask").fadeOut("fast"); $("#overlayContainer").fadeOut("fast"); $("#modalISIContainer").fadeOut("fast"); }); $("img[rel='print_window'], a[rel='print_link']").click(function(e) // add popup window action for the print button { window.open("landing_printQuestions.jsp", "printWindow", "width=765,height=500,scrollbars=1,resizable=0"); }); $(".questionLineContainer, .questionLineContainerAlt").click(function(e) // handle for click on each line item { var currNumber = $(this).attr("rel").substr(7); if (!$(".questionLineText", this).hasClass("isSelected")) { $(".questionLineText", this).css("font-weight", "bold").addClass("isSelected"); $("div.questionLineButton img", this).attr("src", "images/questions/questionline_button_on.gif"); writeClickCookie(currNumber); $("div#questions_body").show(); // explictly show the div just in case. $(".overview").append("
" + toolTipText[currNumber] + "
"); // also post to the sidebar // update the scrollbar if ($('#scrollbar1').tinyscrollbar()!= null) { $('#scrollbar1').tinyscrollbar().update(); } } else { $(".questionLineText", this).css("font-weight", "normal").removeClass("isSelected"); $("div.questionLineButton img", this).attr("src", "images/questions/questionline_button.png"); deleteCookie("qSelected",currNumber); $(".overview").children("p[name=qid" + currNumber + "]").remove(); // remove from the sidebar // update the scrollbar if ($('#scrollbar1').tinyscrollbar()!= null) { var oScrollbar = $('#scrollbar1').tinyscrollbar().update(); // update the scrollbar } if(document.cookie.indexOf("qSelected") < 0) // check to see if we collapse the sidebar { $("div#questions_body").hide(); } } }); /* ************************ Functions ************************ */ function openMask() // open the modal window { var maskWidth = $(window).width(); var maskHeight = $(document).height(); $("#mask").css( { "width": maskWidth, "height": maskHeight }).fadeIn(1000).fadeTo("slow", 0.8); if($(window).width() > $("#overlayContainer").width()) { $("#overlayContainer").css("left", ($(window).width()/2) - ($("#overlayContainer").width()/2)); } else { $("#overlayContainer").css("left", 0); } $("#overlayContainer").css("top", 110).fadeIn(2000); doColumnHeights(); // set the heights positionISI(); // position the ISI } // load the questions into the question container function initialQuestionLoad() { var currQuestion = ""; var alreadySelected = ""; var currQuestionText = ""; var cookieArray = document.cookie.split(";"); for(var iloop = 0; iloop <= cookieArray.length; iloop++) { if(cookieArray[iloop] != undefined) { var currentCookie = cookieArray[iloop]; currQuestion = cookieArray[iloop].replace(" ", ""); // if(currentCookie.length >0 && currQuestion.substring(0,9) == "qSelected")//deletes new site selected questions // { // currQuestion = currQuestion.substring( 9, currQuestion.indexOf("=")); // //alert(" qSelected =="+ currQuestion); // if(currQuestion < 50) // deleteCookie("qSelected",currQuestion); // } if(currentCookie.length >10 && currQuestion.substring(0,7) == "qCookie") { currQuestion = currQuestion.substring( 7, currQuestion.indexOf("=")); // if(currQuestion < 50)// deletes old site question list // { // //alert(" qCookie =="+ currQuestion); // deleteCookie("qCookie",currQuestion); // } if(currQuestion >50) { alreadySelected = document.cookie.indexOf("qSelected" + currQuestion + "="); // check if the line was already selected currQuestionText = cookieArray[iloop].replace(" ", ""); if(currQuestionText != "") { writeQuestionToPanel(currQuestionText, alreadySelected); } } } } } doAlternativeColorsQuestions(); // handle for the alternating backgrounds. } function positionISI() { var isiTop = $("#overlayContainer").offset().top + $("#questionsContainerTop").outerHeight() + $("#questionsContainerBottom").outerHeight() + $("#questionsMainCenter").outerHeight() + 20; $("#modalISIContainer").css("top", isiTop).show(); // display and position the ISI // set overlay if($(window).width() > $("#modalISIContainer").width()) { $("#modalISIContainer").css("left", ($(window).width()/2) - ($("#modalISIContainer").width()/2)); } else { $("#modalISIContainer").css("left", 0); } $("#mask").height($(document).height()); // reset the mask height } // write question in form of qCookieNN=QuestionText to the panel function writeQuestionToPanel(currentQuestion, alreadySelected) { var questionText = ""; var buttonText = ""; var questionArray = currentQuestion.split("="); (alreadySelected >= 0) ? questionText = "" + questionArray[1] + "
" + questionArray[1] + "

