function RemoveScrollBars()
{
	if(document.body.scroll != null)
	{
		document.body.scroll = "auto";
		document.body.style.overflowX = "hidden"; // hidden | scroll | auto
		document.body.style.overflowY = "auto";
	}
	else // #### MG: It's a different Browser (NN)
	{
		document.body.attributes("-moz-scrollbars-horizontal") = "scroll";
		document.body.attributes("-moz-scrollbars-vertical") = "no";
	}
}

function OpenCustomPopUpApp(base, url, width, height, resizable, location, menubar, scrollbars, status, titlebar, toolbar, undesigned)
{
    //alert("base: " + base);
    
	var basePage = "PopupDesigned.aspx";
	var scrolling = scrollbars;
	scrollbars = false;
		
	
	if(undesigned == null)
	{
		undesigned = false;
	}
	
	if(undesigned)
	{
		basePage = "PopupUndesigned.aspx";
	}
	
	var path = base + basePage + "?url=" + escape(url) + "&height=" + height + "&undesigned=" + undesigned + "&scrollbars=" + scrolling;
	
	//path = "http://localhost:3950/WebUI/" + path;
	//alert("path: " + path);
	var options = "width=" + width + ", height=" + height + ", resizable=" + (resizable ? 1 : 0) + ", location=" + (location ? 1 : 0) + ", menubar=" + (menubar ? 1 : 0) + ", scrollbars=" + (scrollbars ? 1 : 0) + ", status=" + (status ? 1 : 0) + ", titlebar=" + (titlebar ? 1 : 0) + ", toolbar=" + (toolbar ? 1 : 0);
	var win = window.open(path, "PopUp", options);
	
	if(win != null)
	{
		win.focus();
	}
}

function JumpTo(obj)
{
	obj.scrollIntoView();
}

function JumpToControl(controlName)
{
	document.getElementById(controlName).scrollIntoView();
}

function Druckansicht(url)
{
	//var win = window.open("Apps/PopUps/Framework.aspx?pfv=true&url=" + escape(url), "Druckansicht", "toolbar=no, width=632, height=700, directories=no, status=no, scrollbars=no, resizable=no, menubar=no");
	//win.focus();
	self.print();
}

function Redaktion(pageID)
{
	var win = window.open("Apps/PopUps/Framework.aspx?url=" + escape("Editorial.aspx?id=" + pageID), "Redaktion", "toolbar=no, width=400, height=300, directories=no, status=no, scrollbars=no, resizable=no, menubar=no");
	win.focus();
}

function TextBoxSearch_KeyDown(sender, searchButtonClientID)
{
	if(event.keyCode == 13)
	{
		var button = document.getElementById(searchButtonClientID);
		
		if(button != null)
		{
			button.focus();
			button.click();
		}
		
		return false;
	}
}
//#### AT-search focus

function TextBoxSearch_Focus(TextBoxSearch)
{  
    if(TextBoxSearch.value == "")  
     {    TextBoxSearch.value = "";     }
}
function TextBoxSearch_Blur(TextBoxSearch)
{   
    if(TextBoxSearch.value == "")  
        {    TextBoxSearch.value = "";     }      
}

//#######################################  AT for text size change 
function ChangeFontSize(x)
{
     var linkA1 = document.getElementById('LinkFontsize1');
     var linkA2 = document.getElementById('LinkFontsize2');
     var linkA3 = document.getElementById('LinkFontsize3');
    
    switch(x)
    {
        case 1: 
            document.body.style.fontSize = '0.75em'; 
            if(linkA1 != null && linkA2 != null && linkA3 != null)
            {          
                linkA1.style.color = "white";
                linkA2.style.color = "#840201";
                linkA3.style.color = "#840201";            
            }
            setCookie("fontSize", 1, 5);   
            break;
        case 2: 
            document.body.style.fontSize = '0.9em'; 
            if(linkA1 != null && linkA2 != null && linkA3 != null)
            { 
                linkA1.style.color = "#840201";
                linkA2.style.color = "white";
                linkA3.style.color = "#840201"; 
            }
            setCookie("fontSize", 2, 5);  
            break; 
        case 3: 
            document.body.style.fontSize = '1em';
            if(linkA1 != null && linkA2 != null && linkA3 != null)
            {
                linkA1.style.color = "#840201";
                linkA2.style.color = "#840201";
                linkA3.style.color = "white";
            }
            setCookie("fontSize", 3, 5);   
            break;                
        default: alert("Error 345546"); break;     
    }          
    
}

function SetDefaultFontSize()
{
    var size;
    size=getCookie("fontSize");    
    //alert("z ciacha: " + size);        
    switch (size)
    {
        case '1': ChangeFontSize(1); break;
        case '2': ChangeFontSize(2); break;
        case '3': ChangeFontSize(3); break;
        default: ChangeFontSize(1); break; 
    }
    
}



//##############

function setCookie(name,value,days,path,domain,secure) {
  var expires, date;
  if (typeof days == "number") {
    date = new Date();
    date.setTime( date.getTime() + (days*24*60*60*1000) );
		expires = date.toGMTString();		
  }
  document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function getCookie(name) {
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) {
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
  }
  return null;
} 