// JavaScript Document
$(document).ready(function(){
	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)
	$("ul.topnav li span").click(function() { //When trigger is clicked...
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});

});

/////////////////////////////////////////// to change bgcolor /////////////////////////////
function change_bg(id,num,typ)
{
  var type_div="";
  if(typ==2) type_div="t";
  if(typ==3) type_div="th";
  if(typ==4) type_div="mb";
  for(m=1;m<=num;m++)
  {
    if(m==id){
		document.getElementById(type_div+m).style.border='#447703 1px solid';
		document.getElementById(type_div+m).style.background='#fdd807';
	}else{
		if(typ==4){
		  document.getElementById(type_div+m).style.border='#D3D3D3 1px solid';
		  document.getElementById(type_div+m).style.background='#efefef';
		}else if(typ==3){
		  document.getElementById(type_div+m).style.border='#efefef 1px solid';
		  document.getElementById(type_div+m).style.background='';
		}else{
		  document.getElementById(type_div+m).style.border='#efefef 0px solid';
		  document.getElementById(type_div+m).style.background='';
		}
	}
  }
}
//border:#FF0000 1px solid;
