// Funzioni per nascondere o rimettere a posto i div (questa, ad esempio, sarebbe compatibile con IE4)

function mostra(oggetto) {
	if (document.getElementById) {document.getElementById(oggetto).style.display = ''}
	else if (document.all) {document.all[oggetto].style.display = ''}
}

function nascondi(oggetto) {
	if (document.getElementById) {document.getElementById(oggetto).style.display = 'none'}
	else if (document.all) {document.all[oggetto].style.display = 'none'}
}



// Funzione che regola il pulsante di on/off dei video
// (in alto a sinistra, il televisorino simpatico)
// In pratica, serve per nascondere una classe del foglio di stile al clic del mouse
// Non funziona su chrome

document.write('<link type="text/css" rel="alternate stylesheet" href="http://www.marok.org/Buco/themes/vanilla/styles/marok/video_on.css" title="video_on">');
document.write('<link type="text/css" rel="alternate stylesheet" href="http://www.marok.org/Buco/themes/vanilla/styles/marok/video_off.css" title="video_off">');

function cambia_stile_video(lo_stracazzo_di_stile_che_vuoi) {
var ss = document.styleSheets; // Abbreviazione
for (var x=0; x < ss.length; x++) {
// disabilita tutti i fogli di stile con un titolo che inizia per 'video'
if(ss[x].title.indexOf("video")==0) {ss[x].disabled=true}
// ...tranne quello passato per argomento alla funzione
if(ss[x].title == lo_stracazzo_di_stile_che_vuoi) {ss[x].disabled=false}}};

// Oltre a visualizzare/nascondere il televisore acceso/spento, scrive nei cookie video=2 per spento e video=3 per acceso

function video_onoff()
{
document.write('<a href="#" onclick="nascondi(\'video_on\'); mostra(\'video_off\'); cambia_stile_video(\'video_off\'); document.cookie=\'video=2\'; return false"><img src="http://www.marok.org/Buco/themes/vanilla/styles/marok/video_on.png" width=36 height=36 id="video_on" style="border:none; float:right" alt="Spegni i video ora!" title="Spegni i video ora!"></a>');
document.write('<a href="#" onclick="nascondi(\'video_off\'); mostra(\'video_on\'); cambia_stile_video(\'video_on\'); document.cookie=\'video=3\'; return false"><img src="http://www.marok.org/Buco/themes/vanilla/styles/marok/video_off.png" width=36 height=36 id="video_off" style="border:none; float:right" alt="Accendi i video" title="Accendi i video"></a>');
nascondi('video_off');
};

function lettura_cookie() {
// LETTURA COOKIE
// Non funziona su tutti i browser... fatevene una ragione.
// Non chiedetemi perche', ma se non c'e' all'inizio del cookie una lunga stringa di testo, non va un cazzo.

document.cookie='supercalifragilistichespiralidoso'; 

var allck=document.cookie;
var iniziovideo= allck.indexOf("video=");
iniziovideo=iniziovideo+6;
var finevideo= iniziovideo+1;
if (finevideo== -1) finevideo= allck.length;
var tipovideo = allck.substring(iniziovideo,finevideo);
if (!tipovideo) {tipovideo=3};					// default su acceso

if (tipovideo==2) {nascondi('video_on'); mostra('video_off'); cambia_stile_video('video_off');} 	// spento
else {nascondi('video_off'); mostra('video_on'); cambia_stile_video('video_on');}	 		// acceso
}





// correzioni al foglio di stile per browser handicappati

var percorso='http://www.marok.org/Buco/themes/vanilla/styles/marok/';

// Explorer e Opera -- forse si puo' eliminare (risolto in altro modo)

if (window.opera||document.all) {var pospuls="2"} else {var pospuls="-6"};

// Explorer -- forse si puo' eliminare (risolto in altro modo)

if (document.all && !window.opera) {
	document.write('<style type="text/css">');
	document.write('.User.Name {overflow: visible !important; overflow-x:hidden}');
	document.write('ul.fdtablePaginater, ul.fdtablePaginater *, ul.fdtablePaginater * *, ul.fdtablePaginater * * * {background:#eef0ff !important; border:1px solid black; margin:0px; padding:0px; border:none !important; display:inline !important; font-size:12px; text-align:center}');
	document.write('ul.fdtablePaginater {display:block; width:100px !important; height:20px !important; text-align:left; border:1px dashed black !important; margin-top:10px !important; margin-bottom:20px !important; float:right; text-align:right}');	
	document.write('</style>');
	};
	
// Explorer 4 -- riassegna la posizione agli oggetti usando le tabelle

