form_aid = "";
form_gid = "";
form_hid = "";
form_lid = "";
form_sid = "";

try {
    if (window.external.IsInGameLauncher()) {
        totalTimeSec = window.external.GetTotalTrialTime();
        totalTimeMin = Math.floor(totalTimeSec / 60);
        timeLeftSec = window.external.GetTrialTimeLeft();
        if (timeLeftSec < 0) timeLeftSec = 0;
        if (timeLeftSec > totalTimeSec) timeLeftSec = totalTimeSec;
        timeLeftMin = Math.floor(timeLeftSec / 60);
        if (window.external.IsUnlimited()) {
            totalTimeMin = -1;
            totalTimeSec = 60;
            timeLeftSec = 60;
        }
        priceCents = window.external.GetGamePriceCents();
        priceICoins = window.external.GetGamePriceICoins();
        form_aid = window.external.GetGameAID();
        form_gid = window.external.GetGameID();
        form_hid = window.external.GetSystemHID();
        form_lid = window.external.GetSystemLID();
        form_sid = window.external.GetGameSKU();
    }
} catch (ex) {}

function writeLeftColumn() {
    document.writeln('<td width="200" align="center">');
    document.writeln('<img src="images/product/feature.jpg" alt="feature image" name="box_image" width="150" height="150"  border="0"><br>');
    document.writeln('<img src="images/generics/trans.gif" alt="" name="" width="20" height="20" border="0"><br>');
    document.writeln('<table border=0 cellpadding=0 cellspacing=0 style="position: absolute; left: 30px;">');
    document.writeln('<tr>');
    document.writeln('<td width=17><img src="images/generics/headerleft.jpg" alt=""></td>');
    document.writeln('<td width=118 background="images/generics/headermiddle.jpg"><img src="images/generics/headertext.jpg" alt=""></td>');
    document.writeln('<td background="images/generics/headermiddle.jpg">&nbsp;</td>');
    document.writeln('<td><img src="images/generics/headerright.jpg"></td>');
    document.writeln('</tr>');
    document.writeln('<tr id="paidquestion" height=80>');
    document.writeln('<td background="images/generics/ownleft.jpg" width=17></td>');
    document.writeln('<td colspan=2 background="images/generics/ownmiddle.jpg" align="center" style="font-weight: bold;">');
    document.writeln('<br>Click button below.<br><br>');
    document.writeln('<a href="#" class="mbuttons" onclick="document.getElementById(\'paidquestion\').className = \'hidden\'; document.getElementById(\'paidbox\').className = \'\'; document.getElementById(\'rightcolumn\').className=\'grayed\'; return false;">');
    document.writeln('<img src="images/generics/begin.jpg" alt="Begin" border="0"></a>');
    document.writeln('</td>');
    document.writeln('<td background="images/generics/ownright.jpg" width=17></td>');
    document.writeln('</tr>');
    document.writeln('<tr id="paidbox" class="hidden" height=80>');
    document.writeln('<td background="images/generics/ownleft.jpg" width=17></td>');
    document.writeln('<td colspan=2 background="images/generics/ownmiddle.jpg">');
    document.writeln('<form name="paidform" method="post" action="http://www.iwin.com/dispatchGameActivation.do?method=reactivation&drmType=iwin" id="paidform" style="margin: 0px;" onsubmit="if ((form_aid || form_gid || form_hid || form_lid || form_sid) && paidform.email.value) return true; else return false;">');
    document.writeln('<input type="hidden" name="aid" value="' + form_aid + '">'); 
    document.writeln('<input type="hidden" name="gid" value="' + form_gid + '">'); 
    document.writeln('<input type="hidden" name="hid" value="' + form_hid + '">'); 
    document.writeln('<input type="hidden" name="lid" value="' + form_lid + '">'); 
    document.writeln('<input type="hidden" name="sid" value="' + form_sid + '">'); 
    document.writeln('<table border=0 cellpadding=0 cellspacing=0>');
    document.writeln('<tr height=5><td><img src="images/generics/trans.gif" height=1 width=1></td></tr>');
    document.writeln('<tr>');
    document.writeln('<td colspan=5 style="font-weight: bold;">');
    document.writeln('Please enter the email you used to purchase game and click Apply button.');
    document.writeln('</td>');
    document.writeln('</tr>');
    document.writeln('<tr height=5><td><img src="images/generics/trans.gif" height=1 width=1></td></tr>');
    document.writeln('<tr valign=middle>');
    document.writeln('<td>');
    document.writeln('<input name="email" type="text" size="40">');
    document.writeln('</td>');
    document.writeln('<td>');
    document.writeln('<img src="images/generics/trans.gif" height=1 width=20>');
    document.writeln('</td>');
    document.writeln('<td>');
    document.writeln('<a href="javascript:if ((form_aid || form_gid || form_hid || form_lid || form_sid) && paidform.email.value) document.paidform.submit()" class="mbuttons">');
    document.writeln('<img src="images/generics/apply.jpg" alt="" border="0">');
    document.writeln('</a>');
    document.writeln('</td>');
    document.writeln('<td>');
    document.writeln('<img src="images/generics/trans.gif" height=1 width=20>');
    document.writeln('</td>');
    document.writeln('<td>');
    document.writeln('<a href="#" onclick="document.getElementById(\'paidbox\').className = \'hidden\'; document.getElementById(\'paidquestion\').className = \'\'; document.getElementById(\'rightcolumn\').className = \'\'; return false;">');
    document.writeln('<img src="images/generics/cancel.jpg" border="0">');
    document.writeln('</a>');
    document.writeln('</td>');
    document.writeln('</tr>');
    document.writeln('</table>');
    document.writeln('</form>');
    document.writeln('</td>');
    document.writeln('<td background="images/generics/ownright.jpg" width=17></td>');
    document.writeln('</tr>');
    document.writeln('<tr>');
    document.writeln('<td><img src="images/generics/footerleft.jpg" alt="" width=17></td>');
    document.writeln('<td colspan=2 background="images/generics/footermiddle.jpg" alt=""></td>');
    document.writeln('<td><img src="images/generics/footerright.jpg" alt="" width=17></td>');
    document.writeln('</tr>');
    document.writeln('</table>');
    document.writeln('</td>');
}

