/********************
*
* btnChange
* - to change background images on button like objects
*
* parameters:
* - obj:    object to change the background image from
* - type:   type to change into (like: hover, regular, click)
*
********************/
function btnChange(obj,type) {
    clsName = obj.className;
    clsArray = clsName.split('_');
    obj.style.backgroundImage = 'url(/images/1/' + clsArray[0] + '_' + clsArray[1] + '_' + type + '.png)';
}

function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }

/********************
*
* blur
* - function to show a blurred screen to obscure total screen (so a div can be on top and focussed to the user)
*
********************/
function blur() {
    a = document.createElement('div');
    a.id = 'blur';
    a.style.position = 'absolute';
    a.style.left = '0px';
    a.style.top = '0px';
    a.style.width = client.windowWidth() + 'px';    
    a.style.height = client.windowHeight() + 'px';
    if (agent('msie')) {
        a.style.filter = 'alpha(opacity=80)';
    } else {
        a.style.opacity = '0.8';
    }
    a.style.zIndex = 1000;
    a.style.backgroundColor = '#ffffff';
    document.body.appendChild(a);
    if (agent('msie 6.0')) {
        // ie_iframe hack for IE6 
        a = document.createElement('iframe');
        a.id = 'blur_ie';
        a.style.position = 'absolute';
        a.style.left = '0px';
        a.style.top = '0px';
        a.style.width = client.windowWidth() + 'px';    
        a.style.height = client.windowHeight() + 'px';
        a.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
        a.style.zIndex = 1000;
        document.body.appendChild(a);
    }
}

/********************
*
* unBlur
* - function to remove blur
*
********************/
function unBlur() {
    document.body.removeChild(document.getElementById('blur'));
    if (agent('msie 6.0')) {
        document.body.removeChild(document.getElementById('blur_ie'));
    }
}

/********************
*
* message
* - function to display message
*
********************/
function message(title,msg,w,h) {
	blur();
    a = document.createElement('div');
    a.id = 'dsp_message';
    a.style.position = 'absolute';
    a.style.left = parseInt((client.windowWidth() / 2) - (w/2)) + 'px';
    a.style.top = parseInt((client.windowHeight() / 2) - (h/2)) + 'px';
    a.style.width = w + 'px';    
    a.style.height = h + 'px';
    a.style.padding = '2px';
    a.style.textAlign = 'center';
    a.style.zIndex = 2001;

    b = document.createElement('h1');
    b.style.padding = '2px';
    b.style.textAlign = 'left';
    b.innerHTML = title + '<span class="btn15_red" style="left: ' + parseInt(w - 16) + 'px;" onmouseover="btnChange(this,\'hover\')" onmouseout="btnChange(this,\'regular\')" onmousedown="btnChange(this,\'click\')" onmouseup="btnChange(this,\'regular\')" onclick="closeMessage();">X</span>';
    a.appendChild(b);
    
    c = document.createElement('div');
    c.id = 'dsp_text';
    c.style.textAlign = 'left';
    c.style.overflow = 'auto';
    c.style.width = parseInt(w-6) + 'px';
    c.style.marginLeft = '5px';
    c.style.height = parseInt(h-30) + 'px';
    c.style.marginTop = '5px';
    c.style.fontSize = '9pt';
    c.innerHTML = msg;
    
    //d = document.createTextNode(msg);
    //c.appendChild(d);
    a.appendChild(c);

    document.body.appendChild(a);
}

function closeMessage() {
    document.body.removeChild(document.getElementById('dsp_message'));
    unBlur(); 
}

