// JavaScript Document
window.addEvent('domready', function() {
	Cufon.now();								 
	Cufon.replace('h1');
	Cufon.replace('h2');
	Cufon.replace('h3');
	Cufon.replace('div#shapka ul li a');
	Cufon.replace('div#left ul li a');
	var myTips = new Tips('.tips');
	
	$each($$('.l'), function(item, index, object){
		item.set('morph', {duration: 500, transition: Fx.Transitions.Expo.easeOut});
		item.setStyle('background-position','0px 0px');
	})
	$$('.l').addEvent('mouseover',function(){
		var h=this.getStyle('height');
		this.morph({'background-position': '0px '+h});
	}).addEvent('mouseout',function(){
		var h=this.getStyle('height');
		this.morph({'background-position': '0px 0px'});
	})
});
function my_alert(txt, obj) {
	if($('alert_div')){
		$('alert_div').dispose();
	}
	var alert_div = new Element('div',{'class':'alert','id':'alert_div'});
	var table = new Element('table');
		table.cellPadding ='0';
		table.cellSpacing ='0';
		table.border ='0';
		var tbody = new Element('tbody').injectInside(table);
			var tr1 = new Element('tr').injectInside(tbody);
				new Element('td', {'class' : 'tl'}).injectInside(tr1);
				new Element('td', {'class' : 't'}).injectInside(tr1);
				new Element('td', {'class' : 'tr'}).injectInside(tr1);
			var tr2 = new Element('tr').injectInside(tbody);
				new Element('td', {'class' : 'l'}).injectInside(tr2);
				var cont = new Element('td', {'class' : 'c'}).injectInside(tr2);
			var a=new Element('a',{'class' : 'close'}).injectInside(cont).addEvent('click', function(e){
				e.stop;
				alert_div.dispose();
			});
				var cont_div = new Element('div',{'class' : 'cont'}).injectInside(cont);
				new Element('td', {'class' : 'r'}).injectInside(tr2);
			var tr3 = new Element('tr').injectInside(tbody);
				new Element('td', {'class' : 'bl'}).injectInside(tr3);
				new Element('td', {'class' : 'b'}).injectInside(tr3);
				new Element('td', {'class' : 'br'}).injectInside(tr3);
	table.injectInside(alert_div);
	cont_div.set('html',txt);
	if(obj){
		var coords=obj.getCoordinates();
		alert_div.setStyle('top',coords.top+(coords.height/2)-40+'px');
		alert_div.setStyle('left',coords.left+(coords.width/2)+'px');
	}
	alert_div.inject(document.body);
}
function update_code(id){
	if($('code_hidden_'+id)){
		rand=Math.floor((Math.random() * (99999999-10000000+1))+10000000);
		$('code_hidden_'+id).value=rand;
		$('code_img_'+id).setProperty('src','/ajax/code_'+rand+'.png');
		$('code_answer_'+id).value='';
	}
}

