//Vertical Scroller v1.2- by Brian of www.ScriptAsylum.com
//Updated for bug fixes
//Visit JavaScript Kit (http://javascriptkit.com) for script
//ENTER CONTENT TO SCROLL BELOW.
/*
var boxheight=inherit; // BACKGROUND BOX HEIGHT IN PIXELS.
var boxwidth=inherit; // BACKGROUND BOX WIDTH IN PIXELS.
*/
var speed=100; // SPEED OF SCROLL IN MILLISECONDS (1 SECOND=1000 MILLISECONDS)..
var pixelstep=2;
var pauseAfterScroll = 100;
// PIXELS "STEPS" PER REPITITION.
var godown=new Array(); // TOP TO BOTTOM=TRUE , BOTTOM TO TOP=FALSE
var pauseItem=new Array();
var divInterval=new Array();
var txt = '';
var w3c=(document.getElementById)?true:false;
var ie4=(document.all && !w3c)?true:false;
var ie5=(document.all && w3c)?true:false;
var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:false;
// DO NOT EDIT BEYOND THIS POINT
function scroll( divId, scrollUp )
{
var inner,elementheight,ref,refX,refY;
var theDiv = document.getElementById( divId );
var content = theDiv.innerHTML;
if( godown[divId] ) {
alert('Cannot add '+divId+', it already exists!');
return;
}
pauseItem.push(divId);
godown[divId] = !scrollUp;
txt = '';
txt+='
';
txt+='
'+content+'
';
txt+='
';
theDiv.innerHTML = txt;
if( ns6 ) {
var boxheight = get( divId, 'ref' ).style.height;
var boxwidth = get( divId, 'ref' ).style.width;
} else {
var boxheight = get( divId, 'ref' ).offsetHeight;
var boxwidth = get( divId, 'ref' ).offsetWidth;
}
inner=(ie4)?document.all[divId+'inner']:document.getElementById(divId+'inner');
ref=(ie4)?document.all[divId+'ref']:document.getElementById(divId+'ref');
elementheight=getElHeight(inner);
inner.style.top=((godown[divId])? -elementheight : boxheight)+'px';
inner.style.clip='rect(0px, '+(boxwidth)+'px, '+(elementheight)+'px, 0px)';
/*divInterval[divId] = setInterval('scrollbox(\''+divId+'\')',speed);*/
divInterval[divId] = setTimeout('scrollbox(\''+divId+'\')',speed);
}
function pause( divId, timeout ) {
stop(divId);
setTimeout( 'resume(\''+divId+'\')',timeout);
}
function stop( divId ) {
clearTimeout( divInterval[divId] );
pauseItem[divId] = true;
}
function resume( divId ) {
pauseItem[divId] = false;
divInterval[divId] = setTimeout( 'scrollbox(\''+divId+'\')',speed);
}
function getElHeight(el){
if(ie4)return (el.style.height)? el.style.height : el.clientHeight;
else if(ie5) return el.clientHeight;
else
return (el.style.height)? parseInt(el.style.height):parseInt(el.offsetHeight);
}
function getPageLeft(el){
var x;
if(ie4||w3c){
x = 0;
while(el.offsetParent!=null){
x+=el.offsetLeft;
el=el.offsetParent;
}
x+=el.offsetLeft;
return x;
}}
function getPageTop(el){
var y;
if(ie4||w3c){
y=0;
while(el.offsetParent!=null){
y+=el.offsetTop;
el=el.offsetParent;
}
y+=el.offsetTop;
return y;
}}
function get( divId, name ) {
return document.getElementById( divId+name );
}
function addElement() {
var newDiv = document.createElement('div');
var divIdName = 'myDiv';
newDiv.setAttribute('id',divIdName);
newDiv.style.position='absolute';
newDiv.style.zindex='6';
newDiv.style.height='400';
newDiv.style.width='300';
newDiv.style.left='150';
newDiv.style.top='150';
newDiv.innerHTML = '-----
';
document.body.appendChild(newDiv);
}
function scrollbox(divId){
if( pauseItem[divId] ) return;
divInterval[divId] = setTimeout('scrollbox(\''+divId+'\')',speed);
var boxheight = get( divId, 'ref' ).offsetHeight;
var inner = get( divId,'inner' );
var ref = get(divId, 'ref' );
var childs = inner.childNodes;
var elementheight = inner.offsetHeight;
if( ie4||ie5 ) {
elementheight = inner.offsetParent.offsetParent.offsetParent.offsetHeight;
}
inner.style.top=parseInt(inner.style.top)+((godown[divId])? pixelstep: -pixelstep)+'px';
var i = 0;
for( i = 0 ; i < childs.length ; i++ ) {
var element = childs[i];
if( element.id != null && element.id.indexOf(divId+'-pause') == 0 ) {
var result = parseInt(inner.style.top) + ( parseInt(element.offsetTop) ) ;
if( result >= -(pixelstep*2) && result <= ( pixelstep*2) ) {
pause(divId, 1500);
}
}
}
//alert( pause.offsetHeight + ' : '+ inner.style.top + ' > ' + pause.offsetParent.offsetHeight + ' : ' + ref.offsetParent.offsetHeight );
if(godown[divId] == true){
if(parseInt(inner.style.top)>boxheight+pauseAfterScroll) {
inner.style.top=elementheight+'px';
}
} else {
if(parseInt(inner.style.top)<(0-elementheight)-(pauseAfterScroll + ((ie4||ie5)?100:0))) {
inner.style.top=ref.offsetParent.offsetHeight+'px';
}
}
}
function printResult(xmldoc)
{
var news_type = xmldoc.getElementsByTagName('type').item(0).getAttribute('id');
var shouldscroll = xmldoc.getElementsByTagName('type').item(0).getAttribute('scroll');
var scrollup = ((parseInt(xmldoc.getElementsByTagName('type').item(0).getAttribute('direction')) == 1) ? true : false);
var result_div = document.getElementById(news_type);
//var result_collection = xmldoc.getElementsByTagName('line');
var result_collection = xmldoc.getElementsByTagName('block');
var block_result = null;
if( result_collection.length > 0 ) {
block_result = result_collection;
}
result_collection = xmldoc.getElementsByTagName('line');
var number_of_items = result_collection.length;
if( result_div ) {
result_div.innerHTML = '';
if( block_result != null && block_result.length > 0 ) {
for( var i = 0; i < block_result.length ; i++ ) {
var newDiv = document.createElement('div');
newDiv.setAttribute('id', news_type+'-pause'+i);
newDiv.setAttribute('class','block');
newDiv.style.position='relative';
newDiv.style.width='100%';
newDiv.style.height='auto';
newDiv.style.margin='0px';
newDiv.style.padding='0px';
result_collection = block_result[i].getElementsByTagName('line');
number_of_items = result_collection.length;
for( var j = 0 ; j < number_of_items ; j++ ) {
if (result_collection.item(j).hasChildNodes()) {
var line = result_collection.item(j).firstChild.nodeValue;
newDiv.innerHTML += line;
}
}
result_div.appendChild( newDiv );
result_div.scrollTop = result_div.scrollHeight;
}
if( shouldscroll == "1" ) scroll( news_type, scrollup );
} else {
for (var i = 0; i < number_of_items; i++) {
if (result_collection.item(i).hasChildNodes()) {
var line = result_collection.item(i).firstChild.nodeValue;
result_div.innerHTML += line;
}
}
result_div.scrollTop = result_div.scrollHeight;
/*if( shouldscroll == "1" ) scroll( news_type ); */
if( shouldscroll == "1" ) scroll( news_type, scrollup );
}
}
}
function printProgress(xmldoc)
{
var ntype = xmldoc.getElementsByTagName('type').item(0).getAttribute('id');
var result_div = document.getElementById(ntype);
var result_collection = xmldoc.getElementsByTagName('progress');
var header = xmldoc.getElementsByTagName('title').item(0).firstChild.nodeValue;
var currentProgress = xmldoc.getElementsByTagName('current').item(0).getAttribute('progress');
var currentVersion = xmldoc.getElementsByTagName('current').item(0).getAttribute('version');
var number_of_items = result_collection.length;
// result_div.appendChild(document.createElement('br'));
if( result_div ) {
var rest = 100 - parseInt(currentProgress);
result_div.innerHTML = '';
result_div.innerHTML += 'v'+currentVersion+' ( '+currentProgress+'% )
';
result_div.innerHTML += '
';
result_div.innerHTML += '';
for (var i = 0; i < number_of_items; i++) {
if (result_collection.item(i).hasChildNodes()) {
var thisProgress = result_collection.item(i);
var progress_type = thisProgress.getAttribute('type');
var progress_value = thisProgress.getAttribute('value');
var title = thisProgress.getElementsByTagName('title').item(0).firstChild.nodeValue;
var item_collection = thisProgress.getElementsByTagName('item');
var newDiv = document.createElement('helpProgress');
newDiv.innerHTML = ''
+'';
for( var j = 0 ; j < item_collection.length; j++ ) {
var thisItem = item_collection.item(j);
var status = parseInt(thisItem.getAttribute('status'));
var descr = thisItem.firstChild.nodeValue;
var stext = new Array('', '');
if(status == 2) {
stext = new Array('', '');
} else if( status == 1 ) {
stext = new Array('', '');
}
newDiv.innerHTML += '- '+stext[0]+descr+stext[1]+'
';
}
newDiv.innerHTML += '
';
document.getElementById('progress').appendChild( newDiv );
}
}
//result_div.scrollTop = result_div.scrollHeight;
}
}
function updateCalendar(var_data) {
var the_url = '/getXML/calendar/php_get_xml?var_data='+var_data;
makeHttpRequest(the_url, 'printResult', true);
}
function updateProgress() {
var the_url = '/getXML/development/xml_progress';
makeHttpRequest(the_url, 'printProgress', true);
}
function updateNews(request)
{
var command = request;
var the_url = '/getXML/news/php_exec_xml?command='+command;
makeHttpRequest(the_url, 'printResult', true);
}
function startDynamics( interval ) {
if( interval > 0 ) {
/*setInterval( function() {updateNews('news',0);updateNews('plain',0);updateNews('offer',0)} , interval ); */
setTimeout( function() {updateNews('news',0);updateNews('plain',0);updateNews('offer',0)} , interval );
}
updateNews('news');
updateNews('plain');
updateNews('offer');
updateProgress('progress');
updateCalendar(new Array());
}
if( !ie5 ) {
startDynamics( 900000 );
}