var FBwWidth = 875; var FBwHeight = 500; var FBwBG1 = '0072bc'; var FBwl1 = 'ffffff'; var FBwl2 = '0072bc'; var FBwlc = '000000'; var FBwfont = '4'; var FBwfs = '12'; var FBwth = 'ffffff'; var FBwtc = '000000'; var FBwtz = '-8:00'; var FBwln = 'en'; var FBscroll = '1'; var FBcid = '6CA8CB57'; var refreshrate = 60000*60; //page refresh rate - every hour //the params from the host site var widgetURL1 ="http://fastbrokers.com/widgets/json-calendar.php"; var flagURL = "http://fastbrokers.com/widgets/flags"; var priURL1 = "http://fastbrokers.com/widgets/img"; var bannerURL = "http://fastbrokers.com/widgets/banner_feeder.php?id=2"; var bannerpicURL = "http://fastbrokers.com/widgets/banners/"; var d = new Date(); var session_id = d.getTime(); var url = window.location.href; var day = 0; var FBwdpar =""; FBwFontList = ["Verdana","Arial","Tahoma","Trebuchet MS","Calibri"]; var FBWversion2 = 'v1.0.42 - 7/9/2010'; // takes a hex string and returns the r, g, b values function parseColor(text){ var ot = text; if(ot.length == 3){ t1 = ot.substr(0,1); t2 = ot.substr(1,1); t3 = ot.substr(2,1); ot = t1+t1+t2+t2+t3+t3; // alert("ot = "+ot); text = ot; } // this regular expression checks for a hex color in proper format if(/^\#?[0-9A-F]{6}$/i.test(text)){ return { r: eval('0x'+text.substr(text.length==6?0:1, 2)), g: eval('0x'+text.substr(text.length==6?2:3, 2)), b: eval('0x'+text.substr(text.length==6?4:5, 2)) } } // return {r:255,g:0,b:0}; } function hex(c){ c=parseInt(c).toString(16); return c.length<2?"0"+c:c } function colorAverageOpposite(daColor){ var colorcomponent = parseColor(daColor); daaverage = Math.round((colorcomponent.r+colorcomponent.g+colorcomponent.b)/3); if (daaverage<=128){ return "fff"; } else { return "000"; } } //found in a forum gotta see if it works function FindPos(ctrl) { var pos = {x:0, y:0}; if (ctrl.offsetParent){ while(ctrl) { pos.x += ctrl.offsetLeft; pos.y += ctrl.offsetTop; ctrl = ctrl.offsetParent; } //end while } else if (ctrl.x && ctrl.y) { pos.x += ctrl.x; pos.y += ctrl.y; } //end if return pos; } var myleft = FindPos("FastBrokersFrame");//document.getElementById("FastBrokersCalendar").offsetLeft; //alert("myleft = "+myleft[0]+" "+myleft[1]); /*defines the styleSheets*/ //var mainstyle = var head = document.getElementsByTagName('head')[0], style = document.createElement('style'), rules = document.createTextNode('#FBcalendar {display:block; width:'+ FBwWidth +'px; height:'+ FBwHeight +'px; background: #'+FBwBG1+'; position:relative; text-transform: normal!important; letter-spacing:none!important;}'+'\n' + '#FBcalendarArea {display:block; width:'+ (FBwWidth-4) +'px; height:'+ (FBwHeight-90) +'px; overflow:hidden; font-family:'+FBwFontList[FBwfont]+',sans-serif; position:relative; }'+'\n' + '#FBcalendartop {display:block; width:width:'+FBwWidth+'px; height:63px; background-color:#'+FBwBG1+';}'+'\n' + '#FBcalendarscroll {display:block; position:absolute; width:'+ (FBwWidth-6) +'px; height:'+ (FBwHeight-90) +'px; left:3px;}'+'\n' // + '#FBcalendarbottom {display:block; position:absolute; width:'+FBwWidth+'px; height:20px; top:'+(FBwHeight -20)+'px; font-family:'+FBwFontList[FBwfont]+',sans-serif; font-size:80%; background:#'+FBwBG+'; color:#'+colorAverageOpposite(FBwBG)+';}'+'\n' + '#FBcalendarbottom {display:block; width:'+FBwWidth+'px; height:20px; top:'+(FBwHeight -20)+'px; font-family:'+FBwFontList[FBwfont]+',sans-serif; font-size:80%; background:#'+FBwBG1+'; color:#'+colorAverageOpposite(FBwBG1)+'; z-index:10000;}'+'\n' + '.daycontrols {display:block; float:left; padding: 3px 0 3px 3px; font-family:'+FBwFontList[FBwfont]+'; width:'+ (FBwWidth-6) +'px; height:18px; }'+'\n' + '#ctimestamp{float:left; font-family:calibri,sans-serif; font-size:12px; color: #'+colorAverageOpposite(FBwBG1)+'; }'+'\n' + '#language{float:left; font-family:calibri,sans-serif; font-size:12px; color: #'+colorAverageOpposite(FBwBG1)+'; padding-left:20px; }'+'\n' + '#FBcalendar #FBdisclaimer{display:none; width:'+(FBwWidth-10)+'px; height:120px; position:absolute; top:'+(FBwHeight-150)+'px; left:0 px; margin-left:3px; padding:3px; overflow:none; z-index:3000; background-color: #'+ FBwl2 +'; font-family: calibri,sans-serif; font-size:11px; color:#'+colorAverageOpposite(FBwl2)+'; /*letter-spacing:-1px;*/ filter:alpha(opacity=80); opacity: 0.8; -moz-opacity:0.8;}'+'\n' // + '#FBdisclaimer{display:none; width:'+(FBwWidth-10)+'px; height:120px; position:absolute; top:'+(FBwHeight )+'px; margin-left:3px; padding:3px; overflow:none; z-index:3000; background-color: #'+ FBwl2 +'; font-family: calibri,sans-serif; font-size:11px; color:#'+colorAverageOpposite(FBwl2)+'; /*letter-spacing:-1px;*/ filter:alpha(opacity=80); opacity: 0.8; -moz-opacity:0.8;}'+'\n' + '#calendartable, #headercalendartable {width:100%; font-size:'+FBwfs+'px;}'+'\n' + '#headercalendartable tr.tablehead td{border:none; padding:0 4px 0 4px;}'+'\n' + '#calendartable tr.tablehead td{border:none; padding:0 4px 0 4px;}'+'\n' /* + 'td{border-left: 1px #eaeaea solid; border-bottom: 1px #eaeaea solid; padding:4px; }'+'\n'*/ /* + 'td{border-left: 1px #eaeaea solid; padding:4px; }'+'\n' */ + '#calendartable td{ padding:4px; }'+'\n' + '#headercalendartable td{ padding:4px; }'+'\n' + '#calendartable .line1, #headercalendartable .line1 {background: #'+ FBwl1 +'; color:#'+FBwlc+'; }'+'\n' + '#calendartable .line2, #headercalendartable .line2 {background: #'+FBwl2+'; color:#'+FBwlc+'; }'+'\n' + '#calendartable .line3, #headercalendartable .line3 {margin:0 !important; padding:0 !important; line-height:0px!important;}'+'\n' + '#calendartable .line4, #headercalendartable .line4 {margin:0 !important; padding:0 !important; line-height:14px!important;}'+'\n' + '.format {width:400px; padding:4px; background:#ffc;}'+'\n' /* + 'tr.tablecaption td { background-color:#'+FBwth+'; color:#'+FBwtc+'; border: 1px outset;}'+'\n'*/ + '#calendartable tr.tablecaption td { background-color:#'+FBwth+'; color:#'+FBwtc+'; border-left:none !important;}'+'\n' + '#headercalendartable tr.tablecaption td { background-color:#'+FBwth+'; color:#'+FBwtc+'; border-left:none !important;}'+'\n' + '#tooltip {position: absolute; z-index: 3000; border: 1px solid #111; background-color: #fffacd; padding: 5px; font-size:14px;}'+'\n' + '#tooltip h3, #tooltip div { margin: 0; font-weight:normal;}'+'\n' + '#p_status{float:left; margin-top:20px; color:#f00;}'+'\n' + '.readmore {padding:8px;}'+'\n' + '#daycont {float:right;}'+'\n' + '.moretitle{font-size:120%; font-weight:bold; clear:both; padding-bottom:4px;}'+'\n' + '#bannerarea {display:block; float:left; /*width:'+(FBwWidth-6)+'px;*/ height:35px; background-color:transparent; margin-left:3px;}'+'\n' + 'a#prbut:active, a#prbut:link,a#prbut:visited{display:block; float:left; width:16px; height:16px; background:url(http://fastbrokers.com/images/widget_arrow_left.png) 0 0 no-repeat;text-decoration:none; margin-right:4px;}'+'\n' + 'a#prbut:hover{display:block; width:16px; height:16px; background:url(http://fastbrokers.com/images/widget_arrow_left.png) 0 -16px no-repeat;text-decoration:none; margin-right:4px;}'+'\n' + 'a#nextbut:active, a#nextbut:link,a#nextbut:visited{display:block; float:left; width:16px; height:16px; background:url(http://fastbrokers.com/images/widget_arrow_right.png) 0 0 no-repeat;text-decoration:none; }'+'\n' + 'a#nextbut:hover{display:block; width:16px; height:16px; background:url(http://fastbrokers.com/images/widget_arrow_right.png) 0 -16px no-repeat;text-decoration:none;}'+'\n' + '.FBbottomleftside1{float:left;margin-left:3px; color:#'+colorAverageOpposite(FBwBG1)+'; font-family:calibri,sans-serif; font-size:12px; padding-top:3px;}'+'\n' + '.FBbottomrightside1{float:right; margin-right:3px; color:#'+colorAverageOpposite(FBwBG1)+'; font-family:calibri,sans-serif; font-size:12px; padding-top:3px;}'+'\n' + 'a.FBbottomlink1:active,a.FBbottomlink1:link,a.FBbottomlink1:visited{text-decoration:none; color:#'+colorAverageOpposite(FBwBG1)+';}'+'\n' + 'a.FBbottomlink1:hover{text-decoration:underline; color:#'+colorAverageOpposite(FBwBG1)+';}'+'\n' + 'a.alwaysul,a.alwaysul:active,a.alwaysul:link,a.alwaysul:visited,a.alwaysul:hover{text-decoration:underline;}'+'\n' + '.paddingleft1{padding-left: '+((FBwWidth-306)/2)+'px;}'+'\n' + '.leftside{display:block;width:100px; float:left;}'); style.type = 'text/css'; if(style.styleSheet) style.styleSheet.cssText = rules.nodeValue; else style.appendChild(rules); head.appendChild(style); /*defines the div for the ajax to come out - redone with injectors*/ if(!maindoc){ //alert("here"); var maindoc = document.createElement('div'); maindoc.setAttribute('id','FBcalendar'); //document.getElementsByTagName('body')[0].appendChild(maindoc); document.getElementById('FastBrokersCalendar').appendChild(maindoc); var calendartop = document.createElement('div'); calendartop.setAttribute('id','FBcalendartop'); calendartop.innerHTML = '
' + ''; document.getElementById('FBcalendar').appendChild(calendartop); var calendararea = document.createElement('div'); calendararea.setAttribute('id','FBcalendarArea'); document.getElementById('FBcalendar').appendChild(calendararea); var calendarscroll = document.createElement('div'); calendarscroll.setAttribute('id','FBcalendarscroll'); document.getElementById('FBcalendarArea').appendChild(calendarscroll); var calendarbottom = document.createElement('div'); calendarbottom.setAttribute('id','FBcalendarbottom'); calendarbottom.innerHTML = '
'+response.calendar.terms[0].calendar+" "+response.calendar.timestamp[0];
prevbutid.setAttribute ('title',response.calendar.terms[0].previous);
nextbutid.setAttribute ('title',response.calendar.terms[0].next);
if(response.calendar.data[0] == "There are no Economic indicators released today."){ //if no data for the day
var myinnerHTML = "";
myinnerHTML +='';
myinnerHTML +='
';
} else {
e.style.display = 'block';
a.innerHTML = '
';
} //end if
}
function toggleDisclaimer(id){
var e = document.getElementById(id);
if(e.style.display == 'block') {
e.style.display = 'none';
} else {
e.style.display = 'block';
} //end if
}
var gpy;
var gStopNews1;
//getElementById absstractor from the old common.js
var null_element;
function spsGetElementById(id) {
if (document.getElementById(id)) {
return document.getElementById(id);
} else if (document.all) {
return document.all[id];
} else if (document.layers && document.layers[id]) {
return (document.layers[id]);
} else {
return null_element;
}
}
//an addEventLinsnet abstractor from the old common.js
function yAddEventListener(es,eventType,eventListener,useCapture) {
var e1;
if(!(e1=spsGetElementById(es))) return;
eventType=eventType.toLowerCase();
var eh="e1.on"+eventType+"=eventListener";
if(e1.addEventListener) e1.addEventListener(eventType,eventListener,useCapture);
else if(e1.attachEvent) e1.attachEvent("on"+eventType,eventListener);
else if(e.captureEvents) {
if(useCapture||(eventType.indexOf('mousemove')!=-1)) { e1.captureEvents(eval("Event."+eventType.toUpperCase())); }
eval(eh);
}
else eval(eh);
}
function AutoScrollNewsDown1() {
var t,u, eh;
if(gStopNews1) {
return;
}
t= document.getElementById('FBcalendarscroll');
u = document.getElementById('calendartable');
eh = u.offsetHeight;
ewh = -(eh - (parseInt(FBwHeight)-130));
// if(eh+gpy<=ewh) return;
if(eh+gpy<0) gpy=0;
gpy-=2;
t.style.top=gpy+'px';
}
function AutoScrollNewsStop1() {
gStopNews1=true;
}
function AutoScrollNewsStart1() {
gStopNews1=false;
}
function LoadNewsScrollers1(){
var t,u, eh;
gpy=0;
t= document.getElementById('FBcalendarscroll');
u = document.getElementById('calendartable');
eh = u.offsetHeight;
// alert('eh='+eh);
ewh = -(eh - (parseInt(FBwHeight)-130));
// alert('ewh= '+ewh+' - eh ='+eh+' FBwHeight = '+FBwHeight);
if(eh