/*****************************************
global js for EA.com
code by Arch (arch(AT)blastradius.com)
modified by Allan (allan.chang(AT)blastradius.com)
*****************************************/
/*************************************
XML Wait
*************************************/
function doWait(feedType) {
var pInfoBlock = getElm(feedType);
if(!pInfoBlock)
return;
var waitHTML = "
Loading...
"
writeHTML(pInfoBlock,waitHTML);
}
/*************************************
Global Pagination Variables
*************************************/
var pagecount = 1;
var currentPage = 1;
/*************************************
Pagination
*************************************/
function showPagecount(targetID) {
var count = 1;
var HtmlBlock = ' ';
while (document.getElementById(targetID + '-page-' + count)) {
if (count == currentPage) {
HtmlBlock += '' + count + ' ';
} else {
HtmlBlock += '' + count + ' ';
}
count++;
}
document.getElementById(targetID + "-count").innerHTML = HtmlBlock;
}
function page_flip(dir, targetID) {
if (currentPage + dir >= 1 && currentPage + dir < pagecount) {
document.getElementById(targetID + "-page-" + currentPage).style.display = "none";
currentPage += dir;
document.getElementById(targetID + "-page-" + currentPage).style.display = "block";
showPagecount(targetID);
}
}
/*
syndicators
*/
// new syndicator('Del.icio.us','http://deliciousicon',function(title,url){return "http://therighturl"})
function syndicator(name,img,post_url)
{
this.name = name;
this.img = img;
this.post_url = post_url;
this.button = function(){
document.write('
');
};
this.click = function(title,url,link){
var confirmStatus = confirm("You are about to leave Electronic Arts' website and go to a website owned by a third party.\n\nElectronic Arts is not responsible for content on third party sites,\nand our privacy policy does not apply to their information collection practices.\n\nPress OK to access the linked site or press CANCEL to return to your original page.");
if(confirmStatus == false) {
return false;
}
var doit = true;
/* TEST / DEVELOPER BEWARE!!
var confirms = new Array("ARE YOU SURE YOU WANT TO POST A LINK TO THIS DOMAIN: "+THE_DOMAIN,"TITLE: "+title+"\nURL: "+THE_DOMAIN+url+"\n\n ARE YOU CERTAIN?");
doit = ((THE_DOMAIN == "http://ea.com/") ? true : confirm(confirms.shift()) && confirm(confirms.shift()));
*/
if (doit)
{
openCenteredOnOpenerWindow(this.post_url(title,url), "Syndication",640,640);
}
else
{
alert("I WON'T...\nopen, in a little window:\n"+this.post_url(title,url));
}
return false;
};
}
var Delicious = new syndicator("Del.icio.us","http://images.ea.com/ea/_img/buttons/delicious.gif",function(title,url){
return 'http://del.icio.us/post?v=4;url='+encodeURIComponent(THE_DOMAIN+url)+';title='+encodeURIComponent(title.replace(/^\s*|\s*$/g,''))
});
var Facebook = new syndicator("Facebook","http://images.ea.com/ea/_img/buttons/fb.gif",function(title,url){
// it wants to window.open(post_url,'sharer','toolbar=0,status=0,width=626,height=436');
return 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(THE_DOMAIN+url)+'&t='+encodeURIComponent(title)
});
var Digg = new syndicator("Digg","http://images.ea.com/ea/_img/buttons/digg.gif",function(title,url){
return 'http://digg.com/submit?phase=3&url='+encodeURIComponent(THE_DOMAIN+url)+'&title='+encodeURIComponent(title);
});
/*
text filters
*/
var THE_DOMAIN;
document.onload = function() {
THE_DOMAIN = document.getElementById("the_domain").href;
};
var MONTH_ABBREVIATIONS = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec');
var ABBREV_TO_DATE = new Array();
var mi = 0;
for (mi in MONTH_ABBREVIATIONS)
{
ABBREV_TO_DATE[MONTH_ABBREVIATIONS[mi]] = parseInt(mi)+1;
}
// i assume this is a situation where we have a string like ##.Mmm..## where Mmm. is like... Nov. or Jan. or Abc.
function names_to_numbers(string)
{
var parts = string.split(/\.+/); // split on at least one period
var date = parts.shift();
var month = parts.shift();
var year = parts.shift();
var digit_date = (date.match(/^\d$/) ? "0"+date : date);
var digit_month = (ABBREV_TO_DATE[month] < 10 ? "0"+ABBREV_TO_DATE[month] : ABBREV_TO_DATE[month]);
var digit_year = (year.match(/\d\d(\d\d)/))[1];
return digit_month+"."+digit_date+"."+digit_year;
}
function text_to_img(base_font_images_path,string,extension,translator)
{
var dictionary_ka = !!(translator);
var characters = string.split('');
var imgs = new Array();
span = document.createElement("span");
var path_parts = base_font_images_path.split(/[^\w\d]+/g);
path_parts.pop();
var font_size = path_parts.pop();
var font_fam = path_parts.pop();
span.className=font_fam+"-"+font_size;
while(c = characters.shift())
{
var img = document.createElement("img");
if (dictionary_ka)
{
if (!translator[c])
{
continue;
}
img.src=base_font_images_path + translator[c] + extension;
img.alt=c;
}
else
{
img.src=base_font_images_path + c + extension;
}
span.appendChild(img);
}
return span;
}
function swap_text_for_img(element_id,base_font_images_path,extension,options)
{
// default: only numbers and periods.
if (!options)
{
options = {};
}
if (!options || !options.translator)
{
var translator = new Array();
translator['1'] = '1';
translator['2'] = '2';
translator['3'] = '3';
translator['4'] = '4';
translator['5'] = '5';
translator['6'] = '6';
translator['7'] = '7';
translator['8'] = '8';
translator['9'] = '9';
translator['0'] = '0';
translator['.'] = 'dot';
options.translator = translator;
}
if (!options || !options.pre_split_filter)
{
options.pre_split_filter = function(string){return names_to_numbers(string);};
}
var el = document.getElementById(element_id)
var children = el.childNodes;
el.className = el.className+" replacement-imgs";
for(i=0;i