var expdate = new Date ();
expdate.setTime (expdate.getTime()+(5*365*24*60*60*1000));

var cm=null;
var game=null;
document.onclick = new Function("showldcmenu(null)")
function getldcPos(el,sProp) {
 var iPos = 0
 while (el!=null) {
  iPos+=el["offset" + sProp]
  el = el.offsetParent
 }
 return iPos

}
function showldcmenu(el,m) {
 if (m) {
  m.style.display='';
  m.style.pixelLeft = getldcPos(el,"Left")+20;
  m.style.pixelTop = getldcPos(el,"Top")+el.offsetHeight;
 }
 if ((m!=cm) && (cm)) cm.style.display='none'
 cm=m
}
function setCookie(name, value, expires, path)
{
 var thisCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "");
 document.cookie = thisCookie;
}
function getCookieVal (offset) {
 var endstr = document.cookie.indexOf (";", offset);
 if (endstr == -1) {
    endstr = document.cookie.length;
 }
 return unescape(document.cookie.substring(offset, endstr));
}
function getCookie (name) {
 var arg = name + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen)
 {
  var j = i + alen;
  if (document.cookie.substring(i, j) == arg) {
   return getCookieVal (j);
  }
  i = document.cookie.indexOf(" ", i) + 1;
  if (i == 0) break;
 }
 return null;
}
function delCookie (name,path)
{
 document.cookie = name + "=" + ((path) ? "; path=" + path : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
function ShowResultsOf(result_of_state)
{
 setCookie("result_of_state", result_of_state, expdate, "");
 location=document.location;
}
function ShowLotteryResults(fmt_id)
{
 var state = getCookie("result_of_state");
 if (!state||state=='null') return;
 document.write("<script Language=JAVASCRIPT src='http://www.lottofactor.com/feed/"+fmt_id +"/"+state+".js'></script>");
 document.write("<script Language=JAVASCRIPT src='http://www.lottofactor.com/jackpot/"+state+".js'></script>");
}
function open_page (fn)
{
 window.open(fn,'','width=800,height=600,resizable=yes,scrollbars=yes');
}
function GetComponent(blankpage, comp1, comp2)
{
 if (blankpage) {
  return comp1;
 } else {
  return comp2;
 }
}
function PopulateLink(popup, pagelink)
{
 if (popup) {
  open_page (pagelink);
 } else {
  location = pagelink;
 }
}
function ShowCurrUSJackpotsReq(auth_id,fmt_id,popup,blankpage,order)
{
 var loc="http://www.lottofactor.com/script/"+GetComponent(blankpage,"blank_current_jackpot/","current_jackpot/")+order;
 PopulateLink(popup, loc);
}
function ShowPastResultsReq(auth_id,fmt_id,popup,blankpage,game)
{
 var loc="http://www.lottofactor.com/script/"+GetComponent(blankpage,"blank_win_of_past_month","winning_of_past_month")+"/100/"+game;
 PopulateLink(popup, loc);
}
function ShowFreqChartReq(auth_id,fmt_id,popup,blankpage,game)
{
 var loc="http://www.lottofactor.com/script/"+GetComponent(blankpage,"blank_lev3_hitfreq","lev3_hitfreq")+"?src=1&draws=50&game="+game;
 PopulateLink(popup, loc);
}
function ShowSmartPickReq(auth_id,fmt_id,popup,blankpage,game)
{
 var loc="http://www.lottofactor.com/script/"+GetComponent(blankpage,"blank_smart_pick1","smart_pick1_generate_combs")+"?game="+game;
 PopulateLink(popup, loc);
}
function ShowHaveIWonReq(auth_id,fmt_id,popup,blankpage,game)
{
 var loc="http://www.lottofactor.com/script/"+GetComponent(blankpage,"blank_haveiwon","matchfinder2_edit")+"?game="+game;
 PopulateLink(popup, loc);
}
function ShowOddsCalculateReq(auth_id,fmt_id,popup,blankpage,game)
{
 var loc="http://www.lottofactor.com/script/"+GetComponent(blankpage,"blank_odds_calculate","odds_calculate")+"?game="+game;
 PopulateLink(popup, loc);
}
function ShowJackpotHistReq(auth_id,fmt_id,popup,blankpage,game)
{
 var loc="http://www.lottofactor.com/script/"+GetComponent(blankpage,"blank_jackpot_hist","jackpot_history")+"/draw_date/"+game;
 PopulateLink(popup, loc);
}
function ShowSearchReq(auth_id,fmt_id,popup,blankpage,state)
{
 var loc="http://www.lottofactor.com/script/"+GetComponent(blankpage,"blank_winning_select_state","winning_select_state")+"/200/"+state;
 PopulateLink(popup, loc);
}
function SetupResultsOf(state)
{
 setCookie("result_of_state", state, expdate, "");
 window.close();
}
function TurnOffResults ()
{
 delCookie("result_of_state", "");
 window.close();
}
function SetFormat (thefmt)
{
 var fmtdate = new Date ();
 fmtdate.setTime (fmtdate.getTime()+(120*24*60*60*1000));
 setCookie("thefmt", thefmt, fmtdate, "/");
 location=document.location;
}
