
var SpecialInterval = 1500;
var SpecialTimer = 0;
var BestInUSAInterval = 1500;
var BestInUSATimer = 0;
var JustForFunInterval = 1500;
var JustForFunTimer = 0;
var WeatherInterval = 5000;
var WeatherTimer = 0;

var mainPhotoNum = 0;
var mainPhotoInterval = 4000;
var mainPhotoTimer = 0;

function DataReRotate(type)
{	
	if(type=="Special")
		SpecialTimer = setTimeout('DataStRotate(\''+type+'\')',SpecialInterval);
	else if(type=="BestInUSA")
		BestInUSATimer = setTimeout('DataStRotate(\''+type+'\')',BestInUSAInterval);
	else if(type=="JustForFun")
		JustForFunTimer = setTimeout('DataStRotate(\''+type+'\')',JustForFunInterval);
	else if(type=="Weather")
		WeatherTimer = setTimeout('DataStRotate(\''+type+'\')',WeatherInterval);
}

function DataStRotate(type)
{	
	if(type=="Special"){
		SpecialTimer = setTimeout('DataStRotate(\''+type+'\')',SpecialInterval);
		DataRolling("SpecialRoll");
	}

	else if(type=="BestInUSA"){
		BestInUSATimer = setTimeout('DataStRotate(\''+type+'\')',BestInUSAInterval);
		DataRolling("BestInUSARoll");
	}

	else if(type=="JustForFun"){
		JustForFunTimer = setTimeout('DataStRotate(\''+type+'\')',JustForFunInterval);
		DataRolling("JustForFunRoll");
	}

	else if(type=="Weather"){
		WeatherTimer = setTimeout('DataStRotate(\''+type+'\')',WeatherInterval);
		DataRolling("WeatherRoll");
	}
}

function DataRolling(divType)
{
	var objDiv = document.getElementById(divType);

	if(objDiv==null) return;
	
	var nowNode = objDiv.firstChild;
	
	while(nowNode){
	
		if(nowNode.className=="main_link"){			
			nowNode.className = "main_link display_none";
			
			if(nowNode.nextSibling!=null)
				nowNode.nextSibling.className = "main_link";
			else	
				objDiv.firstChild.className = "main_link";			
			
			break;
		}		
		nowNode=nowNode.nextSibling;		
	}
}

function WeatherRolling(WeatherRollNum)
{
	var objDiv = document.getElementById('WeatherRoll');

		var nowNode = objDiv.firstChild;

	while(nowNode){
	
		nowNode.className = "main_link display_none";	
		nowNode=nowNode.nextSibling;		
	}

	objDiv.childNodes[WeatherRollNum-1].className = "main_link";

}


function weather_location(WeatherRollNum){
	
	WeatherRolling(WeatherRollNum);	
	document.getElementById("weather_columnview").style.display='none';

}


function mainPhotoReRotate(mainPhotoNum)
{
	(mainPhotoNum == (mainPhotoImg.length)) ? mainPhotoNum=0 : mainPhotoNum++;

	mainPhotoTimer = setTimeout('mainPhotoStRotate()',mainPhotoInterval);
}

function mainPhotoStRotate()
{
	(mainPhotoNum == (mainPhotoImg.length)) ? mainPhotoNum=1 : mainPhotoNum++;

	mainPhotoTimer = setTimeout('mainPhotoStRotate()',mainPhotoInterval);
	mainPhotoRolling(mainPhotoNum);
}

function mainPhotoRolling(mainPhotoRollNum)
{
	mainPhotoTitleDiv = document.getElementById("mainPhotoTitleRoll");
	mainPhotoImgDiv = document.getElementById("mainPhotoImgRoll");

	mainPhotoNum = mainPhotoRollNum;
	mainPhotoTitleDiv.innerHTML = mainPhotoTitle[mainPhotoNum - 1];
	mainPhotoImgDiv.filters.blendTrans.apply();
	mainPhotoImgDiv.innerHTML = mainPhotoImg[mainPhotoNum - 1];
	mainPhotoImgDiv.filters.blendTrans.Play();

}

