var timers = Array();
var objects = Array();
var ieop=0;
var agt=navigator.userAgent.toLowerCase();
var scnWid,scnHei;
var action = "none";

function showMessage(mtype, title, text, mcolor, icon, secs, mlapse) {	
	if(mtype == "ok") { if(!mcolor) { mcolor = "green"; } if(!icon) { icon = "ok.png"; } }
	else if(mtype == "info") { if(!mcolor) { mcolor = "blue"; } if(!icon) { icon = "info.png"; } }
	else if(mtype == "note") { if(!mcolor) { mcolor = "blue"; } if(!icon) { icon = "note.png"; } }
	else if(mtype == "tip") { if(!mcolor) { mcolor = "blue"; } if(!icon) { icon = "tip.png"; } }
	else if(mtype == "warning") { if(!mcolor) { mcolor = "yellow"; } if(!icon) { icon = "important.png"; } }
	else if(mtype == "error") { if(!mcolor) { mcolor = "yellow"; } if(!icon) { icon = "error.png"; } }
	else {
		if(!mcolor) { mcolor = "gray"; }
		if(!icon) { icon = "note.png"; }
		}
	if(!mlapse) { lapse = 10; }
	if(!secs) { secs = 5; }
	var msecs = secs * 1000;
		
	document.getElementById('msg-data').className = 'msg-'+mcolor;
	document.getElementById('msg-iconarea').innerHTML = '<img src="/qcgi/admin/Templates/ui/icons/64/'+icon+'" />';
	document.getElementById('msg-textarea-title').innerHTML = title;
	document.getElementById('msg-textarea-text').innerHTML = text;

	timer = setTimeout(hideMessage,msecs);
	changeOpacity("messageArea", 10);
	}
function hideMessage() {
	clearTimeout(timers['messageArea']);
	timers['messageArea'] = setTimeout("changeOpacity('messageArea',-10)", 1000);
	}
function showModuleMenu() {
	clearTimeout(timers['moduleMenu']);
	if(document.getElementById("moduleMenu").style.display == "block") { document.getElementById("moduleMenu").style.display = "none"; }
	else { document.getElementById("moduleMenu").style.display = "block"; }
	return false;
	}
function hideReveal(objectName) {
	if(document.getElementById(objectName).style.display == "block") { document.getElementById(objectName).style.display = "none"; }
	else { document.getElementById(objectName).style.display = "block"; }
	}
function hideModuleMenu() {
	clearTimeout(timers['moduleMenu']);
	timers['moduleMenu'] = setTimeout('document.getElementById("moduleMenu").style.display = "none"', 1000);
	return false;
	}
function changeOpacity(elementName, opInc){
	if(!opInc) { opInc = 10; }
	if(!objects[elementName]) { objects[elementName] = 0; }
	
	element = document.getElementById(elementName);
	
	objects[elementName] = objects[elementName] + opInc;
	if(objects[elementName] > 100) { objects[elementName] = 100; }

	if(objects[elementName]  > 0 && element.style.display != "block") { element.style.display = "block"; }
	if(objects[elementName] == 0 && element.style.display != "none")  { element.style.display = "none";  }
		
	if(agt.indexOf('msie') != -1) { element.style.filter="alpha(opacity="+objects[elementName]+")"; }
	else { element.style.opacity = objects[elementName]/100; }
		
	if(objects[elementName] > 0 && objects[elementName] < 100) {
		timers[elementName] = setTimeout('changeOpacity("'+elementName+'",'+opInc+')', 20);
		}
	}
function redraw() {
	if (self.innerHeight) {
		scnWid = self.innerWidth;
		scnHei = self.innerHeight;
		}
	else if (document.documentElement && document.documentElement.clientHeight) {
		scnWid = document.documentElement.clientWidth;
		scnHei = document.documentElement.clientHeight;
		}
	else if (document.body) {
		scnWid = document.body.clientWidth;
		scnHei = document.body.clientHeight;
		}
	scnWid -= 35; scnHei -= 40;
	if(scnWid < 640) { scnWid = 640; } if(scnHei < 480) { scnHei = 480; }
	
	document.getElementById('mainArea').style.width = scnWid + "px";
	document.getElementById('mainArea').style.height = scnHei + "px";
	document.getElementById('dialogData').style.height = (scnHei-80) + "px";
	}
function getURL(url,target) {
	window.location = url;
	}
function gotoPage(pNum) {
	form = document.forma;
	form.pageNum.value = pNum;
	form.submit();
	}
function setClass(e,clsName) {
	e.className = clsName;
	}
