// JavaScript Document

function show(str) {
	var objAboutTit = document.getElementById("abouttit");
	var objNewsTit = document.getElementById("newstit");
	var objAbout = document.getElementById("about");
	var objNews = document.getElementById("news");
	if(str == "news") {
		objNewsTit.className = "index020101";
		objAboutTit.className = "index020102";
		objNews.style.display = "block";
		objAbout.style.display = "none";
	} else {
		objAboutTit.className = "index020101";
		objNewsTit.className = "index020102";
		objAbout.style.display = "block";
		objNews.style.display = "none";
	}
}

var objParent;
var objChild1;
var objChild2;
var maxWidth;
var objInterval;
var pause;
var intTime;
var intSpeed;
function MovePicInit(ParentId, ChildId1, ChildId2, iTime, iSpeed, ParentWidth) {
	objParent = document.getElementById(ParentId);
	objChild1 = document.getElementById(ChildId1);
	objChild2 = document.getElementById(ChildId2);
	intTime = iTime;
	intSpeed = iSpeed;
	maxWidth = setMaxWidth()
	if(maxWidth <= ParentWidth) return;
	objInterval = null;
	pause = false;
	objChild2.innerHTML = objChild1.innerHTML;
	objParent.scrollLeft = 0;
	objParent.onmouseover = function(){pause = !pause;};
	objParent.onmouseout = function(){pause = !pause;};
	setLeft();
}
function setMaxWidth() {
	var intWidth = objParent.scrollWidth;
	if(intWidth <= 0) {
		setTimeout(setMaxWidth, 500);
	} else {
		return intWidth;
	}
}
function setLeft() {
	clearInterval(objInterval);
	objInterval = setInterval(funcLeft, intSpeed);
}
function funcLeft() {
	if(pause) return;
	objParent.scrollLeft += 2;
	if(maxWidth - objParent.scrollLeft <= 0) {
		clearInterval(objInterval);
		objParent.scrollLeft = 0;
		setTimeout(setLeft, intTime);
	}
}
function setRight() {
	clearInterval(objInterval);
	objInterval = setInterval(funcRight, intSpeed);
}
function funcRight() {
	if(pause) return;
	objParent.scrollLeft -= 2;
	if(objParent.scrollLeft <= 0) {
		clearInterval(objInterval);
		objParent.scrollLeft = maxWidth;
		setTimeout(setRight, intTime);
	}
}
