function windowNew( sAdres, iWidth, iHeight, sTitle, iReturn ){
    if ( !sTitle ) sTitle = '';
    if( !iReturn ) iReturn = false;
	if( !iWidth ) var iWidth = 750;
	if( !iHeight ) var iHeight = 600;
	if( +iWidth > 750 ) iWidth = 750;
	else iWidth = +iWidth + 40;
	if( +iHeight > 600 ) iHeight = 600
	else iHeight = +iHeight + 40;
	var iX = ( screen.availWidth - iWidth ) / 2;
	var iY = ( screen.availHeight - iHeight ) / 2;
    var refOpen = window.open( sAdres, sTitle, "height="+iHeight+",width="+iWidth+",top="+iY+",left="+iX+",resizable=yes,scrollbars=yes,status=0;" );
    if( iReturn == true ) return refOpen
}
function validate_int(element) {
		var int = parseInt(element.value);
		if(isNaN(int) || (int < 1)) element.value = 1;
		else element.value = int;
		return element.value;
}

function activate(element, ident){
	var e = document.getElementById(ident);
	if (e) e.id = '';
	element.id = ident;
}

function setPublish(cb, h){
	if (cb.checked) h.value = 1;
	else h.value = 0;
}

function installFCKeditor() {
	var installDir =  '/<?php echo $AFN?>/dhtml/FCKeditor/' ;
	var toolbar =  'Deno_Administration';
	var sSkinPath = installDir + 'editor/skins/silver/' ;	
	
	var allTextAreas = document.getElementsByTagName("textarea");
    for (var i=0; i < allTextAreas.length; i++) {
	var currentTA = allTextAreas[i];
    var oFCKeditor = new FCKeditor( currentTA.name ) ;
    oFCKeditor.BasePath = installDir ;
	oFCKeditor.Config['SkinPath'] = sSkinPath ;
	oFCKeditor.ToolbarSet = toolbar ;
	oFCKeditor.Config[ 'ToolbarLocation' ] = 'Out:xToolbar' ;
	oFCKeditor.Width = currentTA.style.width; 
	oFCKeditor.Height = currentTA.style.height ; 
	oFCKeditor.ReplaceTextarea();
    }
}
function denoPLinkInit() {
	if (document.getElementById) {
		var aPLinks = document.getElementsByTagName('div');	
		for (var i=0; i < aPLinks.length; i++) {
			if (aPLinks[i].className == 'denoPLink') {		
				var oLink = aPLinks[i].getElementsByTagName('a')[0];
				aPLinks[i].sUrl = oLink.href;
				aPLinks[i].onclick = function() {
					document.location = this.sUrl;
				}		
			}
		}
	}
}
// STAND ALONE FUNCTINONS

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return strReturn;
}

function gYear(){
	today=new Date();
	return today.getFullYear();
}
function gEBI( objId ){
  return document.getElementById( objId );
}
function ConfirmDel (msg, url) {
	var b = window.confirm(msg);
	if (b) window.location = url;
}


function confirmSubmit()
{
var agree=confirm("Confirmation?");
if (agree)
	return true ;
else
	return false ;
}

function popup(url, name, width, height)
{
   settings=
   "toolbar=no,location=no,directories=no,"+
   "status=no,menubar=no,scrollbars=yes,"+
   "resizable=yes,width="+width+",height="+height;
   MyNewWindow=window.open(url,name,settings);
}
// TOP TEN
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}
function styledisplay(obj,d){
	document.getElementById(obj).style.display = d;
}

