function slide(kota){
	//alert(kota);
	var lastE = $('cat-select').get('rel');
	if (lastE != kota && lastE != '') {
		$('cat-select').set('rel', '');
		
		var frame = $('slideframe');
		var widh = frame.getSize().x;
		var lastEl = $(lastE);
		var lastRel = lastEl.get('rel');
		
		var curEl = $(kota);
		var curRel = curEl.get('rel');
		curEl.show();
		
		//alert(lastE + ' --- ' + lastRel + ' --- ' + kota + ' ----' + curRel);
		if(lastRel < curRel){
			//alert('dari Kanan');
			oldL = lastEl.getStyle('left').toInt()+widh;
			//alert(oldL);
			//curEl.setStyle('left','700px');
			curEl.position({
			    relativeTo: lastEl,
			    position: 'upperRight',
			    edge: 'upperLeft'
			});
			//alert('move');
			dist = $('slidearea').getStyle('left').toInt()-widh;
			//alert(dist);
			$('slidearea').tween('left',[dist]);
			
			
		}else{
			oldL = lastEl.getStyle('left').toInt()-widh;
			//alert(oldL);
			//curEl.setStyle('left','700px');
			curEl.position({
			    relativeTo: lastEl,
			    position: 'upperLeft',
			    edge: 'upperRight'
			});
			//alert('move');
			dist = $('slidearea').getStyle('left').toInt()+widh;
			//alert(dist);
			$('slidearea').tween('left',[dist]);
			
		}
		$('slideframe').tween('height', [curEl.getComputedSize().totalHeight]);
		//alert('move2');
		//curEl.move({
		//    relativeTo: frame,
		//    position: 'upperLeft',
		//    edge: 'upperLeft'
		//});
		//alert('move2end');
		$$('.thesched').each(function(item){
			if(item.get('id') != kota && item.get('id') != lastE){
				item.hide();
			}
		});;
		$('cat-select').set('rel', kota);
	}
	
}

function init_slider(){
	var curCity = $('cat-select').get('rel');
	$$('.thesched hr').hide();
	
	var sched = $$('.thesched');
	
	
	var schedN = sched.length;
	var size = $('slidearea').getElement('.thesched').getSize();
	var widthX = size.x * schedN + (schedN * 5);
	//alert(size.x+' --- '+widthX);
	$('slidearea').setStyle('width',widthX);
	
	$('slideframe').setStyle('position','relative');
	initH = $(curCity).getSize();
	$('slideframe').setStyle('height',initH.y);
	$('slideframe').setStyle('overflow','hidden');	
	
	sched.each(function(item){
		item.setStyles({
		    position: 'absolute',
		    top: '0px',
		    left: '960px'
		});

		//item.getPosition();
	});
	$(curCity).setStyle('left','0px');
	$('slidearea').setStyle('position','relative');
	$('slidearea').setStyle('top','0');
	$('slidearea').setStyle('left','0');
	$('slidearea').setStyle('height','100%');
	
	var par = $('cat-select').getElement('p');
	var cursor = new Element('div',{'id' : 'selarrow'});
	cursor.inject(par);
	
	$$('#cat-select p a').each(function(item){
		var kota = item.get('href').substr(1);
		//alert(kota);
		var coOr = item.getCoordinates(par);
		var iLeft = coOr.left+(coOr.width/2)-6;
		
		if(curCity == kota){
			cursor.setStyle('left',iLeft);
			//alert(cursor.getSize().y);
		}
		
		item.href = '#slidetrg';
		//item.innerHTML = 'sada';
		item.addEvent('click',function(){
			//alert(iLeft);
			slide(kota);
			cursor.tween('left',iLeft);
			
		});
	});
	
	$$('#classpage .contact').each(function(item){
		item.removeClass('big');
		item.innerHTML = 'contact';
	});
	
	$$('#aboutpage .contact').destroy();
}
window.addEvent('domready', function(){
								//$$('.ec').fade('hide');
								//initTabs();
								//initShowcase()
								//$('ns').remove();
								//mainMenuH();
								//alterContent();
								//$('ohshade').destroy();
								//alert($('moo-pagetitle').get('value'));
								//if($chk(dEl('.plugin-update'))){
								//	dEl('.plugin-update').destroy();
								//}
								init_slider();
							}
);