// text_links.js - Copyright 2005-2011 (C) Otto de Voogd
// This script is for rotating linkads
// Text maximum 28 characters text

var lt=unescape("%3C")
var gt=unescape("%3E")
var qt=unescape("%22")

var url;
var text;
var title;
var classname;

// function to write a text link
// if self = top this means that we are in the popup countdown clock
// otherwise we must be in the frame of a window.

function write_link (url,text,title,classname) {
	document.write(lt + 'a href="' + url + '"');
	document.write(' onClick="return(openLink(this));"');
	document.write(' title="'+title+'"'+gt+lt+'span class="LinkA"'+gt);
	document.write(text+lt+'/span'+gt+lt+'/a'+gt);
	var elem=document.getElementById('TextLink');
	elem.className=classname;
	return true;
}

// Get Firefox

function link_firefox1 () {
	url="http://www.mozilla.com/firefox?from=sfx&amp;uid=89185&amp;t=305";
	text='Get Firefox 4!';
	title='Download Firefox - Take back the web!';
	classname='TextLink_Fx';
	return true;
}

function link_firefox2 () {
	url="http://www.mozilla.com/firefox?from=sfx&amp;uid=89185&amp;t=305";
	text='Get Firefox 4!';
	title='Safer, Faster, Better - Download Firefox!';
	classname='TextLink_Fx';
	return true;
}

function link_firefox3 () {
	url="http://www.mozilla.com/firefox?from=sfx&amp;uid=89185&amp;t=305";
	text='Get Firefox 4!';
	title='Download Firefox - The browser you can trust!';
	classname='TextLink_Fx';
	return true;
}

// Fire up the Fox

// function link_futf () {
//	url='http://www.fireupthefox.com/?id=89185';
//	text='Fire up the Fox!';
//	title='Resources to get more out of your browser!';
//	classname='TextLink_Fx';
//	return true;
//}

// Foxysearch.org

function link_foxy () {
	url='http://www.foxysearch.org/';
	text='Foxysearch.org';
	title='Search Mozilla and Firefox sites';
	classname='TextLink_Fy';
	return true;
}

// Firefox Shortcuts

function link_fxshortcuts () {
	url='http://www.7is7.com/software/firefox/shortcuts.html';
	text='Firefox Shortcuts';
	title='A comprehensive list of shortcuts';
	classname='TextLink_Fx';
	return true;
}

// Join Spread Firefox

// function link_sfx () {
//	url='http://www.spreadfirefox.com/?q=user/register&amp;r=89185';
//	text='Join Spread Firefox';
//	title='Join the Firefox marketing community!';
//	classname='TextLink_Fx';
//	return true;
//}

// Vodo movie promo

function link_movie () {
	// url='http://vodo.net/sintel?referer=ottodv';
	url='http://vo.do/iw56';
	text='Pioneer One';
	title='Download the latest episoda about the man from Mars!';
	classname='TextLink_St';
	return true;
}

// My Persona

function link_mypersona () {
	// url='https://www.getpersonas.com/en-US/persona/309631';
	url='http://ottodv.com/personas/';
	text='Dress up Firefox';
	title='Get a persona for Firefox!';
	classname='TextLink_MP';
	return true;
}

// Join Spread Open Source

// function link_sos () {
//	url='http://www.spreadopensource.com/';
//	text='SpreadOpenSource';
//	title='Help Spread Open Source!';
//	classname='TextLink_So';
//	return true;
//}

// Mozhunt

//function link_mozhunt () {
//	url="http://www.mozhunt.com/";
//	text="Join the MozHunt!";
//	title="Find the lost pandas!!";
//	classname='TextLink_MH';
//}

// Get Thunderbird

function link_thunderbird1 () {
	url="http://www.spreadthunderbird.com/aff/142/1";
	text="Get Thunderbird!";
	title="Reclaim your inbox - Download Thunderbird!";
	classname='TextLink_Tb';
}

// Get LibreOffice

function link_lo1 () {
	url="http://www.documentfoundation.org/";
	text="Get LibreOffice";
	title="Free your data!";
	classname='TextLink_LO';
	return true;
}

// Select what to show

var now = new Date();

rest = (Math.floor(now.getTime()/100) % 10) + 1;

var ua = navigator.userAgent.toLowerCase();
if (
	0<=ua.indexOf('msie') &&
	0>ua.indexOf('opera')
) {
	if      (1>=rest) { link_firefox1(); }
	else if (3>=rest) { link_firefox2(); }
	else if (4>=rest) { link_firefox3(); }
	else if (5>=rest) { link_movie(); }
	else if (6>=rest) { link_foxy(); }
	else if (8>=rest) { link_thunderbird1(); }
	else              { link_lo1(); }
} else if (
	0<=ua.indexOf('firefox') ||
	0<=ua.indexOf('bonecho') ||
	0<=ua.indexOf('minefield') ||
	0<=ua.indexOf('granparadiso') ||
	0<=ua.indexOf('shiretoko') ||
	0<=ua.indexOf('namoroka')
) {
	if      (3>=rest) { link_foxy(); }
	else if (4>=rest) { link_fxshortcuts(); }
	else if (5>=rest) { link_mypersona(); }
	else if (6>=rest) { link_movie(); }
	else if (8>=rest) { link_thunderbird1(); }
	else              { link_lo1(); }
} else {
	if      (2>=rest) { link_foxy(); }
	else if (3>=rest) { link_firefox1(); }
	else if (4>=rest) { link_firefox2(); }
	else if (5>=rest) { link_movie(); }
	else if (8>=rest) { link_thunderbird1(); }
	else              { link_lo1(); }
}
write_link(url,text,title,classname);

// TIAF!

