// Email to Paypal Function. START

function ajax_email_paypal()
{
  var email = document.getElementById("sender_email").value;
  var first = document.getElementById("rec_first").value;
  var last = document.getElementById("rec_last").value;
  var address = document.getElementById("rec_address").value;
  var city = document.getElementById("rec_city").value;
  var state = document.getElementById("rec_state").value;
  var zip = document.getElementById("rec_zip").value;
  var amount = document.getElementById("amount").value;
  var message = document.getElementById("rec_message").value;
  var business = document.getElementById("business").value;
  var xmlhttp=false;
  try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (E) {
    xmlhttp = false;
   }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  var url="pagecode.php?giftcard=1&sender_email="+email+"&rec_first="+first+"&rec_last="+last+"&rec_address="+address+"&rec_city="+city+"&rec_state="+state+"&rec_zip="+zip+"&amount="+amount+"&rec_message="+message+"&business="+business;
  xmlhttp.open("GET",url,true);
  xmlhttp.onreadystatechange = function()
  {
    if(xmlhttp.readyState == 4)
    {
		document.getElementById("giftcard").submit();
    }
  }
  xmlhttp.send(null);
}

// Email to Paypal Function. END

function showmyinfo()
{
  document.getElementById('time').style.setAttribute("width","900px");
  document.getElementById('time').style.setAttribute("height","43px");
  document.getElementById('time').style.setAttribute("backgroundColor","#1770AD");
  if(loggedin==1)
  {
    var loggedinmsg="You are logged in";
  }
  else
  {
    var loggedinmsg="You are not logged in.";
  }
  var myinfo="<table cellspacing=0 cellpadding=0 width=100%><tr><td width=140 valign=top><a href='javascript:hidemyinfo();'><img border=0 src=images/myinfo.gif></img></a><br>"+speedinfo+"</td><td valign=top><table cellspacing=0 cellpadding=0 width=100% border=1 bordercolor=#FFFFFF><tr><td align=left><font size=2>IP:"+ip+"<br>Speed:"+kbs+"kbs</font></td><td>"+loggedinmsg+"</td></tr></table></td></tr></table>";
  document.getElementById('time').setAttribute("innerHTML",myinfo);
}
function hidemyinfo()
{
  document.getElementById('time').style.setAttribute("width","300px");
  document.getElementById('time').style.setAttribute("height","20px");
  document.getElementById('time').style.setAttribute("backgroundColor","");
  document.getElementById('time').setAttribute("innerHTML","<table cellspacing=0 cellpadding=0 width=100%><tr><td valign=top width=140><a href='javascript:showmyinfo();'><img border=0 src=images/myinfo.gif></img></a><br>"+speedinfo+"</td><td valign=top></td></tr></table>");

}

function linkclick(url,name)
{
  ajax_url='functions.inc.php?ajax_link_hit=1&url='+url+'&name='+name;
  globalurl=url;
  var xmlhttp=false;
  try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
   } catch (E) {
    xmlhttp = false;
   }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  xmlhttp.open("GET",ajax_url,true);
  xmlhttp.onreadystatechange = function() {
	if(xmlhttp.readyState == 4){
         // document.getElementById("debug").setAttribute("innerHTML",xmlhttp.responseText);
         document.location.href=globalurl;
       }
 }
  xmlhttp.send(null);
}

function scroll()
{
 //alert("scroll event detected! "+window.pageXOffset+" "+window.pageYOffset+" "+document.documentElement.scrollTop+" "+document.documentElement.scrollLeft+" "+document.body.scrollHeight+" "+document.body.scrollWidth+" "+document.body.clientHeight+" "+document.body.clientWidth);
 
 if(document.documentElement.scrollTop>233)
 {
   if(browser=="ie")
   {
     //document.getElementById("backtotop").style.setAttribute("top",(0));
     document.getElementById("backtotop").style.setAttribute("display","");
   }
   else
   {
     //document.getElementById("backtotop").style.setProperty("top",(0)+"px",null);
     document.getElementById("backtotop").style.setProperty("display","",null);
   }
 }
 else
 {
   if(browser=="ie")
   {
     //document.getElementById("backtotop").style.setAttribute("top",(0));
     document.getElementById("backtotop").style.setAttribute("display","none");
   }
   else
   {
     //document.getElementById("backtotop").style.setProperty("top",(0)+"px",null);
     document.getElementById("backtotop").style.setProperty("display","none",null);
   }
 }
 // note: you can use window.innerWidth and window.innerHeight to access the width and height of the viewing area
}
