function cgame_getWinSize(winObj) { var myWidth = 0, myHeight = 0; if( typeof( winObj.innerWidth ) == 'number' ) { myWidth = winObj.innerWidth; myHeight = winObj.innerHeight; } else if( winObj.document.documentElement && ( winObj.document.documentElement.clientWidth || winObj.document.documentElement.clientHeight ) ) { myWidth = winObj.document.documentElement.clientWidth; myHeight = winObj.document.documentElement.clientHeight; } else if( winObj.document.body && ( winObj.document.body.clientWidth || winObj.document.body.clientHeight ) ) { myWidth = winObj.document.body.clientWidth; myHeight = winObj.document.body.clientHeight; } return ; } cgame_daemon_jumper = false; cgame_barra_width = 1024; function cgame_daemon() { try { if(cgame_getWinSize(window).w < cgame_barra_width) { var barra = document.getElementById('CGameBarraInterna'); barra.style.marginLeft = '0'; barra.style.left = '0'; barra = document.getElementById('CGameBarraHotsites'); barra.style.marginLeft = '0'; barra.style.left = '0'; cgame_daemon_jumper = true; } else { if(cgame_daemon_jumper){ var barra = document.getElementById('CGameBarraInterna'); barra.style.marginLeft = '-'+(cgame_barra_width/2)+'px'; barra.style.left = '50%'; cgame_daemon_jumper = false; barra = document.getElementById('CGameBarraHotsites'); barra.style.marginLeft = '-'+(cgame_barra_width/2)+'px'; barra.style.left = '50%'; cgame_daemon_jumper = false; } } return; } catch(err) { } } function cgame_barra() { var doc=document; doc.write('
'); cgame_daemon(); setInterval(cgame_daemon, 1000); } cgame_barra(); /* BARRA DE HOTSITES */ BarraHotsites = { status : 'hidden', margin_top_01 : 26, onstop : null, height : 160, Work : function () { if(this.status == 'hidden'){ this.status = 'working'; this.show(); } else if(this.status == 'visible') { document.onclick = null; document.getElementById('CGameBarraHotsites').onmousedown = null; document.getElementById('CGameBarraHotsites').onmouseout = null; this.status = 'working'; this.hide(); } }, show : function () { this.move((this.height*-1), 0); document.getElementById('CGameBarraHotsites').style.display = ''; this.onstop = function () { this.status = 'visible'; document.getElementById('CGameBarraHotsites').onmousedown = function () { document.onclick = null; }; document.getElementById('CGameBarraHotsites').onmouseout = function () { document.onclick = function () { BarraHotsites.Work(); }; }; document.onclick = function () { BarraHotsites.Work(); } } }, hide : function () { this.move(0, (this.height*-1)); this.onstop = function () { this.status = 'hidden'; document.getElementById('CGameBarraHotsites').style.display = 'none'; } }, move : function (atual, end) { el = document.getElementById('CGameBarraHotsites'); var time = 24; var amount = 12; var multiply = 1; var finish = false; var pos = atual; if( (atual - end) > 0) { multiply = -1; } amount = amount * multiply; pos = atual + amount; if(multiply == 1) { if(pos > end) { finish = true; } } else { if(pos < end) { finish = true; } } if(!finish) { document.getElementById('CGameBarraHotsites').style.marginTop = pos + 'px'; var daddy = this; setTimeout( function() { daddy.move(pos, end); } , time ); return; } else { document.getElementById('CGameBarraHotsites').style.marginTop = end + 'px'; try { this.onstop(); fixCssHeight(); } catch(err) { } return; } } }