function mainPhoto(n)
{
	for(var i = 1; i < 4; i++)
	{
		obj = document.getElementById('mainPhoto'+i);
		font = document.getElementById('mainPhoto_btn'+i);
		if ( n == i )
		{
			obj.style.display = "block";
			font.style.color = "#3957A6";
		}
		else
		{
			obj.style.display = "none";
			font.style.color = "#8F939E";
		}
	}
}


function CheckUIElements()
{
	yLayMemoFrom = parseInt (LayMemo.style.top, 10);
	yLayMemoTo = document.body.scrollTop + 135; // À§ÂÊ À§Ä¡

	yOffset = Math.ceil( Math.abs( yLayMemoTo - yLayMemoFrom ) / 20 ); // ·¹ÀÌ¾î ¿òÁ÷ÀÓ ¼Óµµ

	if ( yLayMemoTo < yLayMemoFrom )
	{
		yOffset = -yOffset;
	}
	LayMemo.style.top = parseInt (LayMemo.style.top, 10) + yOffset;
	timeoutNextCheck = 10;
	setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function WindReset()
{
	LayMemo.style.top = document.body.scrollTop;
	LayMemo.style.left = tableid.offsetLeft + 820; // °¡»óÀÇ Å×ÀÌºí¿¡ ³ÐÀÌ(»õ·Î°íÄ§½Ã)
	LayMemo.style.visibility = "visible";
	CheckUIElements();
	return true;
}

function WindLoad()
{
	LayMemo.style.top = document.body.scrollTop;
	LayMemo.style.left = tableid.offsetLeft + 820; // °¡»óÀÇ Å×ÀÌºí¿¡ ³ÐÀÌ(Ã³À½ Á¢¼Ó½Ã)
	LayMemo.style.visibility = "visible";
	CheckUIElements();
	return true;
}

function start_mainPage(){

	WindLoad();
	
	
	mainPhotoTitleDiv = document.getElementById("mainPhotoTitleRoll");
	mainPhotoImgDiv = document.getElementById("mainPhotoImgRoll");

	mainPhotoTitleDiv.innerHTML = mainPhotoTitle[0];
	mainPhotoImgDiv.innerHTML = mainPhotoImg[0];


	DataStRotate("Special");
	DataStRotate("BestInUSA");
	DataStRotate("JustForFun");
	DataStRotate("Weather");
	mainPhotoReRotate(2);
}

	function skyAD(){
		document.getElementById("skyBanner").style.display = "block"
		var point = fGetXY(skyBanner);
		if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	//  	skyBanner.style.left = point.x - skyBanner.offsetHeight+276;
		}
	  else {
	  	s//kyBanner.style.left = point.x - skyBanner.offsetHeight+276;
		}
	//	skyBanner.style.top  = point.y - 5;	    
		


	
	}

	function skyAD2(){
		document.getElementById("skyBanner2").style.display = "block"
		var point = fGetXY(skyBanner2);
		skyBanner2.style.top  = point.y - 450;	    
		skyBanner2.style.left  = point.x + 490;	    
	}

	function hideSkyBanner(){
		document.getElementById("skyBanner").style.display = "none"
	}

	function hideSkyBanner2(){
		document.getElementById("skyBanner2").style.display = "none"
	}
    
	function hideStreamBanner(){
		//document.all.player1.style.visibility="hidden";
		document.getElementById("skyBanner").style.display = "none"
	}    
    
	function radioseoul() {
		window.open("/radioseoul/index.asp","Radioseoul", "top=0,left=0,width=420,height=350");
	}           
	function new_popup_close() {
		
		if ( document.notice_form.chkbox.checked ){ 
			setCookie( "main_popup", "done" , 1 ); 
		} 		
		//document.all['divpop'].style.visibility = "hidden"; 
		hideSkyBanner()
	}

function fGetXY(aTag){
	  var oTmp = aTag;
	  var pt = new Point(0,0);
	  do {
		pt.x += oTmp.offsetLeft;
		pt.y += oTmp.offsetTop;
		oTmp = oTmp.offsetParent;
	  } while(oTmp.tagName!="BODY");
	  return pt;
}

function Point(iX, iY){
	this.x = iX;
	this.y = iY;
}