var sconf;
sconf = false;

function Show_helptip(draw,n, ob, xc, yc)
{
        h = document.getElementById("helptip_" + n);
        if (ob != "stay")
        if (ob) {
          p = findPos(ob);
          x = p[0] + p[2];
          y = p[1];
          x = (xc) ? x + xc : x;
          y = (yc) ? y + yc : y;
           //alert(p[0]+" + "+p[2]);
        }
        else {
          x = event.clientX + document.body.scrollLeft;
          y = event.clientY + document.body.scrollTop + 20;
          //y = event.clientY + document.body.scrollTop + 20;
          //alert(document.container.scrollTop);
        }
        h.style.display="block";
        if (ob != "stay")
        {
           //alert("stay");
          h.style.left = x+"px";
          h.style.top = y+"px";
           if (navigator.appName=="Netscape")
           {
             h.style.left = x+"px";
             h.style.top = y+58+"px";
             if (draw!="ver")
             {
                   
                 h.style.top = y-28+"px";
             }
           } 
            
           if (navigator.appVersion.indexOf("MSIE 7.0")>-1&&draw=="ver")
           {
             h.style.top = y+58+"px";
			
           }
        }
      
}
function Hide_helptip(n)
{
        h = document.getElementById("helptip_" + n);
        h.style.display="none";
}
function findPos(obj) {
        var curleft = curtop = curwidth = curheight = 0;
        curwidth = obj.offsetWidth;
        curheight = obj.offsetHeight;
        if (obj.offsetParent) {
                curleft = obj.offsetLeft;
                curtop = obj.offsetTop;
                while (obj = obj.offsetParent) {
                        curleft += obj.offsetLeft;
                        curtop  += obj.offsetTop;
                }
        }

        return [curleft, curtop, curwidth, curheight];
}

window.onbeforeunload = function() {
  if (sconf)
    return "IF YOU MISS THIS LIMITED TIME OFFER YOU WILL KICK YOURSELF\n\nIf you're thinking about waiting to sign up later, don't!  The rates you see today will be going up very soon.  Lock in your rate today to grandfather it in and keep it as long as you want.  Don't miss out!";
}
window.xonunload = function(){
//      "directories=0,height=680,left=50,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,top=50,width=550,titlebar=0"
        var WinSettings = "center:yes;resizable:no;dialogHeight:300px";
        //if (self.screenTop > 9000)
        //window.showModalDialog("static/privacy.html", null, WinSettings);
        if (sconf)
          if (!confirm("IF YOU MISS THIS LIMITED TIME OFFER YOU WILL KICK YOURSELF\n\nIf you're thinking about waiting to sign up later, don't!  The rates you see today will be going up very soon.  Lock in your rate today to grandfather it in and keep it as long as you want.  Don't miss out!"))
          {
            //history.back();
            //location.href = location.href;
            alert("stopping");
            window.stop();
            return false;
          }

        return true;
}

function showconfirm() {
sconf = false;
}

function shake(l, m) {
  /*ob = document.getElementById("rei_course");

  if (l == 0) {
     ob.style.left = '0px';
     setTimeout('shake(6, -1)', 20000);
     return;
  }

  ob.style.left = (m * 3)+'px';

  setTimeout('shake('+(l-1)+', '+(m*(-1))+')', 70);*/
}

function topicaImport()
{
  var em = document.getElementById("topica_email").value;
  var emailPat=/^(.+)@(.+)\.(.+)$/;
  var matchArray=em.match(emailPat);
  if (matchArray==null)
  {
     alert("Please provide a correct email.");
     return;
  }
  if (document.getElementById("topica_zipcode").value == "")
  {
     alert("Please enter your area ZIP code.");
     return;
  }

  var str = '';
  str += document.getElementById("topica_email").value;
  str += "||";
  str += document.getElementById("topica_zipcode").value;

  agent.call("include/topica.php", "ajax_topicaImport", "cb_topicaImport", str);
}
function cb_topicaImport(obj)
{
  alert(obj);
}
