CD3.Behaviors.assign({
	'.request input[type=checkbox]': CD3.Checkbox,
	'.request select.dropper': CD3.Select,
	'.request input[type=text],.request textarea': {
		focus: function(){
			this.up().addClassName('hovered');
			if (this.getAttribute('value') == this.getAttribute('title'))
				this.setAttribute('value', '');
		},
		blur: function(){
			this.up().removeClassName('hovered');
			if (!this.getAttribute('value'))
				this.setAttribute('value', this.getAttribute('title'));
		}	
	},
	'input#sort': {
		mouseover: function(){
			this.setStyle({
				backgroundPosition: 'bottom left'
			});
		},
		mouseout: function(){
			this.setStyle({
				backgroundPosition: 'top left'
			});
		}
	},
	'.request .dropper .drop span':{
		change: function(){
			alert('dsfdf')
		}
	},
	'input.hover': {
		mouseover: function(){
			this.addClassName('hovered');
		},
		mouseout: function(){
			this.removeClassName('hovered');
		}
	},
	'#dropdown': function(){
		$$('.bg1 li .mid_sqnka').last().hide();
		$$('ul li .leftdrop').invoke('hide');
		$$('#dropdown a.opener').invoke('observe', 'click', function(){
			$$('#dropdown a.opener').invoke('removeClassName', 'selected');
			var ul = this.next('ul');
			if (!ul.visible()){
				this.addClassName('selected');
				ul.up('ul').select('ul').each(function(list){
					if (list != ul && list.visible())
						Effect.BlindUp(list, {duration: .5});
				});
				Effect.BlindDown(ul, {duration: .5});
			} else {
				Effect.BlindUp(ul, {duration: .5});
			}
		});
		
	},
	'#thecontent': function(){
		Effect.ScrollTo('thecontent', { duration: 0.3, offset: -1, queue: 'end'});
	},
	'#totop2:click': Effect.ScrollTo.curry('thecontent', { duration: 0.3, offset: -1, queue: 'end'}),
	'#totop1:click': Effect.ScrollTo.curry('thetop', { duration: 0.3, offset: -1, queue: 'end'}),
	'#thumbslist a:click': function(e){
		$$('#thumbslist a.selected').invoke('removeClassName', 'selected');
		this.addClassName('selected');
		
		var container = $('thumbs').down('div.bigpic');
		container.select('a').invoke('hide');
		container.down('a', this.getAttribute('data-number')).show();
		
		e.stop();		
	},
	'.bigpic': function(){
		new CD3.Lightbox(this.select('a'));
	}
});

Event.observe(window, 'load', function(){
// hmm....
if (document.getElementsByTagName && document.body.outerHTML) {
	var tag, arTag = ['object','embed','applet'];
	for(tag in arTag) {
		var arEl = document.getElementsByTagName(arTag[tag]);
		for(var i = 0; i < arEl.length; i++) {
		var el = arEl.item(i);
		var params = el.getElementsByTagName('param');
		var html = '';
		if (params.length && !/<param/i.test(el.innerHTML))
			for (var x=0;x < params.length;x++)html += params.item(x).outerHTML;
			el.outerHTML = el.outerHTML.replace('>', '>' + html);
		}
	}
}


var pre = $$('pre')[0];
var preHTML = pre.innerHTML;
//$('job-desc').innerHTML = preHTML.evalScripts();

});