//Alon scrollpage
var nextLeft = 0;
var newsTable;
var isInMove = true;
function $(id) {
	return document.getElementById(id);
}
function moveNewsInit () {
	var randArray = new Array();
	newsTable = document.getElementById("news_table");
	//----------------->
	for(i=newsTable.offsetWidth-344, n=0; i>=0; i=i-344, n++) {
		randArray[n] = i;
	}
	var num = Math.floor((Math.random() * n));
	//----------------->
	newsTable.style.left = -randArray[num];
	isInMove = false;
}
function moveNewsAnimation () {
	leftArr = newsTable.style.left.split("px");
	curLeft = parseInt(leftArr[0]);
		
	if (Math.abs(nextLeft-curLeft) > 1) {
		speed = Math.floor((nextLeft-curLeft)/15);
		if (speed < 1 && speed >= 0) {
			speed = 1;	
		}
		if (speed > -1 && speed <= 0) {
			speed = -1;	
		}
		newsTable.style.left = (curLeft+speed);
	}else{
		isInMove = false;
		newsTable.style.left = nextLeft;
		clearInterval (moveNewsIntval);
	}
	
}
function moveNews (moveDir) {
	if (!isInMove) {
		leftArr = newsTable.style.left.split("px");
		nextLeft = parseInt(leftArr[0])+344*moveDir;
		if (nextLeft > 0 || nextLeft < 344-newsTable.offsetWidth) {
			if (nextLeft > 0) {
				nextLeft = 0;
			}
			if (nextLeft < 344-newsTable.offsetWidth) {
				nextLeft = 344-newsTable.offsetWidth;
			}
		}else{
			isInMove = true;
			moveNewsIntval = setInterval ('moveNewsAnimation()', 15);
		}
	}
}

function resetBodyHeight() {
	//parent.setLocaltion(window.location.search);
	//parent.getFirstHeight();
	//getResizeHeight();
}
function getResizeHeight() {
	var ar = getPageSizeWithScroll();
	parent.getFrameHeight(ar[1]);
}
function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}
//
function flashMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	}
	else {
		return document[movieName]
	}
}

function radioPlay() {
	flashMovie("radio_pl").startRadio();
}

function radioStop() {
	flashMovie("radio_pl").stopRadio();
}

function flashTest() {
	setTimeout("radioStop()", 2000);
	//
	//setTimeout("parent.radioPlay()", 7000);
}
