/*function showConfirm (text, callback) {
	return Confirm.show(LOCALIZATION.ATTENTION, text, LOCALIZATION.OK, callback);
}

function showAlert (text, type) {
	showAlert('', text, type);
}*/

function getSignString (){
	return '';
}

function hideHint(){
	var div=document.getElementById('AWL_hint')
	div.style.display='none';
	while(div.firstChild) div.removeChild(div.firstChild);
	this.title=this.getAttribute('tt');
}

function showHint(obj,e){

	var x,y;

	if(e.pageY){
		x=e.pageX;
		y=e.pageY;
	}else if(window.event && document.documentElement && document.documentElement.scrollTop){
		x=event.clientX+document.documentElement.scrollLeft;
		y=event.clientY+document.documentElement.scrollTop;
	}else if(window.event && document.body){
		x=event.clientX+document.body.scrollLeft;
		y=event.clientY+document.body.scrollTop;
	}else{
		x=800;
		y=600;
	}

	var div=document.getElementById('AWL_hint');

	if(!div){
		div = document.createElement('DIV');
		div.setAttribute('id','AWL_hint');
		div.style.position='absolute';
		document.getElementsByTagName('body')[0].appendChild(div);
	}

	if(obj.previousSibling){
		if(obj.previousSibling.title){
			div.appendChild(document.createElement('SPAN')).appendChild(document.createTextNode(obj.previousSibling.title));
		}
	}

	div.style.display='block';
	if(typeof(obj.onmouseout)!='function'){
		obj.onmouseout=hideHint;
	}
	div.appendChild(document.createTextNode(obj.title||''));

	obj.setAttribute('tt',obj.title);
	obj.title='';div.style.top=(y)+'px';div.style.left=(x+20)+'px';
}

function preloadCss(name){
	if(window[name+'_loaded']==true){
		return;
	}
	var s=document.documentElement.firstChild.appendChild(ce('link'));
	s.type='text/css';
	s.setAttribute('rel','stylesheet');
	s.setAttribute('href',cssPath(name));
	window[name+'_loaded']=true;
}
function preloadJs(name){
	if(window[name+'_loaded']==true){
		return;
	}
	var s=document.documentElement.firstChild.appendChild(ce('script'));
	s.type='text/javascript';
	s.setAttribute('src',jsPath(name));
	window[name+'_loaded']=true;
}

function jsPath(name) {
	return _path()+'clientScripts/'+name
}

function getLiteLoc(path) {
	var loc = _url() + 'lite.php?';
	return loc + path;
}

function cssPath(name) {
	return _path()+'css/'+name
}

function _path() {
	if(!window['shared_path']){
		var e = document.getElementsByTagName('script');
		
		for(var i=0; i<e.length; i++) {
			if ((e[i].src) && (e[i].src.match(/system.js/))) {
				var p = e[i].src.indexOf('clientScripts/system.js');
				if(p > 0) {loc = e[i].src.substring(0, p);}
				window['shared_path'] = loc;
			}
		}
	}
	return window['shared_path'];
}

function _url() {
	if(!window['local_url']){
		var loc = top.location + "";
		var i = loc.indexOf('index.php');
		if(i > 0) {loc = loc.substring(0, i);}
		else {
			var i = loc.indexOf('?sid=');
			if(i > 0) {loc = loc.substring(0, i);}
		}
		window['local_url'] = loc;
	}
	return window['local_url'];
}

function srnd() {
	return getCookie('PHPSESSID');
}

var Notification = {
	msgs:[],
	title: "Сообщение",
	show:function() {
		if(Notification.msgs.length > 0) {
			var t = Notification.msgs.length == 1 ? 'Сообщение' : 'Сообщения';
			setTimeout(function(){showAlert(t, Notification.msgs)}, 100);
		}
	},
	add:function(m,c) {
		if(!isArray(m)) m = [m];
		m.each(function(e){Notification.msgs.push({'cls':c,'txt':e})});
	}

};

