
var d, dom, ie, ie4, ie5x, moz, mac, win, lin, old, ie5mac, ie5xwin, op, ie7;

d = document;
n = navigator;
na = n.appVersion;
nua = n.userAgent;
win = ( na.indexOf( 'Win' ) != -1 );
mac = ( na.indexOf( 'Mac' ) != -1 );
lin = ( nua.indexOf( 'Linux' ) != -1 );

if ( !d.layers ){
	dom = ( d.getElementById );
	op = ( nua.indexOf( 'Opera' ) != -1 );
	konq = ( nua.indexOf( 'Konqueror' ) != -1 );
	saf = ( nua.indexOf( 'Safari' ) != -1 );
	moz = ( nua.indexOf( 'Gecko' ) != -1 && !saf && !konq);
	ie = ( d.all && !op );
	ie4 = ( ie && !dom );

	/*
	ie5x tests only for functionality. ( dom||ie5x ) would be default settings. 
	Opera will register true in this test if set to identify as IE 5
	*/

	ie5x = ( d.all && dom );
	ie5mac = ( mac && ie5x );
	ie5xwin = ( win && ie5x );

	ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;

}



	
function submenu(id)
{
	if(document.getElementById(id).style.visibility=="visible")
	{
		document.getElementById(id).style.visibility="hidden";
	}
	else
	{
		document.getElementById(id).style.visibility="visible";
	}
}



var expDate = new Date();
expDate.setTime(expDate.getTime()+365*24*60*60*1000); 

var prevCSS = "";

function getCookie(isName){
 		
	cookieStr = document.cookie;
	startSlice = cookieStr.indexOf(isName+"=");
	if (startSlice == -1){return false}
	endSlice = cookieStr.indexOf(";",startSlice+1)
	if (endSlice == -1){endSlice = cookieStr.length}
	isData = cookieStr.substring(startSlice,endSlice)
	isValue = isData.substring(isData.indexOf("=")+1,isData.length);
	return isValue;
}

function setCookie(isName,isValue,dExpires){
      
	document.cookie = isName+"="+isValue+";expires="+dExpires.toGMTString();
}

function swapCSS(currCSS){
	
	if (prevCSS != ""){document.styleSheets[prevCSS].disabled = true}
	document.styleSheets[currCSS].disabled = false;
	prevCSS = currCSS;
	setCookie('CSS',currCSS,expDate)
}

function init(){

	nSheets = document.styleSheets.length;
	
	if( ie && !ie7 ){firstsheet = 3}else{firstsheet = 2}
	
	for (i=firstsheet; i<nSheets; i++)
		{document.styleSheets[i].disabled = true}
	if (getCookie('CSS')){swapCSS(getCookie('CSS'))}else{swapCSS(firstsheet)}
}

function textresize(incval){
	nSheets = document.styleSheets.length-firstsheet;
	newSheet = getCookie('CSS'); 
	if(incval=='up' && newSheet < nSheets){
		newSheet++;
	}
	if(incval=='down' && newSheet > firstsheet){
		newSheet--;
	}
	swapCSS(newSheet);
}

function browser_css() {
	d = document;// shorthand so we don't have to write out document each time..
	if ( saf ) {
	//alert('safari!!');
		d.write("<style type='text/css'>@import url('fileadmin/templates/szd/main/css/style_szd1.css');@importurl('css/style_szd1.css');#fontgr_item {display:none;}#fontgr_item a:visited {display:none;}#fontgr_item a:hover {display:none;}#fontgr_item2 {display:none;}</style>");
	}
}


init();
//browser_css();

