// JavaScript Document

if (fact_desc[0]=="") f_desc = new Array();
MaxItems=3;  // This line may be taken out of this file

if (imp_count>0) {
	document.writeln('<div id="i_notices"><h3>Notices</h3>');
	for (i=0;i<imp_count;i++) {
		if ( open_new_imp[i]==1) mod = ' target="_blank"';
		else mod = ''; // '<a href="'+f_href[i]+'"'+mod+'>'+f_desc[i]+'</a>'
		document.writeln(f_desc[i]);
	}

	document.writeln('</div>');
	MaxItems=0;
}

if (fact_desc.length>0 && MaxItems>0) {
	document.writeln('<div id="factTitle"');
	if (imp_count>0) {
		document.write(' style="display:block; position: relative; float: right; padding:0; margin-right: 240px"');
	}
	document.write('>SFU Facts</div>');

	ic = fact_desc.length;
	choices = new Array(ic);
	for (ii=0;ii<ic;ii++) choices[ii]=true;
	
	if (typeof(MAX_Facts)!='undefined') MaxItems = MAX_Facts;
	
	if (ic>MaxItems) toLoop=MaxItems;
	else toLoop=ic;
	for (;toLoop>0;toLoop--) {
	
		newsItem = pickRandom(ic);
		ic--;
		ptr=-1;
		jj=-1;
		do {
			ptr++;
			while ( choices[ptr]==false ) {ptr++;}  // find the available article
			jj++;
		} while (jj<newsItem);
		choices[ptr] = false;
		document.writeln('<a href="'+fact_href[ptr]+'" class="fact">');
		tmp = fact_desc[ptr].replace("'","&quot;");
		tmp = tmp.replace( "’","&quot;" );
		tmp = tmp.replace( '—','-' );
		document.writeln(tmp);
		document.writeln('</a>');
	}
}
document.writeln('<div id="forcebottom"></div>');

