// Rollover Functions
// with XHTML Strict compliancy using getElementById()

// by: dadog
// thx to : Russ Brooks

preloadFlag = false;
function newImage(imgSrc) {
 	if(document.images) {
		res = new Image();
		res.src = imgSrc;
		return res;
	}
}
function preloadImages() {
	if(document.images) {
		preloadFlag = true;
		btn_02_o = newImage("_img/btn_ni_02_f2.jpg");
		btn_03_o = newImage("_img/btn_di_03_f2.jpg");
		btn_04_o = newImage("_img/btn_aw_04_f2.jpg");
		btn_05_o = newImage("_img/btn_ga_05_f2.jpg");
		btn_06_o = newImage("_img/btn_fa_06_f2.jpg");
		btn_07_o = newImage("_img/btn_bi_07_f2.jpg");
	}
}

function preloadImagesWhois() {
	if(document.images) {
		preloadFlag = true;
		btn_02_o = newImage("_img/btn_ni_02_f2.jpg");
		btn_03_o = newImage("_img/btn_di_03_f2.jpg");
		btn_04_o = newImage("_img/btn_aw_04_f2.jpg");
		btn_05_o = newImage("_img/btn_ga_05_f2.jpg");
		btn_06_o = newImage("_img/btn_fa_06_f2.jpg");
		btn_07_o = newImage("_img/btn_bi_07_f2.jpg");
	}
        if (document.whois) {
           if (document.whois.captchaResponse) {
                document.whois.captchaResponse.focus();
           }
        }
}

function preloadImagesRoot() {
        if(document.images) {
                preloadFlag = true;
                btn_nl_o = newImage("_img/btn_nl_f2.gif");
                btn_fr_o = newImage("_img/btn_fr_f2.gif");
                btn_en_o = newImage("_img/btn_en_f2.gif");
        }
}
function swapImage (img,newSrc) {
	if(document.images && (preloadFlag == true)) {
		theImg=document.getElementById(img);
		theImg.setAttribute("src",newSrc);
	}
}

var newWindow = null;
function closeWin(){
    if (newWindow != null){
        if(!newWindow.closed)
            newWindow.close();
    }
}
function popStat(url, year){

    closeWin();

	var h = screen.height - 50;
	var w = 475;

	var l = ((screen.width / 2) - w);
	var t = 0;

    var tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=no,width="+w+",height="+h+",top="+t+",left="+l;
    newWindow = window.open(url+"?y="+year, 'newWin', tools);
    newWindow.focus();
}
function printPage() {
  if (window.print)
    window.print()
  else
    alert("Sorry, your browser doesn't support this feature.\n If you are on a macintosh computer press command+p");
}

function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function xoopsGetElementById(id) {

if (document.getElementById(id)) {
        return document.getElementById(id);
        } else if (document.all[id]) {
                return document.all[id];
                } else if (document.layers && document.layers[id]) {
                        return (document.layers[id]);
                        } else {
                                return fake_element;
                        }
}

function toggleDisplay(id) {
var elestyle = xoopsGetElementById(id).style;

if (elestyle.display == "none") {
	elestyle.display = 'block';
	} else {
		elestyle.display = "none";
	}
}

function toggleVisible(name) {
	var current = document.getElementById(name).style;
	if(current.visibility == 'hidden') {
		current.visibility = 'visible';
		current.display = 'block';
		eval("document."+name+"img.src='/_img/min.png'");
	} else {
		current.visibility = 'hidden';
		current.display = 'none';
		eval("document."+name+"img.src='/_img/plus.png'");
	}
}

