function News(title, imageURL, link, target, isPhoto, isVideo) {
	this.title = title;
	this.image = new Image();
	this.image.src = imageURL;
	this.link = link;
	this.target = target;
//	this.subtitle = subtitle;
	this.isPhoto = isPhoto;
	this.isVideo = isVideo;
}



function ReplaceChildText(parentEl, newText) {
	while (parentEl.hasChildNodes()) {
		parentEl.removeChild(parentEl.firstChild);
	}
	var newLinkText1 = document.createTextNode(newText);
	parentEl.appendChild(newLinkText1);
}

function MIBigElement() {
	this.link1 = document.getElementById('link1CurrentMI');//on image
	this.link2 = document.getElementById('title1CurrentMI').firstChild;//on text
	this.image = document.getElementById('imgCurrentMI');
	this.td = document.getElementById('tdCurrentMI');
	this.td.onmouseover = function() {
		newsMISelected = true;
	}
	this.td.onmouseout = function() {
		newsMISelected = false;
	}

	this.Set = function(obj) {
		this.link1.href = obj.link;
		this.link1.target = obj.target;
		this.link1.title = obj.title;
		this.link2.href = obj.link;
		this.link2.title = obj.title;
		this.link2.target = obj.target;
		this.image.src = obj.image.src;
		this.image.alt = obj.title;
		ReplaceChildText(this.link2, obj.title);
	}
}




function SelectMI(idx) {
	/*if (currentNewsMI == idx)
		return;*/

	for(var i=0; i<newsCountMI; ++i) {
		if (idx == i) {
			MISmallElementList[i].Hide();
			MIBigEl.Set(newsListMI[i]);
			currentNewsMI = idx;
		}
		else {
			MISmallElementList[i].Show();
		}
	}
}



function MISmallElement(idx) {
	this.idx = idx;
	this.td = document.getElementById('tdMI' + idx);
	this.td.onmouseover = function() {
		SelectMI(idx);
		newsMISelected = true;
	}
	this.td.onmouseout = function() {
		newsMISelected = false;
	}
	this.hideBlock = document.getElementById('hideMI' + idx);


	this.Show = function() {
		this.hideBlock.style.display = 'none';
	}
	this.Hide = function() {
		this.hideBlock.style.display = 'block';
	}

}




function restartTimerMI() {
	clearTimeout(timerMIID);
	timerMIID = setTimeout('RollNewsMI()', changeNewsMITimeout);
}

function RollNewsMI() {
	if (!newsMISelected) {
		var newNewsID = nextMI();
		SelectMI(newNewsID);
	}
	restartTimerMI();
}

function prevMI() {
	if (currentNewsMI == 0)
		return currentNewsMI = newsCountMI-1;
	else
		return --currentNewsMI;
}
function nextMI() {
	if (currentNewsMI == newsCountMI-1)
		return currentNewsMI = 0;
	else
		return ++currentNewsMI;
}