/* Fly UK Global Javascript */

/*---- Get By Class -----*/
// Here because those fuckers forgot to build it inot javascript
// what the hell were they playing at???? bastards!!
function getElementByClass(searchClass)
{
	var classElements = new Array();
	var node = document;
	var tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for( i=0 , j=0; i < elsLen; i++ )
	{
		if(pattern.test(els[i].className))
		{
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

/*----- Hide/Display Class -----*/
function displayHide( el , img )
{
	var img = document.getElementById(img);
	
	if(img.src == "images/icons/hide.png")
	{
		img.src = "images/icons/show.png";
	}
	else
	{
		img.src = "images/icons/hide.png";
	}
	
	var el = getElementByClass(el);
	
	for( var i=0; i < el.length; i++ )
	{
		if( el[i].style.display == "" )
		{
			el[i].style.display = "none";
		}
		else
		{
			el[i].style.display = "";
		}
	}
}

/*----- Drop Div -----*/
function doDrop( id , img )
{
	var id = document.getElementById(id);
	var img = document.getElementById(img);
	
	if(id.style.display == "none")
	{
		id.style.display = "";
		img.src = "images/index_images/minus.gif";
	}
	else
	{
		id.style.display = "none";
		img.src = "images/index_images/plus.gif";
	}
}

/*----- Hide Div -----*/
function doHide( id )
{
	var id = document.getElementById(id);
	
	id.style.display = "none";
	id.value = "";
}

/*----- Show Div -----*/
function doShow( id )
{
	var id = document.getElementById(id);
	
	id.style.display = "";
	id.value = "";
}

/*----- Pop-Up Window -----*/
function popup( url , width , height )
{
	var url;
	var width;
	var height;
	window.open( ''+url+'' , 'popup' , 'width='+width+' , height='+height+' , menubar=no , scrollbar=yes , toolbar=no , location=no , resizeable=np , top=50 , left=50' );
}

/*----- Expand & Show Div -----*/
function expandDiv( id , img , newwidth, newheight, oldwidth, oldheight )
{
	var id = document.getElementById(id);
	var img = document.getElementById(img);
	var newwidth;
	var newheight;
	var oldwidth;
	var oldheight;
	
	if(id.style.display == "none")
	{
		window.resizeTo( ''+newwidth+'' , ''+newheight+'' );
		id.style.display = "";
		img.src = "images/index_images/minus.gif";
	}
	else
	{
		window.resizeTo( ''+oldwidth+'' , ''+oldheight+'' );
		id.style.display = "none";
		img.src = "images/index_images/plus.gif";
	}
}

/*----- Menu Jump -----*/
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval("self."+targ+".location.href='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/*----- Clock -----*/
function web_clock()
{
   var monthArray = new Array( 12 );
   monthArray[0] = "Jan";
   monthArray[1] = "Feb";
   monthArray[2] = "Mar";
   monthArray[3] = "Apr";
   monthArray[4] = "May";
   monthArray[5] = "Jun";
   monthArray[6] = "Jul";
   monthArray[7] = "Aug";
   monthArray[8] = "Sep";
   monthArray[9] = "Oct";
   monthArray[10] = "Nov";
   monthArray[11] = "Dec";
	
   var time = new Date()
   var gmtMS = time.getTime() + (time.getTimezoneOffset() * 60000)
   var gmtTime =  new Date(gmtMS)
   var hour = gmtTime.getHours()
   var minute = gmtTime.getMinutes()
   var second = gmtTime.getSeconds()
   var day = gmtTime.getDay();
	if(day == 0){ var day_nice = "Sun"; }
	if(day == 1){ var day_nice = "Mon"; }
	if(day == 2){ var day_nice = "Tue"; }
	if(day == 3){ var day_nice = "Wed"; }
	if(day == 4){ var day_nice = "Thu"; }
	if(day == 5){ var day_nice = "Fri"; }
	if(day == 6){ var day_nice = "Sat"; }
   var date = gmtTime.getDate();
   var month = monthArray[gmtTime.getMonth()];
   var year = gmtTime.getFullYear();
   var temp = "&nbsp;&nbsp;" + day_nice + "&nbsp;" + date + "&nbsp;" + month + "&nbsp;" + year + "&nbsp;"
   temp += ((hour < 10) ? "0" : "") + hour
   temp += ((minute < 10) ? ":0" : ":") + minute
   temp += ((second < 10) ? ":0" : ":") + second + "&nbsp;Z";
   
   document.getElementById("clock_span").innerHTML = temp;
   setTimeout("web_clock()",1000)
}