
// get reference to core window
var corewindow = null;
if (window.opener) {
    corewindow = window.opener.corewindow;
} else if (window.parent) {
    corewindow = window.parent.corewindow;
}
oxThemeStyle = corewindow.oxThemeStyle;
function ErrorPopup() {}
ErrorPopup.ok = function () {
	ErrorPopup.closeWindow();
};
ErrorPopup.openWindow = function (width, height) {
    ox.api.setModal(true);
//	showNode("modal-dialog");
//	$("modal-dialog").style.display="block";
	showNode("error_popup");
	centerPopupWindow($("error_popup"), width, height);
	$("error_popup").style.display="block";
};
ErrorPopup.closeWindow = function () {
	hideNode("error_popup");
	$("error_popup").style.display="none";
	ox.api.setModal(false);
//	hideNode("modal-dialog");
//	$("modal-dialog").style.display="none";
};
register("Loaded",function() {
    var newPath = corewindow.oxThemeStyle.path || "default";
    for (var i in init.images) {
        init.images[i] = init.images[i].replace(/\/default\//g, "/"+newPath+"/");
    }
	addOnClose($("error_popup"),function() { ErrorPopup.closeWindow(); }); 
	appendNode("everything");
});
function addHideTreeNode(node,parent,index) { }
function appendNode(id,cd) {
	var node=document.getElementById(id);
	if(node && !cd && (node.style.display=="none" || node.style.display=="NONE")) {
		if(node.tagName == "DIV") { node.style.display = "block"; }
		else { node.style.display = ""; }
	}
}
function removeNode(id,cd) {
	var node=document.getElementById(id);
	if(node && !cd && (node.style.display!="none" || node.style.display!="NONE")) {
		node.style.display = "none";
	}	
}
function refillImages(id) {
    if($ALL(id)) {
        var elements=$ALL(id).getElementsByTagName("img");
        for(var i=0;i<elements.length;i++) {
            var src = init.images[elements[i].id];
            if(src && src != elements[i].src) elements[i].src = src;
        }
    }
}
function showNode(id,changedisplay) {
	appendNode(id,changedisplay);
	refillImages(id);
}

function hideNode(id,changedisplay) {
	removeNode(id,changedisplay);
}
function autorefill() {
	refillImages("body");
}
register("Loaded",autorefill);

var fileloaded=function() {};
