<!--

function checkProduct(theCid, theNumber, theElement, thePrice)
    {
    if(theElement == null)
        {
        return;
        }
    
    if(theElement.checked == true)
        {
        strSum = strSum + thePrice;
        strNum++;
		strInnerHtml = strInnerHtml + "<input type='hidden' name='product_" + strNum + "_path' value='" + theCid + "' /><input type='hidden' name='product_" + strNum + "_quantity' value='1' />";
        }
    else
        {
        return;
        }
    }

function calculate()
    {
    strCT  = "/crosswordtwist";
	strFF  = "/fantasticfarm";
    strJT  = "/jeweltwist";
	strPTM = "/popthemarbles";
    strKEB = "/kakuroepic";
    strME  = "/mahjongepic";
    strOE  = "/solitaireepic";
    strSEB = "/sudokuepic";
    strTM  = "/theseusandtheminotaur";
    strWT  = "/guessthephrase";
    strYT  = "/maxidice";
    strZMW = "/zambyandthemysticalcrystals";
    strZMM = "/zambyandthemysticalcrystals";
    
    strNum = 0;
    strSum = 0;
    strTotal = 0;
    strDiscountValue = 0;
    strDiscount = "";
    strInnerHtml = "";
    strCustom5 = "";
    strReturn = "";



    // Check Main Game
    // ###############

    // Crossword Twist
    checkProduct(strCT, strNum, document.getElementById("order").gamemct, 19.95);

    // Fantastic Farm
    checkProduct(strFF, strNum, document.getElementById("order").gamemff, 19.95);

    // Jewel Twist
    checkProduct(strJT, strNum, document.getElementById("order").gamemjt, 19.95);
	
	// Pop The Marbles
    checkProduct(strPTM, strNum, document.getElementById("order").gamemptm, 19.95);

    // Kakuro Epic
    checkProduct(strKEB, strNum, document.getElementById("order").gamemkeb, 19.95);

    // Mahjong Epic
    checkProduct(strME, strNum, document.getElementById("order").gamemme, 19.95);

    // Solitaire Epic
    checkProduct(strOE, strNum, document.getElementById("order").gamemoe, 19.95);

    // Sudoku Epic
    checkProduct(strSEB, strNum, document.getElementById("order").gamemseb, 19.95);

    // Theseus and the Minotaur
    checkProduct(strTM, strNum, document.getElementById("order").gamemtm, 9.95);

    // Word Twist
    checkProduct(strWT, strNum, document.getElementById("order").gamemwt, 19.95);

    // Yatzy Twist
    checkProduct(strYT, strNum, document.getElementById("order").gamemyt, 19.95);

    // Zamby and the Mystical Crystals - Windows
    checkProduct(strZMW, strNum, document.getElementById("order").gamemzmw, 19.95);

    // Zamby and the Mystical Crystals - Mac
    checkProduct(strZMM, strNum, document.getElementById("order").gamemzmm, 19.95);
        


    // Check Added Games
    // #################

    // Crossword Twist
    checkProduct(strCT, strNum, document.getElementById("order").gamect, 19.95);

    // Fantastic Farm
    checkProduct(strFF, strNum, document.getElementById("order").gameff, 19.95);

    // Jewel Twist
    checkProduct(strJT, strNum, document.getElementById("order").gamejt, 19.95);
	
	// Pop The Marbles
    checkProduct(strPTM, strNum, document.getElementById("order").gameptm, 19.95);

    // Kakuro Epic
    checkProduct(strKEB, strNum, document.getElementById("order").gamekeb, 19.95);

    // Mahjong Epic
    checkProduct(strME, strNum, document.getElementById("order").gameme, 19.95);

    // Solitaire Epic
    checkProduct(strOE, strNum, document.getElementById("order").gameoe, 19.95);

    // Sudoku Epic
    checkProduct(strSEB, strNum, document.getElementById("order").gameseb, 19.95);

    // Theseus and the Minotaur
    checkProduct(strTM, strNum, document.getElementById("order").gametm, 9.95);

    // Word Twist
    checkProduct(strWT, strNum, document.getElementById("order").gamewt, 19.95);

    // Yatzy Twist
    checkProduct(strYT, strNum, document.getElementById("order").gameyt, 19.95);

    // Zamby and the Mystical Crystals - Windows
    checkProduct(strZMW, strNum, document.getElementById("order").gamezmw, 19.95);

    // Zamby and the Mystical Crystals - Mac
    checkProduct(strZMM, strNum, document.getElementById("order").gamezmm, 19.95);



    // Discount
    if(strNum >= 2)
	{
        strDiscountValue = strSum * 0.20;
	    strDiscount = Math.round(strDiscountValue*10000)/10000;
	    strDiscount = strDiscount.toFixed(2);
	    strDiscount = "($" + strDiscount + " discount)";
	    
	    // couponCode
	    strInnerHtml = strInnerHtml + "<input type=\"hidden\" name=\"coupon\" value=\"KGD826\" />\n";
	}
	else
	{
        strDiscount = "";
	}

    // Total
    strTotal = Math.round((strSum - strDiscountValue)*10000)/10000;
    strTotal = strTotal.toFixed(2);
    strTotal = "US $" + strTotal;

    document.getElementById("total").innerHTML = strTotal;
    document.getElementById("discount").innerHTML = strDiscount;

    // HTML
    document.getElementById("gamelist").innerHTML = strInnerHtml;
	
    return strNum;
    } 
    
function checkOrder()
    {
    if(calculate() == 0)
        {
        alert("If you wish to order a game, please check the corresponding box.");
        return false;
        }
 		
    return true;
    }
    
//-->