/* javascript functions */

function MakeArray(size)
{
	this.length = size;
	for( var i=0; i < size; i++)
	{
		this[i-11] = 0;
	}
	return this;
}

function GetTime()
{
	now = new Date();

	(now.getHours() < 10)? hour = "0" + now.getHours() : hour = now.getHours();	
	(now.getMinutes() < 10)? minute = "0" + now.getMinutes() : minute = now.getMinutes();		
	(now.getSeconds() < 10)? sec = "0" + now.getSeconds() : sec = now.getSeconds();
	
	timezones = new MakeArray(24);
	timezones[-12] = "Fiji, Wellington";
	timezones[-11] = "Solomon Islands";
	timezones[-10] = "Sydney";			
	timezones[-9] = "Tokyo, Seoul";
	timezones[-8] = "Beijing, Hong Kong, Singapore";
	timezones[-7] = "Bangkok, Hanoi, Jakarta";
	timezones[-6] = "Dhaka";
	timezones[-5] = "Islamabad";
	timezones[-4] = "Baku";
	timezones[-3] = "Moscow, Bagdad";
	timezones[-2] = "Athens, Cairo, Istanbul, Jerusalem";
	timezones[-1] = "Amsterdam, Berlin, Madrid, Paris, Rome";
	timezones[0] = "GMT";
	timezones[1] = "Azores, Cape Verde";
	timezones[2] = "Mid Atlantic";		
	timezones[3] = "Buenos Aires";
	timezones[4] = "Canada Atlantic, La Paz";		
	timezones[5] = "US Eastern Time";	
	timezones[6] = "US Central Time";
	timezones[7] = "US Mountain Time";
	timezones[8] = "US Pacific Time";
	timezones[9] = "US Alaska";	
	timezones[10] = "US Hawaii";
	timezones[11] = "Samoa";

	tzoffset = now.getTimezoneOffset() / 60;
	timezone = timezones[tzoffset];
	currentTime = hour + ":" + minute + ":" + sec + " " + timezone;
	
	GMThour = hour + tzoffset;
	GMThour_rollover = GMThour % 24;
	GMTtime = GMThour_rollover + ":" + minute + ":" + sec;

//	timemessage = GMTtime + " GMT "+ "or " + currentTime;
	timemessage =  now.toLocaleString() + " " + timezone + " (" + GMTtime + " GMT)";
	return(timemessage)
}


function js_navover(cell){
  if (!cell.contains(event.fromElement)){
    cell.style.cursor = 'hand';
//    cell.bgColor = '#CCCCCC';
//    cell.style.backgroundColor= '#CCCCCC';
  }
}

function js_navout(cell){
  if (!cell.contains(event.toElement)){
    cell.style.cursor = 'default';
//    cell.bgColor = '#DDDDDD';
//    cell.style.backgroundColor= '#DDDDDD';
  }
}

function js_navclick(cell){
  if(event.srcElement.tagName=='TD'){
    cell.children.tags('A')[0].click();
  }
}

/********/

function js_linkover(text){
  self.status=text;
  return true;
}

function js_linkout(){
  window.status="";
  return true;
}

function js_confirmbox(message,location){
  if(confirm(message))
    self.location=location;
}

// old !!

lastColor="";
lastCell="";
current="";

function fix(){
lastCell.style.backgroundColor= lastColor;
}

function js_mOver(cell){
	if (!cell.contains(event.fromElement)){
          current=cell;
	  if( !inmenu ){
		
		lastCell=cell;
		//cell.style.cursor = 'hand';
		cell.bgColor = '#CCCCCC';
		lastColor=cell.style.backgroundColor;
		cell.style.backgroundColor= '#FFFFFF';
	  }
	}
}

function js_mOut(cell){
	if (!cell.contains(event.toElement)){
  	if( !inmenu ){
	  //fix();
	  //cell.style.cursor = 'default';
  	  cell.bgColor = '#BBBBBB';
	  cell.style.backgroundColor= lastColor;
	}
	}
}

function js_mClick(cell){
	if(event.srcElement.tagName=='TD'){
  	cell.children.tags('A')[0].click();
	}
}

/*
var td = document.all ? document.all['test'] : document.getElementById('test');
td.onmouseover = function (evt) { 
this.bgColor = 'blue'; 
cell.style.backgroundColor='blue';
};
*/

/*By JavaScript Kit
http://javascriptkit.com
Credit MUST stay intact for use
*/

function showtimer(id,clocktick){

if (!document.all&&!document.getElementById)
return
//thelement=document.getElementById? document.getElementById(id): document.all.tick2
thelement=document.getElementById(id);

var SEC_IN_HOURS=3600;
var SEC_IN_MINUTES=60;

var hours=0;
var temp=0;
var minutes=0;
var seconds=0;

clocktick++;
hours= Math.floor(clocktick /  SEC_IN_HOURS);
temp=  clocktick % SEC_IN_HOURS;
minutes= Math.floor(temp / SEC_IN_MINUTES);
seconds = temp % SEC_IN_MINUTES;

if(hours <= 9)
hours="0"+hours;
if(minutes <= 9)
minutes="0"+minutes;
if(seconds <= 9)
seconds="0"+seconds;

var ctime=hours+":"+minutes+":"+seconds;
var timeout_call="showtimer(\""+id+"\","+clocktick+")";
//thelement.innerHTML="<b style='font-size:14;color:blue;'>"+ctime+"</b>"
thelement.innerHTML=ctime
setTimeout(timeout_call,1000)
}
///////////////Drop down
/*
function displayDomain(domainObj){
	alert('Select value is ....');
}
*/

function openSupWindow(url, winName, features){
//	window.open("http://www.yahoo.com","","width=500,height=400,status=1")
	window.open(url, winName, features)
}

/////////////// open windows
function MM_openBrWindow(theURL,winName,features) { //v2.0
  //OpenWin = window.open(theURL,winName,features);
  window.open(theURL, winName, config='height=300, width=400, screenX=100, screenY=100, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no');
  //OpenWin = this.open(theURL,winName,features);
}
function closeW(url, target)
{
  self.close();
  window.opener.open(url, target);
}
