//**********************************
// 2005.04.11. 16:33:32
// ha van megadva beállítja a stílist, visszaadja az előzőt.
function currentStyle( win, stylename, fullpath )
{
	var styles = [ "_publikus", "_admin_megoldas", "_admin" ];
	var prevstyle = '';
	links = win.document.getElementsByTagName("link");
	for( i = 0; links[i]; i++ )
	{
		var lnk = links[i];
		if( lnk.getAttribute('rel').indexOf('style') != -1 &&
			( lnk.getAttribute('media') == null || lnk.getAttribute('media') == "" || 
			 lnk.getAttribute('media').indexOf('screen') != -1 ) )
		{
			for( var st = 0; st < styles.length; st++ )
			{
				var sttypepos = lnk.getAttribute('href' ).indexOf( styles[ st ] );
				if( sttypepos != -1 && ( lnk.getAttribute('href' ).substr( sttypepos ) == ( styles[ st ] + ".css" ) ) )
				{
//					alert( sttypepos + " styletype: " + lnk.getAttribute('href' ).substr( sttypepos ) + " " + styles[ st ] + ".css" );
					csspos = lnk.getAttribute('href' ).indexOf( "css/" );
					prevstyle = lnk.getAttribute('href' ).substr( csspos + 4 );
					prevstyle = prevstyle.replace( new RegExp( styles[ st ] + '\.css' ), "" );
//					alert( "prevstyle: " + prevstyle );
					if( stylename )
					{
						var newstyle = 'css/'+ stylename + styles[ st ] + '.css';
//						alert( lnk.getAttribute('href' ) + " => " + newstyle );
						lnk.setAttribute('href', newstyle );
						Cookie.set( "currentcssgroup", stylename );
					}
				}
			}
    	}
	}
	return prevstyle;
}

function switchcss( sel )
{
	var style = selectctrlobj_value( sel );
	var cs = currentStyle( this, style );
	document.forms['cssswitch'].submit();
}
