// Misc Functions
// 2009 Burchia Rolf


// Shortcut ID
function $(id) { 
    return document.getElementById(id); 
} 
function $$(id) { 
    return document.getElementsByName(id); 
} 
// Dummy-Function
function bu_f_dummyfunction()
{
}
// Externer Link
function bu_f_externallink(Adresse) {
  bu_NewBrowserWindow = window.open(Adresse, "_blank");
  bu_NewBrowserWindow.focus();
}
// Bitmap Over
function bu_f_bitmap_over(id)
{
	bu_g_overout_file = id.src;	
    if(bu_g_overout_file.search(bu_g_currentMenuSelectionString)==-1) id.src = id.src.substr(0,id.src.length-4)+"_over.png";
}
// Bitmap Out
function bu_f_bitmap_out(id)
{
	if(bu_g_overout_file.search(bu_g_currentMenuSelectionString)==-1) id.src = bu_g_overout_file;
}
// Link Over
function bu_f_link_over(id)
{
	bu_g_overout_color = id.style.color;
	id.style.color = "RGB(204,0,0)";
}
// Link Out
function bu_f_link_out(id)
{
	id.style.color = bu_g_overout_color;
}
// Button Over
function bu_f_button_over(id)
{
	bu_g_overout_color = id.style.color;
	id.style.color = "RGB(204,0,0)";
}
// Link Out
function bu_f_button_out(id)
{
	id.style.color = bu_g_overout_color;
}
// Widget on/off
function bu_f_widget_onoff(id)
{
	if($(id).style.display!="none")
    {
    		$(id).style.display = "none";
    }
    else
    {
    		$(id).style.display = "block";
    }	
}

// Get Scrollpos
function bu_f_pageYOffset()
{
if(!window.pageYOffset)
    {
 		 var ypos=document.documentElement.scrollTop+70;
    }
    else
    {
    	 var ypos = window.pageYOffset+70;
    }    
return(ypos);
}

// Cursor Position and Mouse Events




// Load dynamic content
function bu_f_getContent(sel)
{
	var myAjax = new Ajax();
  	myAjax.url="main.php";
    myAjax.data="select="+sel;
    myAjax.onSuccess=bu_f_getContent_successHandler;
    myAjax.doRequest();
}
function bu_f_getContent_successHandler(txt,xml)
{
	var txtpart = txt.split("BU_DL0");
    if(txtpart!="")
    {
    var codestring = txtpart[1].replace("/\n/","");
    eval(codestring);
    }
}

// Check for changed hash anchor 
function bu_f_checkAnchor(){   
    if(bu_g_currentAnchor != window.location.hash) {  
        bu_g_currentAnchor = window.location.hash;  
        if(bu_g_currentAnchor!="#inside")
        {      
        	if(!bu_g_currentAnchor) 
        	{ 
            	window.location.hash = "#news";
       	}
        	else  
        	{    
        		var splits = bu_g_currentAnchor.substring(1).split('&');   
    			var selector = splits[0];
            	var section = splits[0]+".php"; 
            	delete splits[0];  
            	var params = splits.join('&');
            	var query = section + params;
                  if(bu_g_menustrings.search(bu_g_currentMenuSelectionString)!=-1) $("w_nav_bitmap_"+bu_g_currentMenuSelectionString).src = "img/mila_menubutton_"+bu_g_currentMenuSelectionString+".png";
	              bu_g_currentMenuSelectionString = selector;
                  if($("w_nav_bitmap_"+selector))
            	{             
            		$("w_nav_bitmap_"+bu_g_currentMenuSelectionString).src = "img/mila_menubutton_"+bu_g_currentMenuSelectionString+"_selected.png";
            	}           
        	}
        	bu_f_getContent(query);
        }
        else
        {
        	if($("w_nav_bitmap_"+bu_g_currentMenuSelectionString))
            {
            $("w_nav_bitmap_"+bu_g_currentMenuSelectionString).src = "img/mila_menubutton_"+bu_g_currentMenuSelectionString+".png";
        	};
            bu_g_currentMenuSelectionString = "inside";
            $("w_list").style.display = "none";
        }
    }  
}  


