// show menu
function show(id) {
    var main = document.getElementById('main_'+id);
    var sub = document.getElementById('sub_'+id);
    var display = sub.style.display;
    var clss = main.className;

	if ( sub.style.display != 'block' && sub.style.display != '' ) {
		sub.style.display = (display == "block") ? "none" : "block";
		main.className = (clss == "current") ? "" : "current";
    } else {
        sub.style.display = "none";
        main.className = "";
	}
resizeHeight();
}

function question (msg, url) {
    var r = confirm(msg);
    if ( r == true) {
        window.location = url;
    }
}

function loadCss(file, media) {
    var oLink = document.createElement('link');
    oLink.href = '/css/' + file + '.css';
    oLink.rel = 'stylesheet';
    oLink.type = 'text/css';
    oLink.media = media;
    document.body.appendChild(oLink);
}

function layer(width, height, zindex, bgcolor, img_width, img_height) {
	var windowheight = getWindowHeight();
	var windowwidth = getWindowWidth();

    var top	= (windowheight / 2) - (height / 2);
    var left = (windowwidth / 2) - (width / 2) ;
	document.getElementById('layer').style.display		= 'block';
	document.getElementById('layer').style.position		= 'absolute';
	document.getElementById('layer').style.top			= top+'px';
	document.getElementById('layer').style.left			= left+'px';
	document.getElementById('layer').style.zindex		= zindex;
	document.getElementById('layer').style.width		= width+'px';
	document.getElementById('layer').style.height		= height+'px'; 
	document.getElementById('layer').style.background	= bgcolor; 
}

function layer2(width, height, zindex, bgcolor, img_width, img_height) {
	var windowheight = getWindowHeight();
	var windowwidth = getWindowWidth();

    var top	= (windowheight / 2) - (height / 2) + 200;
    var left = (windowwidth / 2) - (width / 2) + 165;
	document.getElementById('layer').style.display		= 'block';
	document.getElementById('layer').style.position		= 'absolute';
	document.getElementById('layer').style.top			= top+'px';
	document.getElementById('layer').style.left			= left+'px';
	document.getElementById('layer').style.zindex		= zindex;
	document.getElementById('layer').style.width		= width+'px';
	document.getElementById('layer').style.height		= height+'px'; 
	document.getElementById('layer').style.background	= bgcolor; 
}

function hideLayer() {
	document.getElementById('layer').style.display = 'none';
}

function layerNone() {
	document.getElementById('layer').style.display = 'none';
}

function getWindowHeight () {
	return window.innerHeight ? window.innerHeight :(document.getBoxObjectFor ? Math.min(document.documentElement.clientHeight, document.body.clientHeight) : ((document.documentElement.clientHeight != 0) ? document.documentElement.clientHeight : (document.body ? document.body.clientHeight : 0)));
}

function getWindowWidth() {
	    return (document.layers||(document.getElementById&&!document.all)) ? window.outerWidth : (document.all ? document.body.clientWidth : 0);
}

function changeImg(show,count,nav) {
    var prev1 = document.getElementById('prev1');
    var next1 = document.getElementById('next1');
    var img1 = document.getElementById('influx-image1');
    var img2 = document.getElementById('influx-image2');
    if ( count == '2' ) {
        if ( show == '1' ) {
            img1.style.display = 'block';
            img2.style.display = 'none';
            prev1.style.display = 'none';
            next1.style.display = 'block';
        } else {
            img1.style.display = 'none';
            img2.style.display = 'block';
            prev1.style.display = 'block';
            next1.style.display = 'none';
        }
    } else if ( count == '3' ) {
        var next2 = document.getElementById('next2');
        var prev2 = document.getElementById('prev2');
        var img3 = document.getElementById('influx-image3');
        if ( show == '1' ) {
            img1.style.display = 'block';
            img2.style.display = 'none';
            img3.style.display = 'none';
            prev1.style.display = 'none';
            prev2.style.display = 'none';
            next1.style.display = 'block';
            next2.style.display = 'none';
        } else if ( show == '2' ) {
            img1.style.display = 'none';
            img2.style.display = 'block';
            img3.style.display = 'none';
            prev1.style.display = 'block';
            prev2.style.display = 'none';
            next1.style.display = 'none';
            next2.style.display = 'block';
        } else {
            img1.style.display = 'none';
            img2.style.display = 'none';
            img3.style.display = 'block';
            prev1.style.display = 'none';
            prev2.style.display = 'block';
            next1.style.display = 'none';
            next2.style.display = 'none';
        }
    }
}
