function Riddle(title, body, tag, imageUrl){
this.title = title;
this.body = body;
this.tag = tag;
this.imageUrl = imageUrl;
}
var riddle = new Riddle('Flipping Lockers', '\n<p>\n There are 1 million closed school lockers in a row, labeled 1 through 1,000,000.\n</p>\n<p>\n You first go through and flip every locker open.\n</p>\n<p>\n Then you go through and flip every other locker (locker 2, 4, 6, etc...). When you\'re done, all the even-numbered lockers are closed.\n</p>\n<p>\n You then go through and flip every third locker (3, 6, 9, etc...). "Flipping" mean you open it if it\'s closed, and close it\n if it\'s open. For example, as you go through this time, you close locker 3 (because it was still open after the previous run through),\n but you open locker 6, since you had closed it in the previous run through.\n</p>\n<p>\n Then you go through and flip every fourth locker (4, 8, 12, etc...), then every fifth locker (5, 10, 15, etc...), then every sixth \n locker (6, 12, 18, etc...) and so on. At the end, you\'re going through and flipping every 999,998th locker (which is just locker \n 999,998), then every 999,999th locker (which is just locker 999,999), and finally, every 1,000,000th locker (which is just locker \n 1,000,000).\n</p>\n<p>\n At the end of this, is locker 1,000,000 open or closed?\n</p>\n', 'flipping-lockers', '');
function showRiddle(curRiddle){
var elem = document.getElementById('riddle_body');
elem.innerHTML = curRiddle.body;
var elem = document.getElementById('riddle_title');
elem.innerHTML = curRiddle.title;
var elem = document.getElementById('riddle_image');
if ((curRiddle.imageUrl == null) || (curRiddle.imageUrl == '')){
elem.innerHTML = '';
}else{
elem.innerHTML = '
';
}
var elem = document.getElementById('riddle_solution');
elem.innerHTML = 'Click here to see the solution.';
}
document.write('<style>\r\n.bigriddles_widget{\r\n position: relative;\r\n width:325px;\r\n padding: 3px 0px 5px 0px;\r\n border:2px solid #003399;\r\n color:black;\r\n background-color:white;\r\n text-align:right;\r\n}\r\n.bigriddles_widget #riddle_title{\r\n font-size:130%;\r\n font-weight:bold;\r\n padding:1px 5px 1px 5px;\r\n text-align: left;\r\n}\r\n.bigriddles_widget #riddle_section{\r\n padding:5px;\r\n height: 175px;\r\n overflow: auto;\r\n text-align: left;\r\n}\r\n.bigriddles_widget #riddle_solution{\r\n font-weight:bold;\r\n margin-top:10px;\r\n}\r\n.bigriddles_widget #riddle_nav{\r\n padding:3px 5px 3px 5px;\r\n text-align:center;\r\n}\r\n.bigriddles_widget .riddles_signoff{\r\n font-size:80%;\r\n}\r\n.bigriddles_widget .horiz_sep{\r\n width:100%;\r\n height:1px;\r\n padding:0px;\r\n margin:0px;\r\n border-top:1px solid #003399;\r\n}\r\n.bigriddles_widget .smaller{\r\n font-size:80%;\r\n}\r\n.bigriddles_widget a{\r\n color: #003399;\r\n text-decoration: none;\r\n}\r\n.bigriddles_widget a:visited{\r\n color: #003399;\r\n text-decoration: none;\r\n}\r\n.bigriddles_widget td{\r\n color: black;\r\n}\r\n.bigriddles_widget li{\r\n color: black;\r\n}\r\n</style>\r\n\r\n<div class="smaller" style="float:left;padding:0px 0px 1px 3px;">\r\n <a href="http://www.bigriddles.com">\r\n <img src="http://www.bigriddles.com/images/icon1.png" style="border:none;" />\r\n </a>\r\n</div>\r\n<div class="smaller" style="float:left;padding-left:3px;">\r\n <a href="http://www.bigriddles.com">BigRiddles.com</a>\r\n</div>\r\n<div class="smaller" style="float:right;padding-right:3px;font-weight:bold;">\r\n Riddle of the Day\r\n</div>\r\n<div style="clear:both;"></div>\r\n\r\n<div class="horiz_sep"></div>\r\n<div id="riddle_title"></div>\r\n\r\n<div id="riddle_section">\r\n <div id="riddle_image" style="float:right;"></div>\r\n <div id="riddle_body"></div>\r\n <div id="riddle_solution"></div>\r\n <div style="clear:both;"></div>\r\n</div>\r\n \r\n<div class="horiz_sep"></div>\r\n\r\n<span class="smaller">\r\n <a href="http://www.bigriddles.com/widgets">Get this widget</a> |\r\n</span>\r\n \r\n');
showRiddle(riddle);