// initialize jQuery var jQueryScriptOutputted = false; initJQuery(); // iframe resize var scriptTag = document.getElementsByTagName('script'); scriptTag = scriptTag[scriptTag.length - 1]; var parentTag = scriptTag.parentNode; var sizerScript = document.createElement('script'); sizerScript.src = "//puzzles.kingdigital.com/v4.1/js/iframeResizer.min.js"; var sizerInit = document.createElement('script'); sizerInit.src = "//puzzles.kingdigital.com/v4.1/js/iframeResizer.init.js"; parentTag.appendChild(sizerScript); // parentTag.appendChild(sizerInit); // keep // document.write(''); // keep document.write(''); /* Get args from URI */ function get(name) { var q = unescape(location.search.substring(1)).split(/[=&]/); for (var j=0; j= 2) return stringValue; if (stringValue.length == 1) return ("0" + stringValue); return "00"; } /****************************************************************************************/ /* Draws portal */ function drawPortal(clientID, contentType, contentID) { // get args passed in URI var content_name = get("content_name"); var date = get("date"); var print_opt = get("print_opt"); if (contentID!=null) { // puzzle can only be alacarte based on this request; ignore content_name var isAlacarte = "yes"; var content_name = contentID; } else { var isAlacarte = "no"; } // if it's a sample, default to first day of last month, if no month is provided if ((date==null) && (clientID=="sample_alacarte")){ var tempDate = new Date(); var curYear = tempDate.getFullYear(); var curMonth = tempDate.getMonth(); var sampleDate=new Date(curYear, curMonth-1, 0); sampleDate.setDate(sampleDate.getDate()+1); // add a day date = dateToString(sampleDate); } // set base iframe url; add clientID and a la carte opt var viewURL = ("//puzzles.kingdigital.com/v4.1/server/display.php?clientID="+clientID+"&alacarte="+isAlacarte); // if content_name is specified, check for date; append viewURL as needed if (content_name!=null){ if (date!=null){ viewURL += ("&date="+date); } if (print_opt!=null){ viewURL += ("&print_opt="+print_opt); // DEPRICATE?? } viewURL += ("&content_name="+content_name); } /******** Write iframe code to page ******/ document.write(''); } /****************************************************************************************/ /* initialize jQuery if it's not present */ function initJQuery() { // if the jQuery object isn't available if (typeof(jQuery) == 'undefined') { if (! jQueryScriptOutputted) { //only output the script once. jQueryScriptOutputted = true; //output the script (load it from jquery api) document.write(''); } setTimeout("initJQuery()", 50); } }