/* * This function parses ampersand-separated name=value argument pairs from * the query string of the URL. It stores the name=value pairs in  * properties of an object and returns that object. */function getArgs() {    var args = new Object();    var query = location.search.substring(1);  // Get query string.    var pairs = query.split("&");              // Break at ampersand.    for(var i = 0; i < pairs.length; i++) {	var pos = pairs[i].indexOf('=');       // Look for "name=value".	if (pos == -1) continue;               // If not found, skip.	var argname = pairs[i].substring(0,pos);  // Extract the name.	var value = pairs[i].substring(pos+1); // Extract the value.	args[argname] = unescape(value);          // Store as a property.    }    return args;                               // Return the object.}// pull the cumulative score from the URL// and update the hidden form fieldsvar args = getArgs();var d = document;var bs = d.getElementById("bs");var hm = d.getElementById("hm");var ml = d.getElementById("ml");if (args.bs) { bs.value = args.bs; }if (args.hm) { hm.value = args.hm; }if (args.ml) { ml.value = args.ml; }// add the most recent question// and update the hidden form fieldsif (args.q1) { bs.value = Number(bs.value) + Number(args.q1); }if (args.q2) { hm.value = Number(hm.value) + Number(args.q2); }if (args.q3) { ml.value = Number(ml.value) + Number(args.q3); }if (args.q4) { hm.value = Number(hm.value) + Number(args.q4); }if (args.q5) { ml.value = Number(ml.value) + Number(args.q5); }if (args.q6) { hm.value = Number(hm.value) + Number(args.q6); }if (args.q7) { bs.value = Number(bs.value) + Number(args.q7); }if (args.q8) { ml.value = Number(ml.value) + Number(args.q8); }if (args.q9) { bs.value = Number(bs.value) + Number(args.q9); }if (args.q10) { ml.value = Number(ml.value) + Number(args.q10); }var bs_message = '';var hm_message = '';var ml_message = '';if (bs.value >= 8) {  bs_message = "You're well on your way to becoming one of the great cattle barons of the West! You've got a shrewd head for business, can negotiate a sale, and keep a close, watchful eye on the expenses. Your uncle and his investors are pleased with their profits, and give you a $200 bonus for your hard work and quick thinking.";}else if (bs.value >= 5) {  bs_message = "You've got a good head on your shoulders when it comes to running a business. For a first-time trail boss, your profits are acceptable. You will definitely improve with more experience. Your uncle and his investors wish you could have made them a little more money, but all in all, you've done a decent job of making financial decisions.";}else if (bs.value >= 2) {  bs_message = "You should start packing your bags and getting ready to leave your brief life as a trail boss behind. Your financial decisions and business deals are poor, and your uncle and his investors have barely made a profit on the cattle drive.";}else {  bs_message = "Your uncle will be disowning you soon. Every financial decision you've made has been an utter disaster. You've actually succeeded in losing your uncle's money. In the surefire cattle market, you've proven yourself to have little business skill or sense.";}if (hm.value >= 8) {  hm_message = "Let's give you a home, where the buffalo roam! You've got a knack for managing and moving a sizeable herd of cattle. Your talents have protected the herd and made good use of the skills and strengths of your trail outfit.";}else if (hm.value >= 5) {  hm_message = "You've made some mistakes and bad judgements in managing the herd, but on the whole, you've done an admirable job for a trail boss on a first drive.";}else if (hm.value >= 2) {  hm_message = "It's a wonder your herd made it to the end of the trail. You can barely care for one cow, much less well over a thousand. Your cattle are thin and nervous, and your cowboys don't have a lot of faith in your ability to move them. You are almost dangerous on the trail.";}else {  hm_message = "Never attempt to drive cattle again. Leave them in the hands of experieced cowboys. Your decisions regarding the management of your cattle are horrible. It's plainly and simply a miracle that any of them made it over the trail alive.";}if (ml.value >= 10) {  ml_message = "Your cowboys adore you. They are pleased and proud to be working with you. Regardless of your other decisions, they've had a great time and would all work with you again.";}else if (ml.value >= 7) {  ml_message = "You're cowboys think you're okay. They still regard you as a greenhorn from the East, but they recognize that you have some sense and a good heart. Some of the cowboys might work with you again; others will probably not.";}else if (ml.value >= 4) {  ml_message = "Your cowboys don't really care for you or your leadership abilities. Many of them disagree with your decisions and will be happy to warn other cowboys to stay away from you and anything having to do with your uncle's ranch.";}else {  ml_message = "You should hightail it out of town immediately. Your cowboys would rather shoot you than look at you. They think you are a lousy leader, and they've all had a miserable time on the trail. Consider yourself lucky that you're still alive, and never try to lead cowboys again.";}