today=new Date();
offset=today.getTimezoneOffset()*60000;
var selcity=""
var zone=32400000;
var start=0;
ctArray=new Array("-5","0","+1","+8","+3","-8")
impCity = new Array("0", "+3", "+1", "+5.5", "+8", "-10", "-9", "-8", "-5", "+1", "+8", "+10", "-3", "+9", "-3", "-8", "-3", "-3")
var time_store = new Array("","","","","","","","","","","","","","","","","","")
var temp_day ;

//function getEachTime(val)
//{
//		var v_zone=val*3600000;
//		today=new Date();
//		today.setTime(today.getTime()+v_zone+offset);

//		var month=today.getMonth()+1
//		var day=today.getDate()
//		var hour=today.getHours()
//		var minute=today.getMinutes()
//		var second=today.getSeconds()

//		var temp=""+month+"."+day+". "+hour
//			temp+=((minute<10)?":0":":")+minute
//			temp+=(hour>=12)?" P.M.":" A.M."
//		return temp;
//}


function localTime()
{
	start=1;
	selcity=document.select_form.city.options[document.select_form.city.selectedIndex].value;
	if (selcity=="none") {
		start=0;
	}
	else {
		zone=selcity.substring(selcity.indexOf('|')+1,selcity.length)
		zone*=3600000;
	}
}

function localTime2(selcity)
{
	start=1;
	zone = selcity * 3600000;
}


function timeLoad()
{


//¼±ÅÃÇÑ µµ½ÃÀÇ ÇöÀç ½Ã°£

	today=new Date();
	today.setTime(today.getTime()+zone+offset);

	var year=today.getFullYear()
	var month=today.getMonth()+1
	var day=today.getDate()
	var hour=today.getHours()
	var minute=today.getMinutes()
	var second=today.getSeconds()

	var temp1=" "+year+"."+month+". "+day+". "
	var	temp2=((hour>12)?hour -12:hour)+((minute<10)?":0":":")+minute+((second<10)?":0":":")+second
	var	temp3=(hour>=12)?" PM ":" AM "

	var temp = temp1 + temp3 + temp2

//¼­¿ïÀÇ ÇöÀç ½Ã°£

	seoul_today=new Date();
	seoul_today.setTime(seoul_today.getTime()+(9*3600000)+offset);

	var seoul_year=seoul_today.getFullYear()
	var seoul_month=seoul_today.getMonth()+1
	var seoul_day=seoul_today.getDate()
	var seoul_hour=seoul_today.getHours()
	var seoul_minute=seoul_today.getMinutes()
	var seoul_second=seoul_today.getSeconds()

	var seoul_temp1=""+seoul_year+"."+seoul_month+"."+seoul_day+". "
	var	seoul_temp2=((seoul_hour>12)?seoul_hour -12:seoul_hour)+((seoul_minute<10)?":0":":")+seoul_minute+((seoul_second<10)?":0":":")+seoul_second
	var	seoul_temp3=(seoul_hour>=12)?" PM ":" AM "

	var seoul_temp = seoul_temp1 + seoul_temp3 + seoul_temp2




	if (start) {
		document.select_form.time.value=temp;
		document.select_form.seoul_time.value=seoul_temp;
		var i , j;

		for(i=0; i<18; i++) {
			temp_day=new Date();
			j = impCity[i] *3600000;
			temp_day.setTime(temp_day.getTime()+j+offset);

			var temp_hour=temp_day.getHours()
			var temp_minute=temp_day.getMinutes()
			var temp_second=temp_day.getSeconds()

			time_store[i] = temp_hour +((temp_minute<10)?":0":":")+temp_minute+((temp_second<10)?":0":":")+temp_second
		}

		document.select_form.world_time1.value = time_store[0]
		document.select_form.world_time2.value = time_store[1]
		document.select_form.world_time3.value = time_store[2]
		document.select_form.world_time4.value = time_store[3]
		document.select_form.world_time5.value = time_store[4]
		document.select_form.world_time6.value = time_store[5]
		document.select_form.world_time7.value = time_store[6]
		document.select_form.world_time8.value = time_store[7]
		document.select_form.world_time9.value = time_store[8]
		document.select_form.world_time10.value = time_store[9]
		document.select_form.world_time11.value = time_store[10]
		document.select_form.world_time12.value = time_store[11]
		document.select_form.world_time13.value = time_store[12]
		document.select_form.world_time14.value = time_store[13]
		document.select_form.world_time15.value = time_store[14]
		document.select_form.world_time16.value = time_store[15]
		document.select_form.world_time17.value = time_store[16]
		document.select_form.world_time18.value = time_store[17]


	}
	else {
		document.select_form.time.value=' Select City'
		document.select_form.seoul_time.value=seoul_temp;

		var i , j;

		for(i=0; i<18; i++) {
			temp_day=new Date();
			j = impCity[i] *3600000;
			temp_day.setTime(temp_day.getTime()+j+offset);

			var temp_hour=temp_day.getHours()
			var temp_minute=temp_day.getMinutes()
			var temp_second=temp_day.getSeconds()

			time_store[i] = temp_hour +((temp_minute<10)?":0":":")+temp_minute+((temp_second<10)?":0":":")+temp_second
		}

		document.select_form.world_time1.value = time_store[0]
		document.select_form.world_time2.value = time_store[1]
		document.select_form.world_time3.value = time_store[2]
		document.select_form.world_time4.value = time_store[3]
		document.select_form.world_time5.value = time_store[4]
		document.select_form.world_time6.value = time_store[5]
		document.select_form.world_time7.value = time_store[6]
		document.select_form.world_time8.value = time_store[7]
		document.select_form.world_time9.value = time_store[8]
		document.select_form.world_time10.value = time_store[9]
		document.select_form.world_time11.value = time_store[10]
		document.select_form.world_time12.value = time_store[11]
		document.select_form.world_time13.value = time_store[12]
		document.select_form.world_time14.value = time_store[13]
		document.select_form.world_time15.value = time_store[14]
		document.select_form.world_time16.value = time_store[15]
		document.select_form.world_time17.value = time_store[16]
		document.select_form.world_time18.value = time_store[17]


	}


	setTimeout("timeLoad()", 1000);


}

function selectcity(){
   var index=0;
   var s_value="";
   index=document.select_form.city.selectedIndex;
   var temp=document.select_form.city.options[index].value;
   if (index!=0) {
      s_value=temp.substring(0,temp.indexOf('|'));
   }
   if (s_value=="") {
      alert("Select City!");
      document.select_form.city.focus();
   } else
      document.location.href=""+s_value+"";

   return false;
}
