function onloadinner(){
    _tmpheight = getBrowserHeight()-250;
    $('#iframe').height(_tmpheight);
}

function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

function finishPage() {
    $('#mainni').appendTo($('#mainni1'));
    $('#mainni').addClass('rightbanners');
    $('#mainni').css("display","block");

    $('#topnewssrc').appendTo($('#topnews'));
    $('#topnewssrc').css("display","block");
    $('#topnewssrc').css("padding","15px 0");
    $('#topnewssrc').css("text-align","center");
    $(document).ready(function() {
        $('#preloader').hide();
        $('#content_box').show();
        _cur = location.pathname + location.search;
        _foundmenu = false;
        i=0;
        _cur2 = _cur;
        while (!_foundmenu && i<5 ) {
            i++;
            $("#navigation li a").each(function(){
                if($(this).attr('href').toLowerCase()==_cur2.toLowerCase()) {
                    $(this).addClass('selected');
                    $(this).parents('ul').show();
                    $(this).parent().children('ul:first').show();
                    $(this).parents().children('.expandable-hitarea').addClass('collapsable-hitarea');
                    $(this).parents().children('.expandable-hitarea').removeClass('expandable-hitarea');
                    _foundmenu = true;
                }
            });
            _cur2 = _cur2.substr(0, _cur2.lastIndexOf('/'));
        }
        $('.expandable-hitarea').toggle(
            function(){
                $(this).removeClass('expandable-hitarea');
                $(this).addClass('collapsable-hitarea');
                $(this).parent().children('ul:first').show();
                $(this).parent().parent().children('ul:first').hide();
            },
            function(){
                $(this).removeClass('collapsable-hitarea');
                $(this).addClass('expandable-hitarea');
                $(this).parent().children('ul:first').hide();
        });
        $('.collapsable-hitarea').toggle(
            function(){
                $(this).addClass('expandable-hitarea');
                $(this).removeClass('collapsable-hitarea');
                $(this).parent().children('ul:first').hide();
            },
            function(){
                $(this).addClass('collapsable-hitarea');
                $(this).removeClass('expandable-hitarea');
                $(this).parent().children('ul:first').show();
                $(this).parent().parent().children('ul:first').hide();
        });
    });
}

function getBrowserHeight()
{
     if (window.innerHeight)
     {
          return window.innerHeight;
     }
     else if (document.documentElement && document.documentElement.clientHeight != 0)
     {
          return document.documentElement.clientHeight;
     }
     else if (document.body)
     {
          return document.body.clientHeight;
     }
     return 0;
}

  cm=null
  hide_delay=10
  tstat=0

   function show(el, m){

        if (cm!=null) {
            switchDiv(cm,false)
        }
        var newLayer=null;
 	if (m!=null) {
 		newLayer=document.getElementById(m)
 		newLayer.style.left = getProperty(el,"Left")+"px"
 		newLayer.style.top =  getProperty(el,"Top")+el.offsetHeight+"px"

 		var insideTable=null
 		insideTable = document.getElementById(m+"Table")
 		insideTable.width = el.offsetWidth+"px"
                 switchDiv(newLayer,true)
 		cm=newLayer
 	}
    }//end of show(el, m)

  function switchDiv(objElement,bolVisible){
      if(!bolVisible){
         objElement.style.display = "none"
      } else {
        objElement.style.display = ""
      }
   return 1;
  }


  function hideAllBugs(){
	document.getElementById('submenuNewStand').style.display = "none";
	document.getElementById('submenuPressCenter').style.display = "none";
	document.getElementById('submenuNotif').style.display = "none";
	document.getElementById('submenuSAndC').style.display = "none";
  }

  function getProperty(el,sProp) {
	var iPos = 0;
	while (el!=null) {
		iPos+=el["offset" + sProp]
		el = el.offsetParent
	}
	return iPos
  }

  function hidemenu() {
  timer1=setTimeout("show(null,null)",hide_delay);
  tstat=1;
  return 1;
 }

 function cancelhide() {
   if (tstat==1) {
     clearTimeout(timer1);
     tstat=0;
    }
  return 1;
}

function setSearchAction(_area) {
    if (_area=='1') {
        _src = document.getElementById("formaction1").innerHTML;
    }
    if (_area=='2') {
        _src = document.getElementById("formaction2").innerHTML;
    }
    document.forms['searchform'].action = _src;
    return true;
}
