
$(document).ready(init);

function init()
{


	if ($("#tab-container").get(0)) tabs();
	if ($("#nav").get(0)) dropdownMenu();
	
}

function tabs(){
	var i=0;
	$("#tab-container div.tab div.st01 div.st02 a").each(
					function (){
						this.ind = i;
						i++;
						$(this).click(
							function (){
									$("#tab-container div.tab div.st01 div.st02 a").each(	
										function()		
										{													 
											$($("#tab-container div.tab").get(this.ind)).addClass("tab-inactive");
											
											$(this).find("img").get(0).src = $(this).find("img").attr("inactivesrc")+".gif";
											
											$("#tab-container div.tab-content div.middle").css("display", "none");
											
										}
									)
									$($("#tab-container div.tab").get(this.ind)).removeClass("tab-inactive");
									
									$(this).find("img").get(0).src = $(this).find("img").attr("inactivesrc")+"-active.gif";
									
									$($("#tab-container div.tab-content div.middle").get(this.ind)).css("display", "block");
									
							}			  
						)
						
					} 
	);
}

function dropdownMenu(){
		var i=0;
		$("#nav").find("ul").each(
				function()		
					{
						var li = $(this.parentNode).find("span").get(0);
						var ul = this;
						i++; ul.i = i;
						li.ch = this;
						
						ul.hideBox = function () {
							$(this).slideUp(400); 	
							//$(this).css("display", "none");
						} 
						ul.showBox = function () {
							$(this).slideDown(200); 
							//$(this).css("display", "block");	
						} 
						
						$(li).mouseover(
								function () {
									var ul = this.ch;
									window.clearTimeout(ul.tm);
									ul.showBox();
								}
						)//mouseover
						
						$(li).mouseout(
								function () {
									var ul = this.ch;
									window['obj'+ul.i] = ul;
									ul.tm = window.setTimeout("this['obj"+ul.i+"'].hideBox()",200);
								}
						)//mouseout
						
						$(ul).mouseover(
							function () {
								window.clearTimeout(this.tm);
							}
						)//mouseover
						
						$(ul).mouseout(
								function () {
									var ul = this;
									window['obj'+ul.i] = ul;
									ul.tm = window.setTimeout("this['obj"+ul.i+"'].hideBox()",200);
								}
						)//mouseout
					}
		)//each
	}

