function addLoadEvent(func) {

    var oldonload = window.onload;

    if (typeof window.onload != 'function') {

        window.onload = func;

    }

    else {

        window.onload = function() {

            if (oldonload) {

                oldonload();

            }

            func();

        }

    }

}

var timer=new Array();
		var browser = navigator.appName;
		var ver=0;
		if(browser=="Netscape" || browser=="Opera")
			ver=1;
		function scroller(asd,updown,aaa){
			var thediv=document.getElementById(asd);
			if(updown==1){
				var thehight=thediv.childNodes[ver].offsetHeight-parseInt(thediv.style.height);
				if(aaa==1)
					thediv.scrollTop=thehight;
				aaa=0;
				if(thediv.scrollTop==0)
					thediv.scrollTop=thehight;
				thediv.scrollTop=thediv.scrollTop-1;
			}
			else{
				if(aaa==document.getElementById(asd).scrollTop)
					thediv.scrollTop=0;
				aaa=thediv.scrollTop;
				thediv.scrollTop=thediv.scrollTop+1;
			}
				timer[asd]=setTimeout("scroller('"+asd+"',"+updown+","+aaa+")",40);
		}
		function stopscroller(asd2){
					clearTimeout(timer[asd2]);
		}
		


function resizeSite()
{
	var myWidth = (window.innerWidth) ? window.innerWidth :document.documentElement.clientWidth;
	var myHeight = (window.innerHeight) ? window.innerHeight : document.documentElement.clientHeight;
	
	var top = (myHeight-600)/2;
	document.getElementById("wrap").style.top = top+"px";
}

   
function openMenu(id)
{
	var menu = document.getElementById("submenu_"+id);
	
	if (menu.style.display == '')
		menu.style.display = 'none';
	else
		menu.style.display = '';
}

var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#jsddm > li').bind('mouseover', jsddm_open)
   $('#jsddm > li').bind('mouseout',  jsddm_timer)});

document.onclick = jsddm_close;


function show_info(id)
{
	for (i = 1 ; i <= 4 ; i++)
		document.getElementById("info"+i).style.display = 'none';
	
	document.getElementById("info"+id).style.display = '';
	$('.info').jScrollPane({showArrows: true});
}

$(document).ready(function(){
	$('.tooltip').tooltip({width: "200px",bordercolor: "#cccce1", fontsize: '12px', fontcolor: '#000000'});
});
