
var theImages = new Array()

theImages[0] = '1.jpg'
theImages[1] = '2.jpg'
theImages[2] = '3.jpg'
theImages[3] = '4.jpg'

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="images/photos/photo_home_main'+theImages[whichImage]+'" alt="Welcome to FANHS" height="200" width="563" />');
}

var timeout	= 500;
var closetimer	= 0;
var targetddown	= 0;
var sourcebtn = 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();
	sourcebtn.className = null;

	// close old layer
	if(targetddown) targetddown.style.visibility = 'hidden';

	// get new layer and show it
	targetddown = document.getElementById('dropdown_' + id);
	sourcebtn = document.getElementById('btn_' + id);
	targetddown.style.visibility = 'visible';
	sourcebtn.className = 'on';
}
// close showed layer
function mclose()
{
	if(targetddown) targetddown.style.visibility = 'hidden';
	sourcebtn.className = null;
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 


  // this function is need to work around 
  // a bug in IE related to element attributes
  function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   

 function stripe(id) {

    // the flag we'll use to keep track of 
    // whether the current row is odd or even
    var even = false;
  
    // if arguments are provided to specify the colours
    // of the even & odd rows, then use the them;
    // otherwise use the following defaults:
    var evenColor = arguments[0] ? arguments[0] : "#fff";
    var oddColor = arguments[1] ? arguments[1] : "#eee";

    var table = document.getElementsByTagName("table");

    for (var g = 0; g < table.length; g++) {

				var trs = table[g].getElementsByTagName("tr");
				
				for (var i = 0; i < trs.length; i++) {

				if (! trs[i].style.backgroundColor) {
	 
					 // get all the cells in this row...
						var tds = trs[i].getElementsByTagName("td");
					
						// and iterate through them...
						for (var j = 0; j < tds.length; j++) {
					
							var mytd = tds[j];

							// avoid cells that have a class attribute
							// or backgroundColor style
						if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
					
						mytd.style.backgroundColor = even ? evenColor : oddColor;
								
							}
						}
					}
					// flip from odd to even, or vice-versa
					even =  ! even;
				}
		}
  }

	
	

function popup() {
	window.open('pop_video.html','',	'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=530,height=350,left=50,top=50');
} 

function open_win(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}