$(document).ready(function() {

  /* Add LMS Admin link to users */
  $('#user-admin-account tr, #advuser-admin-account tr').each(function() {
    var user = $(this).children(':first').next().text();
    var roles = $(this).children(':first').next().next().next().text();
    if(roles.indexOf('parent') != -1)
    {
      /* Parent */
      $(this).children(':first').next().append("<br/><span style=\"font-size: 10px\">[<a target='_blank' href='/lmsadmin?u=" + user + "'>LMS-CR</a> <a target='_blank' href='/lmsadmin?parent=1&u=" + user + "'>LMS-DC</a>]</span>");
    }
    else
    {
      /* Student */
      $(this).children(':first').next().append("<br/><span style=\"font-size: 10px\">[<a target='_blank' href='/lmsadmin?u=" + user + "'>LMS</a>]</span>");
    }
  });

  /* Add Thawte seal */
  $('#edit-panes-payment-payment-method-credit-wrapper').append("<div style=\"float: right;margin-top: -30px;\"><img id=\"trustwaveSealImage\" src=\"https://sealserver.trustwave.com/seal_image.php?customerId=&size=105x54&style=normal\" border=\"0\" style=\"cursor:pointer;\" onclick=\"javascript:window.open('https://sealserver.trustwave.com/cert.php?customerId=&size=105x54&style=normal&baseURL=www.streetsmarts101.com', 'c_TW', 'location=no, toolbar=no, resizable=yes, scrollbars=yes, directories=no, status=no, width=615, height=720'); return false;\" oncontextmenu=\"javascript:alert('Copying Prohibited by Law - Trusted Commerce is a Service Mark of TrustWave Holdings, Inc.'); return false;\" alt=\"This site protected by Trustwave's Trusted Commerce program\" title=\"This site protected by Trustwave's Trusted Commerce program\" /></div>");

  $('#edit-panes-payment-payment-method-credit-wrapper').append("<div style=\"float: right; margin-top: -35px;margin-right: 15px;\"><div class=\"AuthorizeNetSeal\"><a target=\"_blank\" onclick=\"window.open('//verify.authorize.net/anetseal/?pid=a17002db-d28d-47e8-bccb-2f847783d39a&rurl=http%3A//www.streetsmarts101.com/test.html','AuthorizeNetVerification','width=600,height=430,dependent=yes,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,status=no,directories=no,location=yes'); return false;\" onmouseout=\"window.status=''; return true;\" onmouseover=\"window.status='http://www.authorize.net/'; return true;\" href=\"//verify.authorize.net/anetseal/?pid=a17002db-d28d-47e8-bccb-2f847783d39a&rurl=http%3A//www.streetsmarts101.com/test.html\"><img height=\"72\" border=\"0\" width=\"90\" alt=\"Authorize.Net Merchant - Click to Verify\" src=\"//verify.authorize.net/anetseal/images/secure90x72.gif\"/></a></div></div>");

  $('.speedtest').bind('click',function(e){popwindow(e)});

  /* Set some links to open in a new window */
  $('li.menu-280 a').attr({'target': '_blank'});
  $('li.menu-281 a').attr({'target': '_blank'});
  $('li.menu-282 a').attr({'target': '_blank'});
  $('li.menu-283 a').attr({'target': '_blank'});


  /* Remove the hyperlink from FAQ questions */
  $('div.faq-question a').removeAttr('href');
  $('div.faq-question a').css('text-decoration','none');
  $('.faq_back_to_top').css('color','#006191');



});

function refreshWhenClosed(winObject)
{
	if (winObject.closed) {
		document.location = document.location;
	}
	else {
		var refresh = function() { refreshWhenClosed(winObject); };
		setTimeout(refresh, 500);
	}
}

function popwindow(e){
  e.preventDefault();
  var href=$(e.target).attr('href').split("?");
  var dim = href[1].split("x");
  href = href[0];
  window.open(href,'','menubar=0,location=0,toolbar=0,width=' + dim[0] + ',height=' + dim[1]);
};

