var ctab = '';

function ChangeTab( tab ) {
	if( ctab != '' ) {
		document.getElementById('t_'+ctab).setAttribute('class', 'tab_inactive');
		document.getElementById('t_'+ctab).setAttribute('className', 'tab_inactive');
		document.getElementById( ctab ).style.display = 'none';
	}
	
	ctab = tab;
	
	document.getElementById('t_'+tab).setAttribute('class', 'tab');
	document.getElementById('t_'+tab).setAttribute('className', 'tab');
	document.getElementById( tab ).style.display = 'block';
	DoChangePicture( tab, 0 );
}

function DoChangePicture( tab, pic ) {
	document.getElementById("p_"+tab+"_big").style.background = "url('pictures/b_"+gallery[tab][pic][0]+".jpg')";
	document.getElementById("p_"+tab+"_title").innerHTML = "<b>" + gallery[tab][pic][1] + "</b>";
	document.getElementById("p_"+tab+"_desc").innerHTML = gallery[tab][pic][2];
}

function ChangePicture( tab, pic ) {
	return setTimeout("DoChangePicture('"+tab+"', "+pic+")", 500);
}

function PhotoAlbum() {
	var chtml = '';
	
	for( tab in gallery ) {
		chtml += "<div id='"+tab+"' name='"+tab+"' style='display: none'><table cellspacing='0' cellpadding='0' width='100%'><tr><td valign='top'><table class='thumbs_table' cellspacing='2' cellpadding='3'>";
		
		for( pic in gallery[tab] ) {
			if( ! (pic % 2) ) chtml += "<tr>";
			chtml += "<td><img width='100' height='80' onmouseover='t"+tab+pic+"=ChangePicture(\""+tab+"\", "+pic+")' src='pictures/s_"+gallery[tab][pic][0]+".jpg' onmouseout='clearTimeout(t"+tab+pic+")'></td>";
			if( (pic % 2) == 1 ) chtml += "</tr>";
		}
		
		chtml += "</table></td><td valign='top' style='padding-top: 4px'><div style='width:340px;height:340px' id='p_"+tab+"_big' name='p_"+tab+"_big'><img src='/images/bbg.gif'></div></td></tr><tr><td style='padding: 5px 5px 5px 5px' colspan='2'><p id='p_"+tab+"_title' name='p_"+tab+"_title' style='text-align: right'><b></b></p><p id='p_"+tab+"_desc' name='p_"+tab+"_desc' style='text-align: right'></p></td></tr></table></div>";
	}

	document.getElementById("tab_page").innerHTML = chtml;
	ChangeTab( "ouryards" );
}