function langChange(){
	var formular = GetObj('langform');
	formular.submit();
}

function hideElement(el){
    var ele = GetObj(el);
    ele.style.display = 'none';
}

function showElement(el){
    var ele = GetObj(el);
    ele.style.display = 'block';
}

function toggleElement(el){
    var ele = GetObj(el);
    if (ele.style.display=='none')
    {
        ele.style.display = 'block';
    } else {
        ele.style.display = 'none';
    }
}

function refreshBottomBar(){
	//for IE
	var bottom = document.getElementById('bottom');
	bottom.style.display='none';
	bottom.style.display='block';


}

function changePic(el,path,largePath,largeWidth,largeHeight){
    var html = '';
    if(largePath) html += '<a href="/'+largePath+'" onclick="openPic(this.href, \'\', '+largeWidth+', '+largeHeight+'); return(false);">';
    html += '<img src="'+path+'" />';
    if(largePath) html += '<img src="/images/plus.gif" class="plus" alt="" width="10" height="10" />'
    if(largePath) html += '</a>';
    document.getElementById(el).innerHTML = html;
}

function changeText(el,txt){
  	ele = GetObj(el);
	ele.innerHTML=txt;
}

function GetObj(name){
  obj = document.getElementById(name);
  if (!obj){
    obj = document.getElementsByName(name)[0];
  }
  return obj;
}


var currentPic = null;
function closePic()
{
    if(currentPic) {
        currentPic.onclick();
    }
}
function openPic(href, text, width, height)
{
    if(!document.createElement) return(true);

    if(currentPic) {
        currentPic.onclick();
    }

    if(text!="") var textHeight = 30; else textHeight = 0;

    var div = document.createElement('div');
    if(!div) return(true);

    var x,y;
    if (window.innerHeight) // all except Explorer
    {
      x = window.innerWidth;
      y = window.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight)
      // Explorer 6 Strict Mode
    {
      x = document.documentElement.clientWidth;
      y = document.documentElement.clientHeight;
    }
    else if (document.body) // other Explorers
    {
      x = document.body.clientWidth;
      y = document.body.clientHeight;
    }

    y = ((y-height)/2);
    x = ((x-width)/2);

    if( typeof( window.pageYOffset ) == 'number' ) {
        //Netscape compliant
        y += window.pageYOffset;
        x += window.pageXOffset;
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        //DOM compliant
        y += document.body.scrollTop;
        x += document.body.scrollLeft;
    } else if( document.documentElement &&
        ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        //IE6 standards compliant mode
        y += document.documentElement.scrollTop;
        x += document.documentElement.scrollLeft;
    }

    div.style.top = (y+10) + "px";
    div.style.left = (x-10) + "px";
    div.style.width = (width+20)+"px";
    div.style.height = (height+20+textHeight)+"px";
    div.className = "popupPic";
    div.onclick = function() {
      this.parentNode.removeChild(this);
      currentPic = null;
    }
    var border = document.createElement('div');
    border.className = "border";
    border.style.width = width+"px";
    border.style.height = (height+textHeight)+"px";
    div.appendChild(border);


    var img = document.createElement('img');
    img.height = height;
    img.width = width;
    img.src = href;
    div.appendChild(img);

    var divLoading = document.createElement('div');
    divLoading.className = "loading";
    divLoading.style.width = width+"px";
    divLoading.style.height = height+"px";
    var p = document.createElement('p');
    p.appendChild(document.createTextNode('loading...'));
    divLoading.appendChild(p);
    div.appendChild(divLoading);

    if(text!='') {
        var divText = document.createElement('div');
        divText.style.top = (height+10)+"px";
        divText.style.width = width+"px";
        divText.style.height = textHeight+"px";
        divText.className = "text";
        p = document.createElement('p');
        p.appendChild(document.createTextNode(text));
        divText.appendChild(p);
        div.appendChild(divText);
    }

    var aClose = document.createElement('a');
    var imgClose = document.createElement('img')
    imgClose.src = "/images/close.gif";
    imgClose.height = imgClose.width = 15;
    aClose.appendChild(imgClose);
    aClose.href = "javascript:closePic()";
    aClose.className = "close";
    aClose.style.left = (width-15)+"px"
    div.appendChild(aClose);

    document.body.appendChild(div);

    currentPic = div;

    return(false);
}