if (document.all&&!document.getElementById) {
	document.write('<style type="text/css">');
	var session_left=screen.width-320;
	document.write('#Header h1 {line-height:60px}');
	document.write('#Header ul, #Header ul *, #Header ul * * {line-height:10px; font-size:10px; padding:0; margin:0}');
	document.write('#Header ul {text-align:left; background:url(\'http://www.marok.org/Buco/themes/vanilla/styles/marok/bg_header_ul_ie4.png\') left top no-repeat; border:none; color:black; margin:20px !important; padding:0 !important}');
	document.write('#Header ul li.TabOn {background:transparent !important}');
	document.write('#Header ul li a {background:transparent !important}');
	document.write('#Header ul li a:hover {background:yellow !important}');
	document.write('#Panel h1 {padding:20px}');
	document.write('#Panel ul {padding:5px}');
	document.write('#RicercaVeloce {display:none}');
	document.write('#Session {left:'+session_left+'px; padding:3px;}');
	var larghezza_tabella = screen.width-320;
	if (larghezza_tabella>730) {larghezza_tabella=730};
	var larghezza_content = larghezza_tabella;
	document.write('#Content {width:'+larghezza_content+'px; margin-top:180px}');
	document.write('#ContentBody, #memberscontainer {width:'+larghezza_tabella+'px}');	
	document.write('h1 {color:black !important; font-size:12px !important}');
	document.write('.PageInfo, .Bottom {display:none}');
	document.write('.CommentHeader ul, .CommentHeader ul li, .CommentHeader span {background:transparent !important; text-align:left; margin:0px; padding:0px; line-height:20px}');
	document.write('.CommentIcon {width:64px; height:64px; padding-top:5px !important; padding-bottom:0px !important; float:left !important}');
	document.write('</style>');
	};

// Explorer 5 -- riassegna la posizione agli oggetti usando le tabelle
	
if (document.all && !window.opera && navigator.userAgent.indexOf('MSIE 5')>0) {
	document.write('<style type="text/css">');
	document.write('.DiscussionTopic {overflow: visible !important; overflow-x:hidden}');
	var larghezza_tabella = screen.width-320;
	if (larghezza_tabella>730) {larghezza_tabella=730};
	var margine_destro_content = screen.width-130-larghezza_tabella;
	document.write('#Content {margin-right:'+margine_destro_content+'px !important}');
	document.write('#ContentBody, #memberscontainer {width:'+larghezza_tabella+'px}');
	document.write('.DiscussionStarted, .DiscussionComments, .DiscussionLastComment, .DiscussionActive, .DiscussionNew {height:10px !important}');
	document.write('</style>');
	};

// Supplemento per Explorer 5.0 -- corregge vari errori di visualizzazione, tra cui l'avatar

if (document.all && !window.opera && navigator.userAgent.indexOf('MSIE 5')>0 && navigator.userAgent.indexOf('MSIE 5.5')<1) {
	document.write('<style type="text/css">');	
	document.write('.CommentIcon {width:64px !important; height:64px !important; background-position:left top !important; overflow:hidden; vertical-align:top}');
	document.write('.DiscussionType {display:none}');	
	document.write('#Header ul li a {border:1px solid black; padding:3px; margin-left:5px; width:1px}');
	document.write('#Panel ul {padding-top:10px}');
	document.write('.statistike  {padding-top:10px !important}');
	document.write('.inut {padding-top:0px !important}');
	document.write('</style>');
	};

// Explorer 6 -- corregge la scomparsa delle lettere nei titoli
	
if (document.all && !window.opera && navigator.userAgent.indexOf('MSIE 6')>0) {
	document.write('<style type="text/css">');	
	document.write('.DiscussionTopic {overflow: visible !important; overflow-x:hidden}');	
	document.write('</style>');
	};
	
// Explorer 7 e 8 -- corregge la scomparsa delle lettere nei titoli ed altri bachi minori
	
if (document.all && !window.opera && navigator.userAgent.indexOf('MSIE 7')>0) {
	document.write('<style type="text/css">');	
	document.write('.DiscussionTopic {line-height:26px}');	
	document.write('.Top h1 {text-align:right !important}');
//	document.write('.Bottom {visibility:hidden}');
	document.write('.PageInfo p {visibility:hidden}');
	document.write('</style>');
	};	


// Opera 5 e 6: correzione per vedere gli avatar
// NB: sul 6 ogni tanto si vedono le icone facendo refresh

if
	(window.opera &&
	(navigator.userAgent.toLowerCase().indexOf('pera 5')>0 ||
	navigator.userAgent.toLowerCase().indexOf('pera/5')>0 ||
	navigator.userAgent.toLowerCase().indexOf('pera/6')>0 || 
	navigator.userAgent.toLowerCase().indexOf('pera 6')>0))
	{
	document.write('<style>');	
	document.write('.CommentHeader {margin-top:10px; margin-bottom:60px}');
	document.write('.CommentHeader ul, .CommentHeader ul li, .CommentHeader span {text-align:left; line-height:20px}');
	document.write('.CommentIcon {width:64px; height:64px; padding-top:5px !important; padding-bottom:0px !important; float:left !important}');
	document.write('</style>');	
	}

// Opera7 -- baco minore

if
	(window.opera &&
	(navigator.userAgent.toLowerCase().indexOf('pera/7')>0) || 
	(navigator.userAgent.toLowerCase().indexOf('pera 7')>0))
	{document.write('<style>.DiscussionType {float:none !important}</style>')};

// Vecchi Mozilla - precedenti a 1.0

