window.addEvent('domready', function() {
	var format_design = function(){
		var height1=$("left_menu_td").getHeight();
		$("left_menu_bg").setStyle('height',height1+'px');
		//if((height1-163)<378){
		//	$('inside_links').set('morph', {duration:500,transition: Fx.Transitions.Sine.easeOut});
		//	$('inside_links').morph({'margin-top':(height1-163)+'px'});
		//}
		if($('content_text_bg')){
			$('content_text_bg').set('morph', {duration:'long',transition: Fx.Transitions.Sine.easeOut});
			$('content_text_bg').morph({'height':height1-50-20+'px'});
		}
	}
	if($("left_menu_td")){
		format_design.delay(500);
	}	
	var myTips = new Tips('.tips');
});

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='';
	}
}

