var FBwWidth = 740; var FBwHeight = 350; var FBwBG1 = '0072bc'; var FBwl1 = 'ffffff'; var FBwl2 = '0072bc'; var FBwlc = '000000'; var FBwfont = '0'; var FBwfs = '12'; var FBwth = 'ffffff'; var FBwtc = '000000'; var FBwtz = '01:00'; var FBwln = 'ita'; var FBscroll = '1'; var FBcid = '87d19fdb'; 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 = '
' + '
' /**/ + '
Language: en' + ' ita' + ' sp' + ' ch' + '
' + '

' + '
'; 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 = '
Powered by FastBrokers.com
' + '
Disclaimer | Free Widgets
'; document.getElementById('FBcalendar').appendChild(calendarbottom); var disclaimer = document.createElement('div'); disclaimer.setAttribute('id','FBdisclaimer'); disclaimer.setAttribute('style','display:none;'); disclaimer.innerHTML = 'Disclaimer:
' + 'FastBrokers' widgets are provided for information purposes only and under no circumstances should be regarded neither as an investment advice nor as a solicitation or an offer to sell/buy any financial product. FastBrokers assumes no responsibility or liability from gains or losses incurred by the information herein contained. Live quotes are delayed.
' + 'Risk Disclosure:
' + 'There is a substantial risk of loss in trading futures and foreign exchange. Please carefully review all risk disclosure documents before opening an account as these financial instruments are not appropriate for all investors.'; document.getElementById('FBcalendarbottom').appendChild(disclaimer); //lets try to include the cufon and font } var params = "?timezone="+FBwtz+"&lang="+FBwln+FBwdpar; var myurl = widgetURL1+params; var lastMessage = 0; var mTimer; var scrme1; //initialize the widget now addScript(myurl); //initialize banner addBannerScript(bannerURL); function parsePrevDay(){ clearInterval(scrme1); day -=1; FBwdpar = "&d="+day; params = "?timezone="+FBwtz+"&lang="+FBwln+FBwdpar; myurl1 = widgetURL1+params; refreshScript(myurl1); } function parseNextDay(){ clearInterval(scrme1); day +=1; FBwdpar = "&d="+day; params = "?timezone="+FBwtz+"&lang="+FBwln+FBwdpar; myurl1 = widgetURL1+params; refreshScript(myurl1); } function changelanguage(dalang){ FBwln = dalang; FBwdpar = "&d="+day; params = "?timezone="+FBwtz+"&lang="+FBwln+FBwdpar; myurl1 = widgetURL1+params; refreshScript(myurl1); } function addScript(myurl) { // alert("script invoked"); clearInterval(scrme1); var script = document.createElement('script'); script.setAttribute('id','Bparameter'); script.src = myurl; document.getElementsByTagName('head')[0].appendChild(script); document.getElementById('FBcalendarscroll').style.top = 0+'px'; // document.body.appendChild(script); // tellStatus("Loading..."); } function refreshScript(myurl){ clearInterval(scrme1); var script = document.getElementById('Bparameter'); if (script) { document.getElementsByTagName('head')[0].removeChild(script); // document.body.removeChild(script); } addScript(myurl); } //banner load script function addBannerScript(myurl) { // alert("script invoked"); // clearInterval(scrme); var bannerscript = document.createElement('script'); bannerscript.setAttribute('id','bannerdata'); bannerscript.src = myurl; document.getElementsByTagName('head')[0].appendChild(bannerscript); // document.getElementById('FBcalendarscroll').style.top = 0+'px'; // document.body.appendChild(script); // tellStatus("Loading..."); } //banner feeded script function jsonbanner2(myresponse){ var bannerres = myresponse; // alert('here'); // var paddingleft = 'padding-left:'+((FBwWidth-306)/2)+'px;'; var banner_div = document.getElementById('bannerarea'); if(bannerres.banner.data[0].isflash=='1'){ var blink2 = document.createElement('div'); // blink.innerHTML = ''+bannerres.banner.data[0].alttext+''; blink2.innerHTML = '' + '' + '' + '' + ''; banner_div.appendChild(blink2); } else { var blink2 = document.createElement('a'); blink2.setAttribute('href',bannerres.banner.data[0].link+'?'+FBcid); blink2.setAttribute('target','_blank'); // blink.cssText = paddingleft; // blink.setAttribute('class','paddingleft'); blink2.innerHTML = ''+bannerres.banner.data[0].alttext+''; banner_div.appendChild(blink2); } } function tellStatus(msg){ var t = document.getElementById("p_status"); t.innerHTML = msg; } function jsoncalendar(daresponse){ clearInterval(scrme1); var response = daresponse; var calendar_div = document.getElementById('FBcalendarscroll'); //indicates where to write the table var headline_div = document.getElementById('FBcalendartop'); //indicates where to write the table var titleline_div = document.getElementById('ctimestamp'); //indicates where to write the table var prevbutid = document.getElementById('prbut'); var nextbutid = document.getElementById('nextbut'); //set values for vars before to populate it titleline_div.innerHTML =" "; prevbutid.innerHTML =" "; nextbutid.innerHTML =" "; //set headers and buttons in language titleline_div.innerHTML = 'More '+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 +=''+response.calendar.data[0]+''; myinnerHTML +=''; calendar_div.innerHTML = ''+myinnerHTML+'
'; mTimer = setTimeout('refreshScript(myurl);',refreshrate); //Refresh content every given interval } else { // alert("hi there"); // var response = eval("(" + myresponse + ")"); var myinnerHTML = ""; myinnerHTML +=''; //the single pixel row adjuster for(i=0; i'; myinnerHTML += ''+response.calendar.header[2]+''; myinnerHTML += ''; myinnerHTML += ''+response.calendar.header[4]+''; myinnerHTML += ''+response.calendar.header[5]+''; myinnerHTML += ''+response.calendar.header[6]+''; myinnerHTML += ''+response.calendar.header[7]+''; myinnerHTML +=''; //the table body and datas myinnerHTML +=''; for(i=0;i < response.calendar.data.length; i++) { myinnerHTML +=''; myinnerHTML +=''+response.calendar.data[i].currency+''; myinnerHTML +=''+response.calendar.data[i].time.substr()+''; myinnerHTML +=''+response.calendar.data[i].report+'
'+response.calendar.data[i].impact.replace('; // myinnerHTML +=''+response.calendar.data[i].impact.replace('; myinnerHTML +='More'; myinnerHTML +=''+response.calendar.data[i].source+''; myinnerHTML +=''+response.calendar.data[i].previous+' '; myinnerHTML +=''+response.calendar.data[i].forecast+' '; myinnerHTML +=''+response.calendar.data[i].actual+' '; myinnerHTML +=''; myinnerHTML += ''; myinnerHTML +=''; // not used but might come out useful // chat_div.scrollTop = chat_div.scrollHeight; // lastMessage = response.messages.message[i].id; } //end for myinnerHTML +=''; //the table header with text myinnerHTML += ''; myinnerHTML += ''+response.calendar.header[1]+''; myinnerHTML += ''+response.calendar.header[2]+''; myinnerHTML += ''; myinnerHTML += ''+response.calendar.header[4]+''; myinnerHTML += ''+response.calendar.header[5]+''; myinnerHTML += ''+response.calendar.header[6]+''; myinnerHTML += ''+response.calendar.header[7]+''; myinnerHTML +=''; myinnerHTML +=''; calendar_div.innerHTML = ''+myinnerHTML+'
'; mTimer = setTimeout('refreshScript(myurl);',refreshrate); //Refresh content every given interval if(FBscroll =='1'){ clearInterval(scrme1); LoadNewsScrollers1(); // tellStatus(" "); scrme1 = setInterval('AutoScrollNewsDown1()',150); } } //end if } function toggleMe(id,aid){ var e = document.getElementById(id); var a = document.getElementById(aid); if(e.style.display == 'block') { e.style.display = 'none'; a.innerHTML = 'More'; } else { e.style.display = 'block'; a.innerHTML = 'More'; } //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