if (
	window.sidebar && 
	(navigator.userAgent.toLowerCase().indexOf('irefox')<1) && 
	(	(navigator.userAgent.toLowerCase().indexOf('1999')>0) || 
		(navigator.userAgent.toLowerCase().indexOf('2000')>0) || 
		(navigator.userAgent.toLowerCase().indexOf('2001')>0) || 
		(navigator.userAgent.toLowerCase().indexOf('2002')>0)
		)) {
	
// Tutti: 
// correzione posizione del #content, che altrimenti parte da zero px e va a finire sotto il titolo	
// correzione posizione dei pulsanti del form di invio messaggio, che altrimenti non funzionano
	
document.write('<style type="text/css">');
document.write('#Content {position:absolute; top:130px; left:235px; right:18px; margin:0px !important}');
document.write('.Submit input {float:none}');
document.write('#CommentBoxController {display:none}');
document.write('</style>');

 
// Tutti i Mozilla precedenti a 0.7 - Correzione avatar sdoppiati e bug minori
// Bug irrisolto: non si vedono le category_icons, perche' non supporta classe di classe.

if (navigator.userAgent.toLowerCase().indexOf('1999')>0 || navigator.userAgent.toLowerCase().indexOf('2000')>0) {
	document.write('<style>');
	document.write('.Bottom {visibility:hidden}');
	document.write('.CommentHeader ul, .CommentHeader ul li, .CommentHeader span {background:transparent !important; text-align:left; margin:0px; padding:0px; line-height:20px}');
	document.write('.CommentIcon {width:64px; height:64px; padding-top:5px !important; padding-bottom:0px !important; float:left !important}');
	document.write('</style>');
 }


// Mozilla 0.5 - Correzione colore di sfondo dei messaggi

if (navigator.userAgent.toLowerCase().indexOf('200010')>0) {
	document.write('<style>');
	document.write('#Comments {background:white}');
	document.write('#Comments li {background:#C8D6EA; border-right:none; border-left:none}');
	document.write('</style>');
 }

// Nota: Mozilla0.8 si pianta - irrisolto
  
// Mozilla 0.9 - png opache, altrimenti le trasparenze diventano di colore nero (?)

if (navigator.userAgent.toLowerCase().indexOf('200105')>0) 
   {document.write('<style>#Header {background: url(\''+percorso+'buco_titolo_opaco.png\') left top no-repeat}')
    document.write('#Panel ul {background: #3E639A url(\''+percorso+'bg_ultimecazzate_opaco.png\') left top no-repeat}');
    document.write('#Panel ul.statistike {background: #3E639A url(\''+percorso+'bg_statistike_opaco.png\') left top no-repeat; border-top:none; padding-top:1px}');
    document.write('#Panel ul.inut {background: #3E639A url(\''+percorso+'bg_inutility_opaco.png\') left top no-repeat; border-top:none; padding-top:1px}'); 
    document.write('#Panel h1 a {background: url(\''+percorso+'bg_panel_h1_opaco.png\') center center no-repeat}'); 
    document.write('#Panel h1 a:hover {background: url(\''+percorso+'bg_panel_h1_hover.png\') center center no-repeat}');
    document.write('#Content {background: #c8d6ea url(\''+percorso+'bg_content_opaco.png\') right top no-repeat}'); 
    document.write('#Discussions li ul {background:#fff url(\''+percorso+'bg_discussions_li_ul_opaco.png\') right top no-repeat}'); 
    document.write('.PageInfo {background:url(\''+percorso+'bg_pageinfo_opaco.png\') right top no-repeat}'); 
    document.write('#RicercaVeloce {background: #39639C url(\'http://www.marok.org/Buco/extensions/LiveSearch/bg_ricerca_opaco.png\') right top no-repeat}'); 
    document.write('</style>');
    }
}

// Netscape 4 -- Ridisegnato l'intero layout

if (document.layers) {
	document.write('<font face=Verdana size=4 color="#ffff00"><blink>Netscape4? MA KAAAAAAAAASTROX!!!</blink></font><br><center><a href="#" onclick="alert(\'Nessuna opzione che abbia un senso &egrave; disponibile su Netscape4\'); return false"><img src="http://www.marok.org/Buco/themes/vanilla/styles/marok/buco_titolo_netscape4.gif" width=452 height=115 border=0 alt="Soka"></a></center>');
	document.write('<style type="text/css">');
	document.write('#Panel, .ContentInfo, #Cal {display:none}');
	document.write('#Session {padding:0px}');
	document.write('#Header {display:none}');
	document.write('#Header h1 {color:white; background:#39639C; height:50px; border:1px solid white}');
	document.write('#Header ul {display:none}');
	document.write('#ContentBody {position:absolute; left:0px; top:200px; width:600px}');
	document.write('#Content {background:white}');
	document.write('.DiscussionType, .DiscussionCategory, .DiscussionStarted, .DiscussionComments, .DiscussionLastComment, .DiscussionActive {display:none; visibility:hidden; visibility:hide; display:hide}');
	document.write('</style>');
}


// Vecchi browser -- messaggio di pieta'

if (!document.getElementById && !document.all && !document.layers) {
	document.write('<font face=Verdana size=2>Sullo skifo di browser che stai usando, sei abilitato in sola lettura... in altre parole, non puoi scrivere un cazzo. Per fortuna.');
}


// ancora explorer
// emulazione di border-radius

/**
* DD_roundies, this adds rounded-corner CSS in standard browsers and VML sublayers in IE that accomplish a similar appearance when comparing said browsers.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_roundies/
* Version: 0.0.2a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_roundies/#license
*
* Usage:
* DD_roundies.addRule('#doc .container', '10px 5px'); // selector and multiple radii
* DD_roundies.addRule('.box', 5, true); // selector, radius, and optional addition of border-radius code for standard browsers.
* 
* Just want the PNG fixing effect for IE6, and don't want to also use the DD_belatedPNG library?  Don't give any additional arguments after the CSS selector.
* DD_roundies.addRule('.your .example img');
**/

