/**
 * =======================================
 * Debuger functions
 * =======================================
 */
var isDebug = false;
/**
 * Adding messages
 */
function d(str){
	if(!isDebug) return null;
	$('debug_c').innerHTML =  str + "<br />" + $('debug_c').innerHTML; 
}
/**
 * Adding message and clear window
 */
function D(str){
	if(!isDebug || !$('debug_c')) return null;
	$('debug_c').innerHTML = str;
}
/**
 * This function initiate debuger and shuld be start in html body onLoad="..."
 */
function resetDebug(){
	if($('debug_c')){
		isDebug = true;
		$('debug_c').innerHTML = 'start';
	}else{
		isDebug = false;
	}
	if(!isDebug) return null;
	if($('debug_c')){
		$('debug_c').innerHTML = ''; 
	}else{
		alert('You must define textarea field with id="debug"');
	}
}
/**
 * Please provide element not his name.
 */
function dumpS(elm){
	if(!isDebug) return null;
	if (elm.style){
		var str = "";
		for (var i in elm.style){
			str += i + ": " + elm.style[i] + "<br />\n";
		}
		d(str);
	}
}
/**
 * Please provide element not his name.
 */
function dump(elm){
	if(!isDebug) return null;
  var str = "";
  for (var i in elm){
    str += i + ": " + elm.getAttribute(i) + "<br />\n";
  }
  d(str);
}
function dumpCP(event){
	D(getcx(event) + ' ' + getcy(event));
}