function writeFeatures() {
    document.writeln('<tr height="10"><td><img src="images/generics/trans.gif" width=1 height=1></td></tr>');
    for (i = 0; i < features.length; i++) {
        document.write('<tr valign="top" height="22"><td width="20"><img class="normalimage" src="images/generics/li.gif" width="4" height="10" border="0"><img class="grayimage" src="images/generics/ligray.gif" width="4" height="10" border="0"><img src="images/generics/trans.gif" width="16" height="1"></td><td width="100%">');
        document.write(features[i]);
        document.writeln('<br> </td></tr>');
    }
    document.writeln('<tr height="10"><td><img src="images/generics/trans.gif" width=1 height=1></td></tr>');
    }

function writeBuyButtons() {
    document.writeln('<tr><td>');
    document.writeln('<table>');
    document.writeln('<tr valign="bottom">');
    document.writeln('<td class="upselltext" align="left">');
    document.writeln('<img src="images/generics/trans.gif" width="8" height="1">');
    priceDollarPart = Math.floor(priceCents / 100);
    priceCentsPart = priceCents % 100;
    document.writeln('$' + priceDollarPart + '.' + priceCentsPart);
    document.writeln('</td>');
    document.writeln('<td>');
    document.writeln('<img src="images/generics/trans.gif" width="10" height="1">');
    document.writeln('</td>');
    document.writeln('<td class="upselltext" align="left" valign="bottom">');
    document.writeln('<img src="images/generics/trans.gif" width="5" height="1">');
    document.writeln('<span style="position: relative; bottom: -5px;">');
    document.writeln('<img class="normalimage" src="images/generics/icoins.jpg">');
    document.writeln('<img class="grayimage" src="images/generics/icoinsgray.jpg">');
    document.writeln('</span>');
    document.writeln(priceICoins);
    document.writeln('</td>');
    document.writeln('</tr>');
    document.writeln('<tr valign="top">');
    document.writeln('<td>');
    document.writeln('<a href="javascript:if (form_aid || form_gid || form_hid || form_lid || form_sid) document.buyform.submit();" class="mbuttons"><img class="normalimage" src="images/generics/btn_buynow.gif" border="0"></a><img class="grayimage" src="images/generics/btn_buynowgray.gif" border="0">');
    document.writeln('</td>');
    document.writeln('<td>');
    document.writeln('<img src="images/generics/trans.gif" width="10" height="1">');
    document.writeln('</td>');
    document.writeln('<td>');
    document.writeln('<a href="javascript:if (form_aid || form_gid || form_hid || form_lid || form_sid) document.icoinsform.submit();" class="mbuttons"><img class="normalimage" src="images/generics/btn_useicoins.gif" border="0"></a><img class="grayimage" src="images/generics/btn_useicoinsgray.gif" border="0">');
    document.writeln('</td>');
    document.writeln('</tr>');
    if (eyeblaster) {
      document.writeln('<tr>');
      document.writeln('<td colspan=3 class="upselltext" style="font-size:1.3em; font-weight: bold;">');
      document.writeln('Buy now to enjoy ' + product_name + '<br>without ads or time limits');
      document.writeln('</td>');
      document.writeln('</tr>');
    }
    document.writeln('</table>');
    document.writeln('</td>');
    document.writeln('<td align="center">');
    document.writeln('<a class="normalimage" href="http://www.iwin.com/icoins"><img src="images/generics/icoinsdiscount.jpg" border="0"><br>Click here to learn more</a><span class="grayimage"><img  src="images/generics/icoinsdiscountgray.jpg" border="0"><br>Click here to learn more</a></span>');
    document.writeln('</td>');
    document.writeln('</tr>');
}
