// JavaScript Document
var accordion=function(){
	var tm=sp=10;
	function slider(n){this.nm=n; this.arr=[]}
	slider.prototype.init=function(t,c,k){
		var a,h,s,l,i; a=document.getElementById(t); this.sl=k?k:'';
		h=a.getElementsByTagName('dt'); s=a.getElementsByTagName('dd'); this.l=h.length;
		for(i=0;i<this.l;i++){var d=h[i]; this.arr[i]=d; d.onclick=new Function(this.nm+'.pro(this)'); if(c==i){d.className=this.sl}}
		l=s.length;
		for(i=0;i<l;i++){var d=s[i]; d.mh=d.offsetHeight; if(c!=i){d.style.height=0; d.style.display='none'}}
	}
	slider.prototype.pro=function(d){
		for(var i=0;i<this.l;i++){
			var h=this.arr[i], s=h.nextSibling; s=s.nodeType!=1?s.nextSibling:s; clearInterval(s.tm);
			if(h==d&&s.style.display=='none'){s.style.display=''; su(s,1); h.className=this.sl}
			else if(s.style.display==''){su(s,-1); h.className=''}
		}
	}
	function su(c,f){c.tm=setInterval(function(){sl(c,f)},tm)}
	function sl(c,f){
		var h=c.offsetHeight, m=c.mh, d=f==1?m-h:h; c.style.height=h+(Math.ceil(d/sp)*f)+'px';
		c.style.opacity=h/m; c.style.filter='alpha(opacity='+h*100/m+')';
		if(f==1&&h>=m){clearInterval(c.tm)}else if(f!=1&&h==1){c.style.display='none'; clearInterval(c.tm)}
	}
	return{slider:slider}
}();

function hide(){
  var el;
   for (var i=0;i<arguments.length;i++){
    el = document.getElementById(arguments[i]);
    if (el){
      // hide the element
      el.style.display = 'none';
    }
  }  
}

function show(){
  var el;
  for (var i=0;i<arguments.length;i++){
    el = document.getElementById(arguments[i]);
    if (el){
      // remove the .hidden class
      removeClass(el,'hidden');
      // show the element
      el.style.display = '';
    }
  }  
}
function removeClass(el, class_name){
    if (!el.className) return;         // element has not className property
    var classes = el.className.split(' ');
    for (var i=0; i<classes.length; i++){
      if (classes[i]==class_name)
        classes.splice(i, 1);          // class found - remove it
    }
    el.className=classes.join(' ');    // set the element's class(es)
  }

function setIconSet(ctype){
    // hide consumer fields
    /*hide('iconeset1Row','iconeset2Row','iconeset3Row',
		'iconeset4Row','iconeset5Row','iconeset6Row');*/
	hide('emoticonRow');
	hide('iconeset1Row');
	hide('iconeset2Row');
	hide('iconeset3Row');
	hide('iconeset4Row');
	hide('iconeset5Row');
	hide('iconeset6Row');
	hide('iconeset7Row');
    // hide commercial fields
    switch (ctype.toLowerCase()){
    case 'emoticons':
      // show consumer fields
      show('emoticonRow');
      break;
    case 'iconset1':
      // show commercial fields
      show('iconeset1Row');
      break;
	 case 'iconset2':
      // show commercial fields
      show('iconeset2Row');
      break;
	 case 'iconset3':
      // show commercial fields
      show('iconeset3Row');
      break;
	 case 'iconset4':
      // show commercial fields
      show('iconeset4Row');
      break;
	 case 'iconset5':
      // show commercial fields
      show('iconeset5Row');
      break;
	 case 'iconset6':
      // show commercial fields
      show('iconeset6Row');
      break;
	 case 'iconset7':
      // show commercial fields
      show('iconeset7Row');
      break;
    default:
    }  
  };
