﻿/*
  EffectsPack
  EffectsPack requires Prototype(http://prototype.conio.net/) and
  Effects v2 (http://mir.aculo.us)
  Feel free to use under any conditions
  
  These effects are targeted to specific cases and thus will not work 
  under every scenerio.
*/

 EffectPack = {}
  

/*---------------------------------+
 |        ActiveTab                |
 +---------------------------------+
*/

EffectPack.TabToggle = function(element,tabname) {
	
//id of currently active object
obj_active='';

//First We control the look and feel of the active tab
  ts = element.parentNode.parentNode.getElementsByTagName('li');
  for(j = 0; j < ts.length; j++) 
  {
    link = ts[j].getElementsByTagName('a')[0];
	//if requested is currently active, do nothing
	tmp=link.id.split('_');
	elObj=document.getElementById(tmp[0]);
	if(elObj.style.opacity<0.999 && elObj.style.opacity>0)
		return;
	
	if(tabname==tmp[0] && tmp[1]=='active')
	{	
		element.id=tabname+"_passive";
		ele = $(tabname);
  		Effect2.BlindUp(ele).isFinished();
		obj = document.getElementById(tabname);
		obj.style.display = 'none';
		return;
	}
	
	if(tmp[1]=='active')
		obj_active=tmp[0];
	oldid = link.id.replace('_passive', '');
	oldid=oldid.replace('_active','');
	link.id = oldid+"_passive";
  }

  element.id = tabname+"_active"
 
 //Hide all content containers
  	contents = document.getElementsByClassName('tabset_content');
  	for(var i = 0; i < contents.length; i++) {
    	contents[i].style.display = 'none';
  		contents[i].style.overflow = '';
		contents[i].style.height = 'auto';
	}

    //Extract content container id from href
  
  ele = $(tabname);
  //Magic Happens
  
  if(obj_active!='')
  	Effect2.Appear(ele);
  else
  	Effect2.BlindDown(ele);
}
  
EffectPack.InitTabs = function() {

  //Hide all content containers
  contents = document.getElementsByClassName('tabset_content');
  for(var i = 0; i < contents.length; i++) {
    contents[i].style.display = 'none';
	contents[i].style.overflow = 'auto';
  }
}

EffectPack.ShowFirst = function() {
	element=document.getElementById('tab1_passive');
	if(element!=null)
		element.id="tab1_active";
	
	tabname='tab1'
	ele = $(tabname);
  	new Effect2.Appear(ele);
}

 

