/*
function initMarquee(){
	Ext.onReady( function() {
		var heightC = Ext.fly('marqueeContainer').getHeight();
		var textRss = Ext.fly('marqueeText');
		var heightR = textRss.getHeight();
		
		animateMarquee(textRss, heightC, (-heightR), (heightR/15));
	});
}

function animateMarquee(textRss, init, toPosition, duration) {
	textRss.setTop(init);
	textRss.animate( {	top  : {to: toPosition, unit: 'px'} },
					 duration,      // animation duration
					 function(){
					 	animateMarquee(textRss, init, toPosition, duration);
					 }, 
					 '', 
					 'run'  
	);
}
*/


function RSS(elementID, sub, lang) {
	Ext.onReady( function() {
		Ext.Ajax.request({
		   url: 'http://www.dynematica.it/php/xmlhttp.php',
		   success: function(response, success, opts)  {
			   	Ext.fly('marqueeText').dom.innerHTML = response.responseText;
			   	initMarquee();
		   },
		    failure: function(response, opts) {
			   	Ext.fly('marqueeText').dom.innerHTML = response.statusText;
 			},
 			 params: { lang: (document.location.href.match(/.*-en.html$/)? "en" : "it") }
		});
	});
	
	/*
	
	var html = document.getElementById(elementID);
	// Provide the XMLHttpRequest class for IE 5.x-6.x:
	if( typeof XMLHttpRequest == "undefined" ) XMLHttpRequest = function() {
	  try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
	  try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
	  try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
	  try { return new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}
	};
	var xmlhttp = new XMLHttpRequest(); 
	
	if (xmlhttp) {
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) {
				var html = document.getElementById(elementID);
				try {
					html.innerHTML = (xmlhttp.status == 200) ? xmlhttp.responseText
							: "RSS failed to load, error " + xmlhttp.status;
					//initMarquee();
				}
				catch (ex)
				{
					html.innerHTML = ex.description;
				}
			}
		}
		var link = "http://dynematica.it/php/xmlhttp.php";
		
		//if (sub) {
		//	link = "../" + link;
		//} 
		if (lang && lang == "en") {
			link = link + "?lang=en";
		}
		xmlhttp.open("GET", link, true);
		xmlhttp.send(null);
	}
	
	*/
}

//	<img src="javascript/Lightbox/images/loading.gif" />
// 		<script type="text/javascript" src="javascript/rss.js"></script>

function DIM(elementID, cartella) {
	var html = document.getElementById(elementID);
	// Provide the XMLHttpRequest class for IE 5.x-6.x:
	if( typeof XMLHttpRequest == "undefined" ) XMLHttpRequest = function() {
	  try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
	  try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
	  try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
	  try { return new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}
	};
	var xmlhttp = new XMLHttpRequest(); 

	if (xmlhttp) {
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) {
				var html = document.getElementById(elementID);
				try {
					html.innerHTML = (xmlhttp.status == 200) ? xmlhttp.responseText
							: "RSS failed to load, error " + xmlhttp.status;
				}
				catch (ex)
				{
					html.innerHTML = ex.description;
				}
			}
		}
		xmlhttp.open("GET", "../php/imageReader.php?cartella="+cartella, true);
		xmlhttp.send(null);
	}
}
