var consoleLog

function replaceConsoleDIV(){
	var cons = document.getElementById("consolePanel");
	var pos =  stringToPix(cons.style.left) + 251;
	var w = getNavWidth();
	if(pos > w){
		cons.style.left = (w - 271)+"px";
	}
}

function initConsole(){
	consoleLog = "";
	document.getElementById('AdcActionConsole').innerHTML = '<div id="log" style="position:relative;left:10px;top:6px;width:95%">' + consoleLog + '</div>'
}

function eventsToConsole(_name, id, _obj, crID, sectionID){
	if(typeof(ADCENTRIC.env.creatives[crID].placements[sectionID].interactions[_name]) != "undefined" ||
		typeof(ADCENTRIC.env.creatives[crID].placements[sectionID].clicks[_name]) != "undefined"){
		switch (id){
			case 0:
				consoleLog += _name + "<br>"
				break;
			case 1:
				consoleLog += "click : " + _name + "<br>"
				break;
			case 2:
				var returnStr = _name + " : "
				if(typeof(_obj) == "string" || typeof(_obj) == "number"){
					returnStr += _obj
				}else{
					for(var i in _obj){
						returnStr += "<br>&nbsp;&nbsp;<i>"+i+"</i> : "+_obj[i]
					}
				}
				consoleLog += returnStr + "<br>"
				break;
			default:
				consoleLog += _name + "<br>"
				break;
		}
	}else{
		consoleLog += "<font color=#FF0000>" + _name + " -> (Define this event in FEX)</font><br>"
	}
	document.getElementById('AdcActionConsole').innerHTML = '<div id="log" style="position:relative;left:10px;top:6px;width:95%">' + consoleLog + '</div>'
}

window.onresize = replaceConsoleDIV;