jQuery('#admStories a').click(function(){ lt('Top Stories Module'); return true; });
jQuery('#admProd a').click(function(){ lt('Product Info Module'); return true; });
jQuery('#admBlogs a').click(function(){ lt('Blogs Module'); return true; });
jQuery('#admNews a').click(function(){ lt('In the News Module'); return gta(this); });
jQuery('#admResources a').click(function(){ lt('Resources Module'); return true; });

var ADHOST = '';
var schlta = readCookie('schlta');

if (schlta == null || parseInt(schlta) < 1) {
	var h = location.host;
	if (h.indexOf('comdev2') > -1 || h.indexOf('teacherdev') > -1) { ADHOST = 'http://devweb01.scholastic.net'; }
	else if (h.indexOf('comqual2') > -1 || h.indexOf('teacherqual') > -1) { ADHOST = 'http://contentqa.scholastic.com'; }
	else { ADHOST = 'http://www2.scholastic.com'; }
	transitionalAd();
}

function lt(m) {
	var s = s_gi(s_account);
	var module = 'AdministratorsHome:' + m;
	s.linkTrackVars='server';
	s.server='Administrators';	
	s.tl(true,'o',module);
}
function gta(l) {
	if (schlta == null || parseInt(schlta) < 1) {
		createCookie('schlta', schlta == null ? 1 : schlta = parseInt(schlta) + 1);
		location.href = ADHOST + "/content/ads/transitional.html?url=" + encodeURIComponent(l.href);
		return false;
	}
	else 
		return true;
}
function transitionalAd() {		
	if ( !document.getElementById('schlPageContent') ) return;
	jQuery('#schlPageContent a').click(function(){
		if (/article.jsp|lessonplan.jsp|unitplan.jsp|collection.jsp/.test(this.href)) {
			createCookie('schlta', schlta == null ? 1 : schlta = parseInt(schlta) + 1);
			location.href = ADHOST + "/content/ads/transitional.html?url=" + encodeURIComponent(this.href);
			return false;
		}
	});	
}

/*
	newsletter sign up widget
*/
function aCLS(which) {
	if(which.value == which.defaultValue) { which.value = ''; }
	else if (which.value == ''){ which.value = which.defaultValue; }
}
function chkAdminSignUp(frm) {
	if( frm.PAGE_CODES.value == '' ) {
		if(jQuery('#suError').length > 0) {
			jQuery('#suError').html('You must select a role.');
		}
		else { jQuery('<p class="error" id="suError">You must select a role.</p>').prependTo('#nlFRM'); }
		return false;
	}
}