if (document.all&&!window.opera&&document.documentMode != 8) {

var DD_roundies = {

	ns: 'DD_roundies',
	
	IE6: false,
	IE7: false,
	IE8: false,
	IEversion: function() {
		if (document.documentMode != 8 && document.namespaces && !document.namespaces[this.ns]) {
			this.IE6 = true;
			this.IE7 = true;
		}
		else if (document.documentMode) {
			this.IE8 = true;
		}
	},
	querySelector: document.querySelectorAll,
	selectorsToProcess: [],
	imgSize: {},
	
	createVmlNameSpace: function() { /* enable VML */
		if (this.IE6 || this.IE7) {
			document.namespaces.add(this.ns, 'urn:schemas-microsoft-com:vml');
		}
		if (this.IE8) {
			document.writeln('<?import namespace="' + this.ns + '" implementation="#default#VML" ?>');
		}
	},
	
	createVmlStyleSheet: function() { /* style VML, enable behaviors */
		/*
			Just in case lots of other developers have added
			lots of other stylesheets using document.createStyleSheet
			and hit the 31-limit mark, let's not use that method!
			further reading: http://msdn.microsoft.com/en-us/library/ms531194(VS.85).aspx
		*/
		var style = document.createElement('style');
		document.documentElement.firstChild.insertBefore(style, document.documentElement.firstChild.firstChild);
		if (style.styleSheet) { /* IE */
			try {
				var styleSheet = style.styleSheet;
				styleSheet.addRule(this.ns + '\\:*', '{behavior:url(#default#VML)}');
				this.styleSheet = styleSheet;
			} catch(err) {}
		}
		else {
			this.styleSheet = style;
		}
	},
	
	
	
	/**
	* Method to use from afar - refer to it whenever.
	* Example for IE only: DD_roundies.addRule('div.boxy_box', '10px 5px');
	* Example for IE, Firefox, and WebKit: DD_roundies.addRule('div.boxy_box', '10px 5px', true);
	* @param {String} selector - REQUIRED - a CSS selector, such as '#doc .container'
	* @param {Integer} radius - REQUIRED - the desired radius for the box corners
	* @param {Boolean} standards - OPTIONAL - true if you also wish to output -moz-border-radius/-webkit-border-radius/border-radius declarations
	**/
	addRule: function(selector, rad, standards) {
		if (typeof rad == 'undefined' || rad === null) {
			rad = 0;
		}
		if (rad.constructor.toString().search('Array') == -1) {
			rad = rad.toString().replace(/[^0-9 ]/g, '').split(' ');
		}
		for (var i=0; i<4; i++) {
			rad[i] = (!rad[i] && rad[i] !== 0) ? rad[Math.max((i-2), 0)] : rad[i];
		}
		if (this.styleSheet) {
			if (this.styleSheet.addRule) { /* IE */
				var selectors = selector.split(','); /* multiple selectors supported, no need for multiple calls to this anymore */
				for (var i=0; i<selectors.length; i++) {
					this.styleSheet.addRule(selectors[i], 'behavior:expression(DD_roundies.roundify.call(this, [' + rad.join(',') + ']))'); /* seems to execute the function without adding it to the stylesheet - interesting... */
				}
			}
			else if (standards) {
				var moz_implementation = rad.join('px ') + 'px';
				this.styleSheet.appendChild(document.createTextNode(selector + ' {border-radius:' + moz_implementation + '; -moz-border-radius:' + moz_implementation + ';}'));
				this.styleSheet.appendChild(document.createTextNode(selector + ' {-webkit-border-top-left-radius:' + rad[0] + 'px ' + rad[0] + 'px; -webkit-border-top-right-radius:' + rad[1] + 'px ' + rad[1] + 'px; -webkit-border-bottom-right-radius:' + rad[2] + 'px ' + rad[2] + 'px; -webkit-border-bottom-left-radius:' + rad[3] + 'px ' + rad[3] + 'px;}'));
			}
		}
		else if (this.IE8) {
			this.selectorsToProcess.push({'selector':selector, 'radii':rad});
		}
	},
	
	readPropertyChanges: function(el) {
		switch (event.propertyName) {
			case 'style.border':
			case 'style.borderWidth':
			case 'style.padding':
				this.applyVML(el);
				break;
			case 'style.borderColor':
				this.vmlStrokeColor(el);
				break;
			case 'style.backgroundColor':
			case 'style.backgroundPosition':
			case 'style.backgroundRepeat':
				this.applyVML(el);
				break;
			case 'style.display':
				el.vmlBox.style.display = (el.style.display == 'none') ? 'none' : 'block';
				break;
			case 'style.filter':
				this.vmlOpacity(el);
				break;
			case 'style.zIndex':
				el.vmlBox.style.zIndex = el.style.zIndex;
				break;
		}
	},
	
	applyVML: function(el) {
		el.runtimeStyle.cssText = '';
		this.vmlFill(el);
		this.vmlStrokeColor(el);
		this.vmlStrokeWeight(el);
		this.vmlOffsets(el);
		this.vmlPath(el);
		this.nixBorder(el);
		this.vmlOpacity(el);
	},
	
	vmlOpacity: function(el) {
		if (el.currentStyle.filter.search('lpha') != -1) {
			var trans = el.currentStyle.filter;
			trans = parseInt(trans.substring(trans.lastIndexOf('=')+1, trans.lastIndexOf(')')), 10)/100;
			for (var v in el.vml) {
				el.vml[v].filler.opacity = trans;
			}
		}
	},
	
	vmlFill: function(el) {
		if (!el.currentStyle) {
			return;
		} else {
			var elStyle = el.currentStyle;
		}
		el.runtimeStyle.backgroundColor = '';
		el.runtimeStyle.backgroundImage = '';
		var noColor = (elStyle.backgroundColor == 'transparent');
		var noImg = true;
		if (elStyle.backgroundImage != 'none' || el.isImg) {
			if (!el.isImg) {
				el.vmlBg = elStyle.backgroundImage;
				el.vmlBg = el.vmlBg.substr(5, el.vmlBg.lastIndexOf('")')-5);
			}
			else {
				el.vmlBg = el.src;
			}
			var lib = this;
			if (!lib.imgSize[el.vmlBg]) { /* determine size of loaded image */
				var img = document.createElement('img');
				img.attachEvent('onload', function() {
					this.width = this.offsetWidth; /* weird cache-busting requirement! */
					this.height = this.offsetHeight;
					lib.vmlOffsets(el);
				});
				img.className = lib.ns + '_sizeFinder';
				img.runtimeStyle.cssText = 'behavior:none; position:absolute; top:-10000px; left:-10000px; border:none;'; /* make sure to set behavior to none to prevent accidental matching of the helper elements! */
				img.src = el.vmlBg;
				img.removeAttribute('width');
				img.removeAttribute('height');
				document.body.insertBefore(img, document.body.firstChild);
				lib.imgSize[el.vmlBg] = img;
			}
			el.vml.image.filler.src = el.vmlBg;
			noImg = false;
		}
		el.vml.image.filled = !noImg;
		el.vml.image.fillcolor = 'none';
		el.vml.color.filled = !noColor;
		el.vml.color.fillcolor = elStyle.backgroundColor;
		el.runtimeStyle.backgroundImage = 'none';
		el.runtimeStyle.backgroundColor = 'transparent';
	},
	
	vmlStrokeColor: function(el) {
		el.vml.stroke.fillcolor = el.currentStyle.borderColor;
	},
	
	vmlStrokeWeight: function(el) {
		var borders = ['Top', 'Right', 'Bottom', 'Left'];
		el.bW = {};
		for (var b=0; b<4; b++) {
			el.bW[borders[b]] = parseInt(el.currentStyle['border' + borders[b] + 'Width'], 10) || 0;
		}
	},
	
	vmlOffsets: function(el) {
		var dims = ['Left', 'Top', 'Width', 'Height'];
		for (var d=0; d<4; d++) {
			el.dim[dims[d]] = el['offset'+dims[d]];
		}
		var assign = function(obj, topLeft) {
			obj.style.left = (topLeft ? 0 : el.dim.Left) + 'px';
			obj.style.top = (topLeft ? 0 : el.dim.Top) + 'px';
			obj.style.width = el.dim.Width + 'px';
			obj.style.height = el.dim.Height + 'px';
		};
		for (var v in el.vml) {
			var mult = (v == 'image') ? 1 : 2;
			el.vml[v].coordsize = (el.dim.Width*mult) + ', ' + (el.dim.Height*mult);
			assign(el.vml[v], true);
		}
		assign(el.vmlBox, false);
		
		if (DD_roundies.IE8) {
			el.vml.stroke.style.margin = '-1px';
			if (typeof el.bW == 'undefined') {
				this.vmlStrokeWeight(el);
			}
			el.vml.color.style.margin = (el.bW.Top-1) + 'px ' + (el.bW.Left-1) + 'px';
		}
	},
	
	vmlPath: function(el) {
		var coords = function(direction, w, h, r, aL, aT, mult) {
			var cmd = direction ? ['m', 'qy', 'l', 'qx', 'l', 'qy', 'l', 'qx', 'l'] : ['qx', 'l', 'qy', 'l', 'qx', 'l', 'qy', 'l', 'm']; /* whoa */
			aL *= mult;
			aT *= mult;
			w *= mult;
			h *= mult;
			var R = r.slice(); /* do not affect original array */
			for (var i=0; i<4; i++) {
				R[i] *= mult;
				R[i] = Math.min(w/2, h/2, R[i]); /* make sure you do not get funky shapes - pick the smallest: half of the width, half of the height, or current value */
			}
			var coords = [
				cmd[0] + Math.floor(0+aL) +','+ Math.floor(R[0]+aT),
				cmd[1] + Math.floor(R[0]+aL) +','+ Math.floor(0+aT),
				cmd[2] + Math.ceil(w-R[1]+aL) +','+ Math.floor(0+aT),
				cmd[3] + Math.ceil(w+aL) +','+ Math.floor(R[1]+aT),
				cmd[4] + Math.ceil(w+aL) +','+ Math.ceil(h-R[2]+aT),
				cmd[5] + Math.ceil(w-R[2]+aL) +','+ Math.ceil(h+aT),
				cmd[6] + Math.floor(R[3]+aL) +','+ Math.ceil(h+aT),
				cmd[7] + Math.floor(0+aL) +','+ Math.ceil(h-R[3]+aT),
				cmd[8] + Math.floor(0+aL) +','+ Math.floor(R[0]+aT)
			];
			if (!direction) {
				coords.reverse();
			}
			var path = coords.join('');
			return path;
		};
	
		if (typeof el.bW == 'undefined') {
			this.vmlStrokeWeight(el);
		}
		var bW = el.bW;
		var rad = el.DD_radii.slice();
		
		/* determine outer curves */
		var outer = coords(true, el.dim.Width, el.dim.Height, rad, 0, 0, 2);
		
		/* determine inner curves */
		rad[0] -= Math.max(bW.Left, bW.Top);
		rad[1] -= Math.max(bW.Top, bW.Right);
		rad[2] -= Math.max(bW.Right, bW.Bottom);
		rad[3] -= Math.max(bW.Bottom, bW.Left);
		for (var i=0; i<4; i++) {
			rad[i] = Math.max(rad[i], 0);
		}
		var inner = coords(false, el.dim.Width-bW.Left-bW.Right, el.dim.Height-bW.Top-bW.Bottom, rad, bW.Left, bW.Top, 2);
		var image = coords(true, el.dim.Width-bW.Left-bW.Right+1, el.dim.Height-bW.Top-bW.Bottom+1, rad, bW.Left, bW.Top, 1);
		
		/* apply huge path string */
		el.vml.color.path = inner;
		el.vml.image.path = image;
		el.vml.stroke.path = outer + inner;
		
		this.clipImage(el);
	},
	
	nixBorder: function(el) {
		var s = el.currentStyle;
		var sides = ['Top', 'Left', 'Right', 'Bottom'];
		for (var i=0; i<4; i++) {
			el.runtimeStyle['padding' + sides[i]] = (parseInt(s['padding' + sides[i]], 10) || 0) + (parseInt(s['border' + sides[i] + 'Width'], 10) || 0) + 'px';
		}
		el.runtimeStyle.border = 'none';
	},
	
	clipImage: function(el) {
		var lib = DD_roundies;
		if (!el.vmlBg || !lib.imgSize[el.vmlBg]) {
			return;
		}
		var thisStyle = el.currentStyle;
		var bg = {'X':0, 'Y':0};
		var figurePercentage = function(axis, position) {
			var fraction = true;
			switch(position) {
				case 'left':
				case 'top':
					bg[axis] = 0;
					break;
				case 'center':
					bg[axis] = 0.5;
					break;
				case 'right':
				case 'bottom':
					bg[axis] = 1;
					break;
				default:
					if (position.search('%') != -1) {
						bg[axis] = parseInt(position, 10) * 0.01;
					}
					else {
						fraction = false;
					}
			}
			var horz = (axis == 'X');
			bg[axis] = Math.ceil(fraction ? (( el.dim[horz ? 'Width' : 'Height'] - (el.bW[horz ? 'Left' : 'Top'] + el.bW[horz ? 'Right' : 'Bottom']) ) * bg[axis]) - (lib.imgSize[el.vmlBg][horz ? 'width' : 'height'] * bg[axis]) : parseInt(position, 10));
			bg[axis] += 1;
		};
		for (var b in bg) {
			figurePercentage(b, thisStyle['backgroundPosition'+b]);
		}
		el.vml.image.filler.position = (bg.X/(el.dim.Width-el.bW.Left-el.bW.Right+1)) + ',' + (bg.Y/(el.dim.Height-el.bW.Top-el.bW.Bottom+1));
		var bgR = thisStyle.backgroundRepeat;
		var c = {'T':1, 'R':el.dim.Width+1, 'B':el.dim.Height+1, 'L':1}; /* these are defaults for repeat of any kind */
		var altC = { 'X': {'b1': 'L', 'b2': 'R', 'd': 'Width'}, 'Y': {'b1': 'T', 'b2': 'B', 'd': 'Height'} };
		if (bgR != 'repeat') {
			c = {'T':(bg.Y), 'R':(bg.X+lib.imgSize[el.vmlBg].width), 'B':(bg.Y+lib.imgSize[el.vmlBg].height), 'L':(bg.X)}; /* these are defaults for no-repeat - clips down to the image location */
			if (bgR.search('repeat-') != -1) { /* now let's revert to dC for repeat-x or repeat-y */
				var v = bgR.split('repeat-')[1].toUpperCase();
				c[altC[v].b1] = 1;
				c[altC[v].b2] = el.dim[altC[v].d]+1;
			}
			if (c.B > el.dim.Height) {
				c.B = el.dim.Height+1;
			}
		}
		el.vml.image.style.clip = 'rect('+c.T+'px '+c.R+'px '+c.B+'px '+c.L+'px)';
	},
	
	pseudoClass: function(el) {
		var self = this;
		setTimeout(function() { /* would not work as intended without setTimeout */
			self.applyVML(el);
		}, 1);
	},
	
	reposition: function(el) {
		this.vmlOffsets(el);
		this.vmlPath(el);
	},
	
	roundify: function(rad) {
		this.style.behavior = 'none';
		if (!this.currentStyle) {
			return;
		}
		else {
			var thisStyle = this.currentStyle;
		}
		var allowed = {BODY: false, TABLE: false, TR: false, TD: false, SELECT: false, OPTION: false, TEXTAREA: false};
		if (allowed[this.nodeName] === false) { /* elements not supported yet */
			return;
		}
		var self = this; /* who knows when you might need a setTimeout */
		var lib = DD_roundies;
		this.DD_radii = rad;
		this.dim = {};

		/* attach handlers */
		var handlers = {resize: 'reposition', move: 'reposition'};
		if (this.nodeName == 'A') {
			var moreForAs = {mouseleave: 'pseudoClass', mouseenter: 'pseudoClass', focus: 'pseudoClass', blur: 'pseudoClass'};
			for (var a in moreForAs) {
				handlers[a] = moreForAs[a];
			}
		}
		for (var h in handlers) {
			this.attachEvent('on' + h, function() {
				lib[handlers[h]](self);
			});
		}
		this.attachEvent('onpropertychange', function() {
			lib.readPropertyChanges(self);
		});
		
		/* ensure that this elent and its parent is given hasLayout (needed for accurate positioning) */
		var giveLayout = function(el) {
			el.style.zoom = 1;
			if (el.currentStyle.position == 'static') {
				el.style.position = 'relative';
			}
		};
		giveLayout(this.offsetParent);
		giveLayout(this);
		
		/* create vml elements */
		this.vmlBox = document.createElement('ignore'); /* IE8 really wants to be encased in a wrapper element for the VML to work, and I don't want to disturb getElementsByTagName('div') - open to suggestion on how to do this differently */
		this.vmlBox.runtimeStyle.cssText = 'behavior:none; position:absolute; margin:0; padding:0; border:0; background:none;'; /* super important - if something accidentally matches this (you yourseld did this once, Drew), you'll get infinitely-created elements and a frozen browser! */
		this.vmlBox.style.zIndex = thisStyle.zIndex;
		this.vml = {'color':true, 'image':true, 'stroke':true};
		for (var v in this.vml) {
			this.vml[v] = document.createElement(lib.ns + ':shape');
			this.vml[v].filler = document.createElement(lib.ns + ':fill');
			this.vml[v].appendChild(this.vml[v].filler);
			this.vml[v].stroked = false;
			this.vml[v].style.position = 'absolute';
			this.vml[v].style.zIndex = thisStyle.zIndex;
			this.vml[v].coordorigin = '1,1';
			this.vmlBox.appendChild(this.vml[v]);
		}
		this.vml.image.fillcolor = 'none';
		this.vml.image.filler.type = 'tile';
		this.parentNode.insertBefore(this.vmlBox, this);
		
		this.isImg = false;
		if (this.nodeName == 'IMG') {
			this.isImg = true;
			this.style.visibility = 'hidden';
		}
		
		setTimeout(function() {
			lib.applyVML(self);
		}, 1);
	}
	
};

try {
	document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
DD_roundies.IEversion();
DD_roundies.createVmlNameSpace();
DD_roundies.createVmlStyleSheet();

if (DD_roundies.IE8 && document.attachEvent && DD_roundies.querySelector) {
	document.attachEvent('onreadystatechange', function() {
		if (document.readyState == 'complete') {
			var selectors = DD_roundies.selectorsToProcess;
			var length = selectors.length;
			var delayedCall = function(node, radii, index) {
				setTimeout(function() {
					DD_roundies.roundify.call(node, radii);
				}, index*100);
			};
			for (var i=0; i<length; i++) {
				var results = document.querySelectorAll(selectors[i].selector);
				var rLength = results.length;
				for (var r=0; r<rLength; r++) {
					if (results[r].nodeName != 'INPUT') { /* IE8 doesn't like to do this to inputs yet */
						delayedCall(results[r], selectors[i].radii, r);
					}
				}
			}
		}
	});
}

  DD_roundies.addRule('#Comments li', '5px');
  DD_roundies.addRule('#Form form', '5px');  
};


if (document.all&&!window.opera) document.write('<style>.CommentHeader ul li {border:1px solid white !important}</style>');


// Pulsanti aperti/chiusi

if (document.getElementById||document.all) {
function pulsanti(aperto,chiuso,contenuto) {document.write("<a href=\"soka.htm\" id=\""+aperto+"\" onclick=\"document.getElementById('"+aperto+"').style.display = 'none'; document.getElementById('"+chiuso+"').style.display = ''; document.getElementById('"+contenuto+"').style.display = 'none'; return false\"><img src=\"http://www.marok.org/Kroste/Images/riduci.png\" border=0 class=\"accendispegni\" style=\"float:right; margin-right:3px; margin-top:"+pospuls+"px\" alt=\"Spegni\" title=\"sdsd\"></a><a href=\"soka.htm\" id=\""+chiuso+"\" onclick=\"document.getElementById('"+aperto+"').style.display = ''; document.getElementById('"+chiuso+"').style.display = 'none'; document.getElementById('"+contenuto+"').style.display = '';  return false\"><img src=\"http://www.marok.org/Kroste/Images/espandi.png\" border=0 class=\"accendispegni\" style=\"float:right; margin-right:3px; margin-top:"+pospuls+"px\" alt=\"Accendi\"></a>")};
function pulsanti2(aperto, chiuso, contenuto) {document.getElementById(aperto).style.display = 'none'; document.getElementById(chiuso).style.display = ''; document.getElementById(contenuto).style.display = 'none';};
}

// Predefinito

if (document.getElementById||document.all) {
if(document.all&&!document.getElementById){document.getElementById=function(A){return document.all[A]}}function BlockSubmit(B,C){var A=B.keyCode||B.which;if(A==13){C();return false}else{return true}}function CheckAll(B){var A=Explode(B,",");for(j=0;j<A.length;j++){CheckSwitch(A[j],true)}}function CheckNone(B){var A=Explode(B,",");for(j=0;j<A.length;j++){CheckSwitch(A[j],false)}}function CheckSwitch(C,A){var B=document.getElementsByTagName("input");for(i=0;i<B.length;i++){if(B[i].type=="checkbox"&&B[i].id.indexOf(C)==0){B[i].checked=A}}}function ClearContents(A){if(A){A.innerHTML=""}}function CompletePreferenceSet(B){var A=document.getElementById(B);if(A){A.className="PreferenceComplete"}}function Explode(B,A){return B.split(A)}function Focus(A){var B=document.getElementById(A);if(B){B.focus()}}function GetElements(A,B){var D=document.getElementsByTagName(A);var C=new Array();for(i=0;i<D.length;i++){if(D[i].id.indexOf(B)==0){C[C.length]=D[i]}}return C}function HideElement(A,C){var B=document.getElementById(A);if(B){B.style.display="none";if(C==1){ClearContents(B)}}}function PathFinder(){this.params=new function(){this.url=document.URL;this.domain=document.domain;this.httpMethod=this.url.replace(/^(http|https)(:\/\/).*$/,"$1$2");return this};this.getRootPath=function(C,B,F){var A=document.getElementsByTagName(C);var G="";var D="";for(var E=0;E<A.length;E++){G="";if(A[E].getAttribute&&A[E].getAttribute(B)){G=A[E].getAttribute(B)}else{if(A[E][B]){G=A[E][B]}}if(G.match(F)){D=G.replace(F,"");D=D.replace(/^http(s)?:\/\/[^\/]+/,"");break}}return D||false};return this}function PopTermsOfService(A){window.open(A,"TermsOfService","toolbar=no,status=yes,location=no,menubar=no,resizable=yes,height=600,width=400,scrollbars=yes")}function PreferenceSet(A){setTimeout("CompletePreferenceSet('"+this.Param+"');",400)}function RefreshPage(A){if(!A){A=400}setTimeout("document.location.reload();",A)}function RefreshPageWhenAjaxComplete(A){RefreshPage()}function SubmitForm(C,A,B){Wait(A,B);document[C].submit()}function SwitchElementClass(C,F,A,G,E,D){var B=document.getElementById(C);Sender=document.getElementById(F);if(B&&Sender){if(B.className==G){B.className=A;Sender.innerHTML=E}else{B.className=G;Sender.innerHTML=D}}}function SwitchExtension(E,F,D){var C=document.getElementById(F);if(C){C.className="Processing"}var B="ExtensionKey="+F+"&PostBackKey="+D;var A=new DataManager();A.Param=F;A.RequestFailedEvent=SwitchExtensionResult;A.RequestCompleteEvent=SwitchExtensionResult;A.LoadData(E+"?"+B)}function SwitchExtensionResult(B){var A=document.getElementById(Trim(B.responseText));if(A){setTimeout("SwitchExtensionItemClass('"+Trim(B.responseText)+"')",400)}else{alert(Trim(B.responseText))}}function SwitchExtensionItemClass(C){var B=document.getElementById(C);var A=document.getElementById("chk"+C+"ID");if(B&&A){B.className=A.checked?"Enabled":"Disabled"}}function SwitchPreference(G,F,C,E){var A=document.getElementById(F);var D=document.getElementById(F+"ID");if(D&&A){A.className="PreferenceProgress";var B=new DataManager();B.Param=F;B.RequestFailedEvent=HandleFailure;if(C==1){B.RequestCompleteEvent=RefreshPageWhenAjaxComplete}else{B.RequestCompleteEvent=PreferenceSet}B.LoadData(G+"?Type="+F+"&PostBackKey="+E+"&Switch="+D.checked)}}function Trim(A){return A.replace(/^\s*|\s*$/g,"")}function UpdateCheck(D,B,C){var A=new DataManager();A.RequestCompleteEvent=UpdateCheckStatus;A.RequestFailedEvent=UpdateCheckStatus;A.Param=D;A.LoadData(D+"?RequestName="+B+"&PostBackKey="+C)}function UpdateCheckStatus(E){if(E.responseText=="COMPLETE"){return }var F=E.responseText.substring(0,E.responseText.indexOf("|"));if(F=="First"){var B=document.getElementById("Core");var G=document.getElementById("CoreDetails")}else{var B=document.getElementById(F);var G=document.getElementById(F+"Details")}var D=E.responseText.slice(E.responseText.indexOf("|")+1);var A=document.getElementById("FormPostBackKey");var C=(A)?A.value:"";if(B&&G){if(D.indexOf("ERROR]")==1){B.className="UpdateError";G.innerHTML=D.replace(/\[ERROR\]/g,"")}else{if(D.indexOf("OLD]")==1){B.className="UpdateOld"}else{if(D.indexOf("UNKNOWN]")==1){B.className="UpdateUnknown"}else{B.className="UpdateGood"}}G.innerHTML=D.replace(/\[OLD\]/g,"").replace(/\[UNKNOWN\]/g,"").replace(/\[GOOD\]/g,"");setTimeout("UpdateCheck('"+this.Param+"', '"+F+"', '"+C+"');",300)}}else{alert("Error: "+E.responseText)}}function Wait(A,C){A.disabled=true;A.value=C;var B=A.parentNode;while(B!=null){if(B.tagName=="FORM"){B.submit();break}B=B.parentNode}}function WriteEmail(D,B,G,A){if(document.createElement&&document.getElementById){var E,C,F;E=document.createElement("a");E.href="mailto:"+B+"@"+D;G=G||B+"@"+D;F=document.createTextNode(G);E.appendChild(F);C=document.getElementById(A);if(C){C.parentNode.appendChild(E)}}};
}
