/* Random Image Rotator JavaScript reserved for Boeing Home Page ONLY as of launch 12-09-05 */
function imgRotator(a, alt, websiteid){

	var imgNum
	var rtnPicture

	imgNum = Math.floor(Math.random() * a.length);

	// error trap: just in case browser capability exceeded
	if (!isNaN(imgNum)) {
		// construct valid image return string
		//For both china sites
		//If websiteid is 34 or 35 (China and China English sites)then check for 
		//image 'img_366.jpg' and make that image clickable.
		if((websiteid == 34 || websiteid == 35) && a[imgNum] == "imagelib/img_366.jpg"){
			rtnPicture = "<a href='http://www.newairplane.com.cn'><IMG SRC='" + a[imgNum] + "' ALT='" + alt[imgNum] + "' WIDTH='580' HEIGHT='435' BORDER='0' ALIGN='center'></a>"
		}else{
			rtnPicture = "<IMG SRC='" + a[imgNum] + "' ALT='" + alt[imgNum] + "' WIDTH='580' HEIGHT='435' BORDER='0' ALIGN='center'>"
		}
	}
	else {
		// if image value fails to show up then load document with this background image.
		rtnPicture = "<IMG SRC='" + a[0] + "' ALT='The Boeing Company' WIDTH='580' HEIGHT='435' BORDER='0' ALIGN='center'>" + " "
	}

	return rtnPicture;
}

