/* -------------------------------------------------------------------------------------------------
      JavaScript Functions
      www.essence.at
                                                                                                    */

function getUrl(url)
{
    document.location.href = url;
}

function getMail(name,domain,country,text)
{
    document.write('<a class="mail" href="mailto:'+name+'&#x40;'+domain+'&#x2e;'+country+'">'+text+'</a>');
}

function singleFlip(span_id)
{
    display = ( document.getElementById( span_id ).className == 'hide' ) ? 'show' : 'hide';
    document.getElementById( span_id ).className = display;
    return false;
}

function setField(field,text)
{
    if(field.value=="") field.value = text;
}

function unsetField(field,text)
{
    if(field.value==text) field.value = "";
}

function getPopup(url)
{
    var newWidth = 700;
    var newHeight = 600;

    if(newWidth+200>screen.width) { newWidth = screen.width-200; }
    if(newHeight+300>screen.height) { newHeight = screen.height-300; }

    var left = (screen.width - newWidth) / 2;
    var top = (screen.height - newHeight) / 2 - 50;

    popUpWin = window.open(url, 'popUpWin', 'status=1,toolbar=1,location=1,scrollbars=1,menubar=0,resizable=1,width=' + newWidth + ',height=' + newHeight + ',left=' + left + ',top=' + top);
    popUpWin.focus();

    return false;
}

function getPic(picId,show)
{
    var newWidth = 400;
    var newHeight = 220;

    var left = (screen.width - newWidth) / 2;
    var top = (screen.height - newHeight) / 2;

    popUpWin = window.open(root + 'image/id/' + picId + ((show!=undefined && show!='') ? '/show/' + show : '') + '/', 'popUpImg', 'status=1,toolbar=0,location=1,scrollbars=1,menubar=0,resizable=1,width=' + newWidth + ',height=' + newHeight + ',left=' + left + ',top=' + top);
    popUpWin.focus();

    return false;
}

function getImage(file,info)
{
    var newWidth = 400;
    var newHeight = 220;

    var left = (screen.width - newWidth) / 2;
    var top = (screen.height - newHeight) / 2;

    popUpWin = window.open(root + 'image/file/' + file + ((info!=undefined && info!='') ? '/info/' + info : '') + '/', 'popUpImg', 'status=1,toolbar=0,location=1,scrollbars=1,menubar=0,resizable=1,width=' + newWidth + ',height=' + newHeight + ',left=' + left + ',top=' + top);
    popUpWin.focus();

    return false;
}

function changeWindow(newWidth,newHeight)
{
    newWidth += 29;
    newHeight += 93;

    if(newWidth+200>screen.width) { newWidth = screen.width-200; }
    if(newHeight+200>screen.height) { newHeight = screen.height-200; }

    var left = (screen.width - newWidth) / 2;
    var top = (screen.height - newHeight) / 2 - 20;

    self.moveTo(left,top);
    self.resizeTo(newWidth,newHeight);
    self.focus();
}


