function highlight(a, flag) {
	return function() {
		if (flag && flag == 1) {
			a.style.backgroundColor = "#cce9ff"
		} else {
			a.style.backgroundColor = a.defStyle;
		}
	}
}

function writeSource(div) {
	if (!document.getElementById) { return; }
	var o = document.getElementById(div);
	if (typeof(o) == "undefined" || o==null) { return; }
	var s = o.innerHTML;
	if (s==null || s.length==0) { 
		return;
		}
	else {
		var i;
		for(i=0;s.charAt(i)==" "||s.charAt(i)=="\n"||s.charAt(i)=="\r"||s.charAt(i)=="\t";i++) {}
		s = s.substring(i);
		for (i = s.length; i>0; i--) {
			if (s.charAt(i)=="<") {
				s = s.substring(0,i) + "&lt;" + s.substring(i+1) ;
				}
			}
		for (i = s.length; i>0; i--) {
			if (s.charAt(i)==">") {
				s = s.substring(0,i) + "&gt;" + s.substring(i+1) ;
				}
			}
		for (i = s.length; i>0; i--) {
			if (s.charAt(i)=="\t") {
				s = s.substring(0,i) + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + s.substring(i+1) ;
				}
			}
		for (i = s.length; i>0; i--) {
			if (s.charAt(i)=="\n") {
				s = s.substring(0,i) + "<BR>" + s.substring(i+1) ;
				}
			}
		s = s + "<BR>";
		}
	document.write('<A STYLE="font-family:arial; font-size:x-small; text-decoration:none;" HREF="#" onClick="var d=document.getElementById(\'jssource'+div+'\').style; if(d.display==\'block\'){d.display=\'none\';this.innerText=\'+ Show Source\';}else{d.display=\'block\';this.innerText=\'- Hide Source\';} return false;">+ Show Source</A><BR>');
	document.write('<SPAN ID="jssource'+div+'" STYLE="display:none;background-color:#EEEEEE"><TT>'+s+'</TT></SPAN>');
	}
	
function colorTbl(tbl_id, doHighlight) {
	var tbl = document.getElementById(tbl_id);
	if (!tbl) {
		return false;
	}
	var trs = tbl.rows;
	for (var i = 0; i < trs.length; i++) {
		if (i % 2 == 1) {
			trs[i].style.backgroundColor = "#EEEEEE";
		} else {
			trs[i].style.backgroundColor = "#FFFFFF";
		}

		if (doHighlight || 1) {
			trs[i].onmouseover = highlight(trs[i], 1);
			trs[i].onmouseout = highlight(trs[i], 0);
			trs[i].defStyle = trs[i].style.backgroundColor;
		}
	}
}

function colorTbl2(tbl_id, doHighlight) {
	var tbl = document.getElementById(tbl_id);
	if (!tbl) {
		return false;
	}
	var trs = tbl.rows;
	for (var i = 1; (i*2) < trs.length; i++) {
		if (i % 2 == 1) {                        
			trs[i*2-1].style.backgroundColor = "#EEEEEE";
			trs[i*2].style.backgroundColor = "#EEEEEE";
		} else {
			trs[i*2-1].style.backgroundColor = "#FFFFFF";
			trs[i*2].style.backgroundColor = "#FFFFFF";
		}
// trs[i*2].style.verticalAlign = "bottom";
		if (doHighlight || 1) {
			trs[i].onmouseover = highlight(trs[i], 1);
			trs[i].onmouseout = highlight(trs[i], 0);
			trs[i].defStyle = trs[i].style.backgroundColor;
		}
	}
}


function ShowTour(id)
{
  var info = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="300" align="middle">'+
'     <param name="movie" value="/flashtour.php?id=' + id + '" /> '
+ '     <param name="quality" value="high" />'
+ '    <embed src="/flashtour.php?id=' + id + '" quality="high" width="400" height="300" align="middle" type="application/x-shockwave-flash"  pluginspage="http://www.macromedia.com/go/getflashplayer" allowFullScreen="true"/>'
+ '   </object>';
  document.getElementById('flashtour').innerHTML = info;
}
