// ThumbNails
function tabStripThumbNailSwitch(el) {
	
	if(el.className == "activated") return;
	_thumbNailGroup = el.parentNode;
	_tabStrip = _thumbNailGroup.parentNode;
	_index = el.id.substr( _tabStrip.id.length + 4 );
	_bodyId = _tabStrip.id + "_tb_" + _index;
	
	_thumbNails = _thumbNailGroup.getElementsByTagName("div");
	
	for(i=0; i<_thumbNails.length; i++) {
		if( _thumbNails[i].parentNode  == _thumbNailGroup) {
			if( _thumbNails[i] == el ){
				_thumbNails[i].className = "active"
				document.getElementById(_tabStrip.id + "_hidd").value = _index;
			}
			else {
				_thumbNails[i].className = "normal";
			}
		}
	}
	
	delete _thumbNails;
	_bodies = _tabStrip.childNodes;
	_bodyOld = null;
	_bodyNew = null;
	
	for(i=0; i<_bodies.length; i++) {
		if( typeof(_bodies[i].parentNode) ) {
			if( _bodies[i].tagName  == "DIV" ) {
				if( _bodies[i].style.display == "block" ) _bodyOld = _bodies[i];
				if( _bodies[i].id ==  _bodyId ) _bodyNew = _bodies[i];
				//alert("[1]: " +_bodies[i].id + " == [2]: " +_bodyId  );
			}
		}
	}
	
	if(_bodyOld != null) _bodyOld.style.display = "none"; 
	if(_bodyNew != null) _bodyNew.style.display = "block"; 
	delete _bodies;
}


// Select
function tabStripSelectSwitch(el) {
	_tabStrip = el.parentNode.parentNode.parentNode.parentNode;
	_bodyId = _tabStrip.id + "_tb_" + el.selectedIndex;
	
	_bodies = _tabStrip.childNodes;
	_bodyOld = null;
	_bodyNew = null;
	
	for(i=0; i<_bodies.length; i++) {
		if( typeof(_bodies[i].parentNode) )
		if( _bodies[i].tagName  == "DIV" ) {
			if( _bodies[i].style.display=="block" ) _bodyOld = _bodies[i];
			if( _bodies[i].id ==  _bodyId ) _bodyNew = _bodies[i];
		}
	}
	if(_bodyOld != null) _bodyOld.style.display = "none"; 
	if(_bodyNew != null) _bodyNew.style.display = "block"; 
	
	delete _bodies;			
}


function updateSelAuthors(_id1) {
	s1 = document.getElementById(_id1);
	v1 = document.getElementById(_id1+"Value");
	//alert(v1.value);
	o1 = s1.options;
	v1.value = "";
	for(i=0;i<o1.length;i++) {
		v1.value += "," + o1[i].value;

	}
	
	var arrTemp = new Array(o1.length);
	var arrTempVal = new Array(o1.length);
	var arr = new Array(o1.length);
	
	for(i=0;i<o1.length;i++) {
		
		arrTempVal[i]  = o1[i].value;
		arrTemp[i]  = o1[i].text.toLowerCase();
		arr[i] = o1[i].text;
	}
	
	arrTemp.sort();
	
	for(i=0;i<arrTemp.length;i++) {
			opt = new Option();			
			for(j=0;j<arrTemp.length;j++) {
				if(arrTemp[i] == arr[j].toLowerCase()) {
					opt.text  = arr[j];
					opt.value   = arrTempVal[j];
					o1[i] = opt;
				}
			}
	}
			
	//alert(v1.value);
}


function moveOpt(_id1, _id2){
	s1 = document.getElementById(_id1);
	s2 = document.getElementById(_id2);
	o1 = s1.options;
	o2 = s2.options;
	destIdx = o2.length;
	_ok = false;
	for(i=0;i<o1.length;) {
		if(o1[i].selected) {
			opt = new Option();
			opt.value  = o1[i].value;
			opt.text  = o1[i].text;
			//alert(opt);
			//alert(o1[i]);
			o2[destIdx++] = opt;;
			o1[i] = null;
			_ok = true;
		}
		else{
			i++;
		}
	}
	if(!_ok) alert('No option has been chosen!');
	
	var arrTemp = new Array(o2.length);
	var arrTempVal = new Array(o2.length);
	var arr = new Array(o2.length);
	
	for(i=0;i<o2.length;i++) {
		
		arrTempVal[i]  = o2[i].value;
		arrTemp[i]  = o2[i].text.toLowerCase();
		arr[i] = o2[i].text;
	}
	
	arrTemp.sort();
	
	for(i=0;i<arrTemp.length;i++) {
			opt = new Option();			
			for(j=0;j<arrTemp.length;j++) {
				if(arrTemp[i] == arr[j].toLowerCase()) {
					opt.text  = arr[j];
					opt.value   = arrTempVal[j];
					o2[i] = opt;
				}
			}
	}
		
}


