// SeViR Simple Horizontal Accordion @2007
// http://letmehaveblog.blogspot.com
//edited by me to stipsindex

jQuery.fn.extend({
  stipsindex: function(params){
    var jQ = jQuery;
	var oldactive="";
	var oldactiveson="";
	var oldactivecolumn=0;
	var oldactivecell=0;
	var celltimer="";
	var bigheight=0
	
    var params = jQ.extend({
      speed: "{ queue:false, duration:100}",
	  fastspeed: "{ queue:false, speed:4000}",
      headerclass: "header",
	  parentclass: "tipsindexparent",
      contentclass: "tipscontent",
      contentwidth: 100
    },params);
	function slide_tag_up(theactive,theactiveson,theactivecolumn,theactivecell){
	
	if (oldactive!=""){
	
		if (theactivecolumn!=oldactivecolumn){
			$(oldactiveson).slideUp(700);
			var selector=".tipscontent[rel='closeindex']"
			$(selector).slideUp(700);
		}
		else if (theactivecell<oldactivecell){
		$(oldactiveson).slideUp(700);
		}
		$(oldactiveson).attr("rel","closeindex")
		$(oldactive).removeClass("openindex")
		$(theactive).attr("rel","unactiveindex")
	}	
		$(".cellpsik",$(oldactive)).hide();
		oldactive=theactive
		oldactiveson=theactiveson
		oldactivecolumn=theactivecolumn
		oldactivecell=theactivecell
}


function slide_tag_down(actv,celldata,actvcolumn,actvcell,actvson){

		$(actvson).slideDown(220);
		jQ(actv).attr("rel","activeindex")
		$(actvson).attr("rel","openindex")
		if ($("#showtagsindex").css("display")!="none"){
			slide_tag_up(actv,actvson,actvcolumn,actvcell);
		}
		$(".cellpsik",$(actv)).show();
		$(".header",$(actv)).width("169px");
}
    return this.each(function(){
		
		$("#right,#navigation,#welcomebox,.leftnav").mouseover(
		function(){
		if  ($("#showtagsindex").css("display")=="none"){return false}
		if (oldactive!=""){
			$(".tipscontent").slideUp(700);
			$(".tipsindexparent").removeClass("openindex")
			$(".tipsindexparent[rel='activeindex']").attr("rel","unactiveindex")
			$(oldactiveson).attr("rel","closeindex")
			
		oldactive=""	
		}	
		}
		)
		var actv=this
		var celldata=$(this).attr("name")
		var actvcolumn=parseFloat(celldata.charAt(0))
		var actvcell=parseFloat(celldata.charAt(2))
		var actvson=$(this).children("."+params.contentclass)
      $(this).mouseover(function(){
		if  ($("#showtagsindex").css("display")=="none"){return false}
		if ($(actvson).attr("rel")!="openindex"){
	
	  $(".openindex").removeClass("openindex")
	  $(actv).addClass("openindex")
			if (celltimer!=""){clearTimeout(celltimer)};
			celltimer=setTimeout(function(){slide_tag_down(actv,celldata,actvcolumn,actvcell,actvson)},260)
		}
      });
	  
	  
	 
    });
  }
});

function showhidetagsindex(action){
if (action==1){
		$(".tipscontent").show()
		$(".tipsindexparent").removeClass("openindex")
	}
else{
		$(".tipscontent").hide()
	}
	$('#showtagsindex').toggle();
	$('#hidetagsindex').toggle();
}
