// (c) ernst.beiglboeck@diepresse.com

UPDATE_MSG='Wird aktualisiert...';


//rss widget
Xilinus.Widget.RSSWidget = Class.create(Xilinus.Widget, {
  initialize: function($super,settings,statics) {
    this._class="Xilinus.Widget.RSSWidget";
    $super(null, "Wird geladen...", "Wird geladen...", null);
    this.settings=settings;
    this.statics=statics;
    if (this.statics.feedUrl.search(/urly/)<1) this.statics.feedUrl='/files/ajaxproxy.jsp?urly='+encodeURIComponent(this.statics.feedUrl);
    //////if (this.statics.feedUrl.search(/urly/)<1) this.statics.feedUrl='http://diepresse.com/files/ajaxproxy.jsp?urly='+this.statics.feedUrl;
    if(!this.settings.anzahlItems) this.settings.anzahlItems=5;
    this.divSettings.firstChild.firstChild.firstChild.innerHTML='<table><tr><td><label for="anzahlItems">Anzahl: </label></td><td><div class="slider"><input class="slider-input anzahlItems"/></div></td></tr></table>';
    this.update();
  },
  update: function($super) {
	//IE-Verhalten: Hier muss widget selbst übergeben werden, nicht ID, weil mittels ID $() nicht funktioniert
	//ajax(this.settings['feedUrl'],Xilinus.Widget.RSSWidget.renderFeed,this._id);
//        this.setContent(UPDATE_MSG);
	ajax(this.statics['feedUrl'],Xilinus.Widget.RSSWidget.renderFeed,this);
	$super();
  },
  appl: function($super,inputs) {
  	this.settings['anzahlItems']=inputs[0].value;
  	//this.settings.each(function(e){document.appendChild(e)});
	$super();
  },
  hack: function() {
        if (!this.hacked) {
                this.hacked=true;
        this.slider=[]; 
        var a=new Slider(this._div.select('.slider')[0],this._div.select('.slider-input')[0]);
        a.setMaximum(10);
        a.setValue(this.settings.anzahlItems);
        this.slider[0]=a;
        }
  }

})

Xilinus.Widget.RSSWidget.renderFeed = function(resp,el) {
console.log('renderfeed');
widget=el;
if(resp.responseXML) {
	//widget= $(el).widget;//geht IE nicht

	var items=resp.responseXML.getElementsByTagName('item');
	if (items.length==0) {
		widget.setTitle('Fehler');
		widget.setContent('Dieser Feed kann nicht angezeigt werden.');
	} else {
//	console.log(resp.responseXML);
	var st='<ul>';
	for(var i=0;i<items.length && i<el.settings.anzahlItems;i++) {
		st+='<li><a target="_new" href="'+items[i].getElementsByTagName('link')[0].firstChild.nodeValue+'">'+items[i].getElementsByTagName('title')[0].firstChild.nodeValue;
		//if (items[i].getElementsByTagName('description')[0].firstChild) 
		//	st+='<p>'+items[i].getElementsByTagName('description')[0].firstChild.nodeValue+'</p>';
		st+='</a></li>';
	}
	st+='</ul>'
	widget.setContent(st);
	//geht nicht ueberall
//	console.log(widget.statics);
	ff=el.statics.feedUrl.replace(/%3A/g,':').replace(/%2F/g,'/');
	//console.log(ff);
	var favicon=ff.match(/(^.*urly=http:\/\/[^\/]+)/)[1]+'/favicon.ico';
	//var favicon=el.statics.feedUrl.match(/(^.*urly=http[:(%3A)][\/(%2F)][\/(%2F)][^\/(%2F)]+)/)[1]+'/favicon.ico';;
	console.log(favicon);
	favicon=favicon.replace(/rss\./,'')
	favicon=favicon.replace(/rss\./,'')
	favicon=favicon.replace(/newsfeed\./,'')
	if (widget.statics && widget.statics.title) 
		widget.setTitle(widget.statics.title);		
	else if (resp.responseXML.getElementsByTagName('title')[0]) {
		widget.setTitle(resp.responseXML.getElementsByTagName('title')[0].firstChild.nodeValue);
	}
	if (!window.navigator.userAgent.match(/MSIE 6\.0/))
	ajax(favicon, Xilinus.Widget.RSSWidget.setFavicon,widget);
	//widget.updateHeight(); //sollte nämlich eigentlich automatisch gehen
	//portal._updateColumnsHeight(); //ist glaub ich nur notwendig, wenn man die spalten unterschiedlich hoch und mit hintergrund halten wil
	}
} else {//ajaxproxy stürtzt ab
widget.setContent('Kein gültiger Feed angegeben');
widget.setTitle('Fehler');
}
}

Xilinus.Widget.RSSWidget.setFavicon = function(r,e) {
widget=e;
ff=e.statics.feedUrl.replace(/%3A/g,':').replace(/%2F/g,'/');
imgurl=ff.match(/urly=(http:\/\/[^\/]+)/)[1]+'/favicon.ico'
imgurl=imgurl.replace(/rss\./,'')
imgurl=imgurl.replace(/rss\./,'')
imgurl=imgurl.replace(/newsfeed\./,'')
//imgurl='http://'+e.statics.feedUrl.match(/urly=http:\/\/([A-Za-z0-9]*\.)*([A-Za-z0-9]*\.[A-Za-z]*)\//)[2]+'/favicon.ico';
console.log('setFavicon'+imgurl);
widget.setTitle('<img width="16" height="16" src="'+imgurl+'" /> '+widget._titleDiv.firstChild.nodeValue);
}

//---------------------------------------------------------------------------


//presse widget
Xilinus.Widget.PresseWidget = Class.create(Xilinus.Widget, {
  initialize: function($super, settings, statics) {
    this._class="Xilinus.Widget.PresseWidget";
    $super(null, "Wird geladen...", "Wird geladen...", null);
    this.statics=statics;
    this.settings={};
    if (settings && settings['geschichtenInsgesamt']) this.settings.geschichtenInsgesamt=settings['geschichtenInsgesamt']; 
	else this.settings.geschichtenInsgesamt=5;
    if (settings && settings['geschichtenMitLead']) this.settings.geschichtenMitLead=settings['geschichtenMitLead']; 
	else this.settings.geschichtenMitLead=5;
    if (settings && settings['geschichtenMitBild']) this.settings.geschichtenMitBild=settings['geschichtenMitBild']; 
	else this.settings.geschichtenMitBild=1;
    var ih;
    ih='<table><tr><td><label>Anzahl:</label></td><td><select size="1" name="geschichtenInsgesamt" class="geschichtenInsgesamt"><option value="1">1</option><option value="5">5</option><option value="10">10</option><option value="20">20</option></select></tr>';
    ih+='<tr><td><label>mit Text:</label></td><td><select size="1" name="geschichtenMitLead" class="geschichtenMitLead"><option value="0">0</option><option value="1">1</option><option value="5">5</option><option value="10">10</option></select></tr>';
    ih+='<tr><td><label>mit Bild:</label></td><td><select size="1" name="geschichtenMitBild" class="geschichtenMitBild"><option value="0">0</option><option value="1">1</option><option value="5">5</option><option value="10">10</option></select></td></tr></table>';
   
    ih='<table><tr><td><label>Artikel:</label></td><td><div class="slider"><input class="slider-input geschichtenInsgesamt"/></div></td></tr>';
    ih+='<tr><td><label>mit Text:</label></td><td><div class="slider"><input class="slider-input geschichtenMitLead"/></div></td></tr>';
    ih+='<tr><td><label>mit Bild:</label></td><td><div class="slider"><input class="slider-input geschichtenMitBild"/></div></td></tr></table>';


    this.divSettings.firstChild.firstChild.firstChild.innerHTML=ih;
    this.update();
  },
  update: function($super) {
	//IE-Verhalten: Hier muss widget selbst übergeben werden, nicht ID, weil mittels ID $() nicht funktioniert
	//ajax(this.settings['feedUrl'],Xilinus.Widget.RSSWidget.renderFeed,this._id);
//        this.setContent(UPDATE_MSG);
	ajax(this.statics['feedUrl'],Xilinus.Widget.PresseWidget.renderFeed,this);
	$super();
  },
  appl: function($super,inputs) {
  	this.settings['geschichtenInsgesamt']=inputs[0].value;
  	this.settings['geschichtenMitLead']=inputs[1].value;
  	this.settings['geschichtenMitBild']=inputs[2].value;
  	//this.settings.each(function(e){document.appendChild(e)});
	$super();
  },
  afterCreate: function() {
	this.getElement().addClassName('presse');
  },
  hack: function() {
	if (!this.hacked) {
		this.hacked=true;
	this.slider=[];	
        var a=new Slider(this._div.select('.slider')[0],this._div.select('.slider-input')[0]);
        var b=new Slider(this._div.select('.slider')[1],this._div.select('.slider-input')[1]);
        var c=new Slider(this._div.select('.slider')[2],this._div.select('.slider-input')[2]);
	//meistgelesen-feeds haben nur 10 items
	if(this.statics['feedUrl'].match(/mostread/)) {
	a.setMaximum(10);
	b.setMaximum(10);
	c.setMaximum(10);
	} else {
	a.setMaximum(20);
	b.setMaximum(20);
	c.setMaximum(20);
	}
	a.setValue(this.settings.geschichtenInsgesamt);
	b.setValue(this.settings.geschichtenMitLead);
	c.setValue(this.settings.geschichtenMitBild);
	a.onchange=function(){b.setValue(Math.min(this.getValue(),b.getValue()));c.setValue(Math.min(this.getValue(),c.getValue()))}
	c.onchange=function(){a.setValue(Math.max(this.getValue(),a.getValue()))}
	b.onchange=function(){a.setValue(Math.max(this.getValue(),a.getValue()))}
        this.slider[0]=a;
        this.slider[1]=b;
        this.slider[2]=c;
        }
	console.log("recaluculating slider for"+this._class);
	this.slider[0].recalculate();
	this.slider[1].recalculate();
	this.slider[2].recalculate();
  }
})

Xilinus.Widget.PresseWidget.renderFeed = function(resp,el) {
	//widget= $(el).widget;//geht IE nicht
	widget=el;
	var items=resp.responseXML.getElementsByTagName('item');
	var st='<ul>';
	for(var i=0;i<items.length && i<el.settings.geschichtenInsgesamt;i++) {
		st+='<li class="clearfix"><div style="line-height:0.2em">&nbsp;</div><a href="'+items[i].getElementsByTagName('link')[0].firstChild.nodeValue.replace('from=rss','from=rss.portal')+'">';
		//titel
		st+='<span>'+items[i].getElementsByTagName('title')[0].firstChild.nodeValue+'</span><div style="line-height:0.2em">&nbsp;</div>';
		//bild
		if (items[i].getElementsByTagName('enclosure')[0] && i<el.settings.geschichtenMitBild) {
			bild=true;
			st+='<img height="108" width="180" class="article_image" src="'+items[i].getElementsByTagName('enclosure')[0].getAttribute('url').replace('uploads','uploads_180')+'" />';
		} else bild=false;
		st+='</a>';
		if (bild==true) extrastyle='class="marginleft"'; else extrastyle='';
		//lead
		if (items[i].getElementsByTagName('description')[0].firstChild && i<el.settings.geschichtenMitLead) 
			st+='<div style="margin-bottom:0.5em;" '+extrastyle+'>'+items[i].getElementsByTagName('description')[0].firstChild.nodeValue+'</div>';
		st+='</li>';
	}
	st+='</ul>'
	widget.setContent(st);
	widget.setTitle('<img src="http://diepresse.com/favicon.ico" /> '+resp.responseXML.getElementsByTagName('title')[0].firstChild.nodeValue);
	//widget.updateHeight(); //sollte nämlich eigentlich automatisch gehen
	//portal._updateColumnsHeight(); //ist glaub ich nur notwendig, wenn man die spalten unterschiedlich hoch und mit hintergrund halten wil
}

//----------------------------------------------------------------

//oebb fahrplan forumlar
Xilinus.Widget.OebbWidget = Class.create(Xilinus.Widget, {
  initialize: function($super) {
    this._class="Xilinus.Widget.OebbWidget";
    $super(null, '<img src="http://oebb.at/favicon.ico" /> ÖBB-Fahrplanabfrage', null, null);
    this.statics={};
    this.statics.oebbUrl='http://fahrplan.oebb.at/bin/query.exe/dn';
    this.update();
  },
  update: function($super) {
    hiddenFields='<input type="hidden" name="queryPageDisplayed" value="yes"><input type="hidden" name="REQ0JourneyStopsS0A" value="1"><input type="hidden" name="REQ0JourneyStopsS0ID" value=""><input type="hidden" name="REQ0JourneyStopsZ0A" value="1"><input type="hidden" name="REQ0JourneyStopsZ0ID" value=""><input type="hidden" name="wDayExt0" value="Mo%7CDi%7CMi%7CDo%7CFr%7CSa%7CSo"><input type="hidden" name="REQ0HafasSearchForw" value="1"><input type="hidden" name="existHafasDemo3" value="yes"><input type="hidden" name="REQ0JourneyProduct_list" value="0%3A1111111111010000-000000"><input type="hidden" name="existBikeEverywhere" value="yes"><input type="hidden" name="existHafasAttrInc" value="yes">'
    hiddenFields+='<input type="hidden" name="REQ0JourneyDate" value="'+(new Date()).getDate()+'.'+((new Date()).getMonth()+1)+'.'+(new Date()).getFullYear()+'">'
    hiddenFields+='<input type="hidden" name="REQ0JourneyTime" value="'+(new Date()).getHours()+':'+(new Date()).getMinutes()+'">'
    //var datepicker='<input name="date" type="hidden" /><a href="#" onclick="new CalendarDateSelect( $(this).previous(), {time:true, year_range:10} );return false">Zeit wählen</a>';
    content='<form target="_new" action="'+this.statics.oebbUrl+'"><p class="fahrplan"><label for="von">Von: </label><input class="text" type="text" name="REQ0JourneyStopsS0G" id="von"><br /><label for="nach">Nach: </label><input type="text" class="text" name="REQ0JourneyStopsZ0G" id="nach"><br /><input type="submit" class="submit" value="Suchen" name="start">'+hiddenFields+'</p></form>'
    this.setContent(content);
    $super();    
  }
})

//wiener linien fahrplan forumlar
Xilinus.Widget.WLWidget = Class.create(Xilinus.Widget, {
  initialize: function($super) {
    this._class="Xilinus.Widget.WLWidget";
    $super(null, 'Wiener-Linien-Fahrplanabfrage', null, null);
    this.statics={};
    this.statics.WLUrl='http://efa.vor.at/wvb/XSLT_TRIP_REQUEST2'
    this.update();
  },
  update: function($super) {
    //hiddenFields='<input type="hidden" name="queryPageDisplayed" value="yes"><input type="hidden" name="REQ0JourneyStopsS0A" value="1"><input type="hidden" name="REQ0JourneyStopsS0ID" value=""><input type="hidden" name="REQ0JourneyStopsZ0A" value="1"><input type="hidden" name="REQ0JourneyStopsZ0ID" value=""><input type="hidden" name="wDayExt0" value="Mo%7CDi%7CMi%7CDo%7CFr%7CSa%7CSo"><input type="hidden" name="REQ0HafasSearchForw" value="1"><input type="hidden" name="existHafasDemo3" value="yes"><input type="hidden" name="REQ0JourneyProduct_list" value="0%3A1111111111010000-000000"><input type="hidden" name="existBikeEverywhere" value="yes"><input type="hidden" name="existHafasAttrInc" value="yes">'
    //hiddenFields+='<input type="hidden" name="REQ0JourneyDate" value="'+(new Date()).getDate()+'.'+((new Date()).getMonth()+1)+'.'+(new Date()).getFullYear()+'">'
    //hiddenFields+='<input type="hidden" name="REQ0JourneyTime" value="'+(new Date()).getHours()+':'+(new Date()).getMinutes()+'">'
	//TODO: datum und zeit wie bei oebb
    hiddenFields='<input type="hidden" name="http://efa.vor.at/wvb/XSLT_TRIP_REQUEST2?sessionID" value="0"/><input type="hidden" name="requestID" value="0"/><input type="hidden" name="language" value="de"/><input type="hidden" name="ptOptionsActive" value="1"/><input type="hidden" name="useProxFootSearch" value="0"/><input type="hidden" name="execInst" value="normal"/><input type="hidden" name="storeMapParamInSession" value="0"/><input type="hidden" name="coordListOutputFormat" value="STRING"/><input type="hidden" name="itdLPxx_id_origin" value="%3Aorigin"/><input type="hidden" name="itdLPxx_id_destination" value="%3Adestination"/><input type="hidden" name="place_origin" value="Wien"/><input type="hidden" name="placeState_origin" value="empty"/><input type="hidden" name="type_origin" value="stop"/><input type="hidden" name="nameState_origin" value="empty"/><input type="hidden" name="placeInfo_origin" value="invalid"/><input type="hidden" name="typeInfo_origin" value="invalid"/><input type="hidden" name="nameInfo_origin" value="invalid"/><input type="hidden" name="deleteAssignedStops_origin" value="0"/><input type="hidden" name="place_destination" value="Wien"/><input type="hidden" name="placeState_destination" value="empty"/><input type="hidden" name="type_destination" value="stop"/><input type="hidden" name="nameState_destination" value="empty"/><input type="hidden" name="placeInfo_destination" value="invalid"/><input type="hidden" name="typeInfo_destination" value="invalid"/><input type="hidden" name="nameInfo_destination" value="invalid"/><input type="hidden" name="deleteAssignedStops_destination" value="0"/><input type="hidden" name="itdDateDay" value="28"/><input type="hidden" name="itdDateMonth" value="01"/><input type="hidden" name="itdDateYear" value="08"/><input type="hidden" name="itdTripDateTimeDepArr" value="dep"/><input type="hidden" name="itdTimeHour" value="12"/><input type="hidden" name="itdTimeMinute" value="04"/>'
    content='<form target="_new" action="'+this.statics.WLUrl+'" method="post"><p class="fahrplan"><label for="name_origin">Von: </label><input class="text" type="text" name="name_origin" id="name_origin"><br /><label for="name_destination">Nach: </label><input type="text" class="text" name="name_destination" id="name_destination"><br /><input type="submit" class="submit" value="Suchen">'+hiddenFields+'</p></form>'
    this.setContent(content);
    $super();    
  }
})


//linz fahrplan forumlar
Xilinus.Widget.LinzAGWidget = Class.create(Xilinus.Widget, {
  initialize: function($super) {
    this._class="Xilinus.Widget.LinzAGWidget";
    $super(null, 'Linz-AG-Fahrplanabfrage', null, null);
    //this.statics={};
    //this.statics.WLUrl='http://www.linzag.at/linz/XSLT_TRIP_REQUEST2'
    this.update();
  },
  update: function($super) {
    var content='<form action="http://www.linzag.at/efa/index.php" name="efa-startpage" id="efa-startpage" target="_blank" class="efa-startpage">		<table cellpadding="2" cellspacing="0" class="efa-startpage">					<tr>				<td class="efa-startpage">Von: </td>				<td class="linzag-right"><input type="text" name="sstreet" value="" class="efa-startpage" /></td>			</tr>			<tr>				<td class="efa-startpage">Nach: </td>				<td class="linzag-right"><input type="text" name="street" value="" class="efa-startpage" /></td>			</tr>			<tr>				<td colspan="2" class="linzag-right"><input type="submit" value="Suchen"/></td>			</tr>		</table>		<input type="hidden" name="_language" value="de">	</form>';
    this.setContent(content);
    $super();    
  }
})


//gvb fahrplan forumlar
Xilinus.Widget.GVBWidget = Class.create(Xilinus.Widget, {
  initialize: function($super) {
    this._class="Xilinus.Widget.GVBWidget";
    $super(null, 'GVB-Fahrplanabfrage', null, null);
    this.statics={};
    this.statics.WLUrl='http://www.verbundlinie.at/'
    this.update();
  },
  update: function($super) {
    var content='<form id="frmAdresse" action="http://www.verbundlinie.at/" method="post" target="_blank">		<input name="place_origin" value="Graz" type="hidden">		<input name="feature" value="bbb" type="hidden">		<input name="place_destination" value="Graz" type="hidden">		<input name="type_origin" value="address" type="hidden">		<input name="type_destination" value="address" type="hidden">Von: <input  name="name_origin" id="name_origin2" ><br />Nach: <input  name="name_destination" id="name_destination2" ><br /><input type="submit" value="Suchen">	</form>';
    this.setContent(content);
    $super();    
  }
})





//laedt content von einem html-fragment
Xilinus.Widget.DynamicWidget = Class.create(Xilinus.Widget, {
  initialize: function($super,settings,statics) {
    this._class="Xilinus.Widget.DynamicWidget";
    $super(null, 'Loading...', 'Loading ...', null);
    this.statics=statics;
    this.update();
  },
  update: function($super) {
  	    ajax(this.statics.fragmentUri, Xilinus.Widget.DynamicWidget.ajaxprocess, this._id);
	    $super();
  }
})

Xilinus.Widget.DynamicWidget.ajaxprocess = function(resp, el) {
 $(el).widget.setContent(resp.responseText);
	//$(el).widget.updateHeight(); //sollte nämlich eigentlich automatisch gehen
	//portal._updateColumnsHeight(); //ist glaub ich nur notwendig, wenn man die spalten unterschiedlich hoch und mit hintergrund halten wil
}

//laedt content von einem html-fragment mit nicht veränderbarer URI
Xilinus.Widget.StaticWidget = Class.create(Xilinus.Widget, {
  initialize: function($super) {
    this._class="Xilinus.Widget.StaticWidget";
    $super(null, this.statics.title, 'Loading ...', null);
    ajax(this.statics.fragmentUri, Xilinus.Widget.DynamicWidget.ajaxprocess, this._id);
  }
})

Xilinus.Widget.StaticWidget.ajaxprocess = function(resp, el) {
 $(el).widget.setContent(resp.responseText);
	//$(el).widget.updateHeight(); //sollte nämlich eigentlich automatisch gehen
	//portal._updateColumnsHeight(); //ist glaub ich nur notwendig, wenn man die spalten unterschiedlich hoch und mit hintergrund halten wil
}


//wetter
Xilinus.Widget.Wetter = Class.create(Xilinus.Widget, {
  initialize: function($super, settings, statics) {
    this._class="Xilinus.Widget.Wetter";
    $super(null, "Wetter" , 'Loading ...', null);
    this.settings=settings;
    this.divSettings.firstChild.firstChild.firstChild.innerHTML='<label for="ort">Ort: </label><input class="text" type="text" name="ort" id="ort" value="'+this.settings['ort']+'"/>';
    this.update();
  },
  update: function($super) {
    ajax("http://diepresse.com/files/ajaxportal/widgets/wetter.html?Land="+this.settings['ort']+"&Type=Bundesland", Xilinus.Widget.Wetter.ajaxprocess, this._id);
    $super();  	
  },
  appl: function($super,inputs) {
  	this.settings['ort']=inputs[0].value;
  	//this.settings.each(function(e){document.appendChild(e)});
	$super();
  }  
})

Xilinus.Widget.Wetter.ajaxprocess = function(resp,el) { 
 $(el).widget.setContent(resp.responseText);
	//$(el).widget.updateHeight(); //sollte nämlich eigentlich automatisch gehen
	//portal._updateColumnsHeight(); //ist glaub ich nur notwendig, wenn man die spalten unterschiedlich hoch und mit hintergrund halten wil
}

Xilinus.Widget.SudokuWidget = Class.create(Xilinus.Widget.StaticWidget, {
  initialize: function($super) {
    this.statics=[];
    this.statics.fragmentUri='http://diepresse.com/files/ajaxportal/widgets/sudoku_iframe.html';
    this.statics.title="Sudoku interaktiv";
    $super();
    this._class="Xilinus.Widget.SudokuWidget";
  }
})

Xilinus.Widget.NewscastWidget = Class.create(Xilinus.Widget.StaticWidget, {
  initialize: function($super) {
    this.statics=[];
    this.statics.fragmentUri='http://diepresse.com/files/ajaxportal/widgets/newscast.html';
    this.statics.title='<img src="http://diepresse.com/favicon.ico" /> DiePresse.com Newscast';
    $super();
    this._class="Xilinus.Widget.NewscastWidget";
  },
  afterCreate: function() {
	this.getElement().addClassName('presse');
  }
})

Xilinus.Widget.LastFM = Class.create(Xilinus.Widget.StaticWidget, {
  initialize: function($super) {
    this.statics=[];
    this.statics.fragmentUri='http://diepresse.com/files/ajaxportal/widgets/lastfm.html';
    this.statics.title='<img src="http://last.fm/favicon.ico" /> Last.fm';
    $super();
    this._class="Xilinus.Widget.LastFM";
  }
})

Xilinus.Widget.Boerse = Class.create(Xilinus.Widget.StaticWidget, {
  initialize: function($super) {
    this.statics=[];
    this.statics.fragmentUri='http://diepresse.com/files/ajaxportal/widgets/boerse_iframe.html';
    this.statics.title="B&ouml;rsenkurse";
    $super();
    this._class="Xilinus.Widget.Boerse";
  }
})

Xilinus.Widget.KinoSuche = Class.create(Xilinus.Widget.StaticWidget, {
  initialize: function($super) {
    this.statics=[];
    this.statics.fragmentUri='http://diepresse.com/files/ajaxportal/widgets/kinosuche.html';
    this.statics.title="Kinosuche";
    $super();
    this._class="Xilinus.Widget.KinoSuche";
  }
})

Xilinus.Widget.KinoProgramm = Class.create(Xilinus.Widget.StaticWidget, {
  initialize: function($super) {
    this.statics=[];
    this.statics.fragmentUri='http://diepresse.com/files/ajaxportal/widgets/kinoprogramm.html';
    this.statics.title="Kinoprogramm";
    $super();
    this._class="Xilinus.Widget.KinoProgramm";
  }
})

Xilinus.Widget.EventSuche = Class.create(Xilinus.Widget.StaticWidget, {
  initialize: function($super) {
    this.statics=[];
    this.statics.fragmentUri='widgets/eventsuche.html';
    this.statics.title="Events";
    $super();
    this._class="Xilinus.Widget.EventSuche";
  }
})

Xilinus.Widget.Websuche = Class.create(Xilinus.Widget.StaticWidget, {
  initialize: function($super) {
    this.statics=[];
    this.statics.fragmentUri='widgets/websuche.html';
    this.statics.title='<img src="http://google.at/favicon.ico" /> Websuche';
    $super();
    this._class="Xilinus.Widget.Websuche";
  }
})

Xilinus.Widget.Videosuche = Class.create(Xilinus.Widget.StaticWidget, {
  initialize: function($super) {
    this.statics=[];
    this.statics.fragmentUri='widgets/videosuche.html';
    this.statics.title='<img src="http://youtube.com/favicon.ico" /> Videosuche';
    $super();
    this._class="Xilinus.Widget.Videosuche";
  }
})


Xilinus.Widget.Kalender = Class.create(Xilinus.Widget, {
  initialize: function($super) {
    this._class="Xilinus.Widget.Kalender";
    $super(null, "Kalender", '<iframe class="wide" frameborder="0" src="widgets/calendar/calendar.html" style="border:none;width:343px;height:230px"></iframe><iframe class="narrow" frameborder="0" src="widgets/calendar/calendar.html" style="border:none;width:140px;height:140px"></iframe>', null);
  },
  afterCreate: function() {
        this.getElement().addClassName('presse');
  }
})


Xilinus.Widget.Dict = Class.create(Xilinus.Widget, {
  initialize: function($super) {
    this._class="Xilinus.Widget.Dict";
    $super(null, "Deutsch-Englisch", '<FORM ACTION="http://www.dict.cc/" method="get" target="_blank"><INPUT TYPE="TEXT" NAME="s"><br /><INPUT TYPE="SUBMIT" VALUE="Übersetzen"></FORM>', null);
  }
})

Xilinus.Widget.GMap = Class.create(Xilinus.Widget, {
  initialize: function($super) {
    this._class="Xilinus.Widget.GMap";
    $super(null, "Landkarte", "Dieses Widget ist leider nicht mehr verf&uuml;gbar", null);
//    $super(null, "Landkarte",'<div id="gmapSearch" class="wide">Adresse <input id="locAddress" value="Wien" type="text" onkeydown="keyp(event)"> <input onclick="load(document.getElementById(\'locAddress\').value)" value="anzeigen" type="button"></div><div style="position: relative; background-color: rgb(229, 227, 223);" id="map" class="wide"><div style="overflow: hidden; position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;"><div style="position: absolute; left: 0px; top: 0px; z-index: 0; cursor: -moz-grab;"><div style="position: absolute; left: 0px; top: 0px; display: none;"><div style="position: absolute; left: 0px; top: 0px; z-index: 0;"><img src="http://maps.google.com/intl/en_ALL/mapfiles/transparent.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://maps.google.com/intl/en_ALL/mapfiles/transparent.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://maps.google.com/intl/en_ALL/mapfiles/transparent.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://maps.google.com/intl/en_ALL/mapfiles/transparent.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://maps.google.com/intl/en_ALL/mapfiles/transparent.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://maps.google.com/intl/en_ALL/mapfiles/transparent.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://maps.google.com/intl/en_ALL/mapfiles/transparent.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://maps.google.com/intl/en_ALL/mapfiles/transparent.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://maps.google.com/intl/en_ALL/mapfiles/transparent.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: 256px; height: 256px; -moz-user-select: none;"></div></div><div style="position: absolute; left: 0px; top: 0px;"><div style="position: absolute; left: 0px; top: 0px; z-index: 0;"><img src="http://mt3.google.com/mt?n=404&amp;v=ap.69&amp;hl=en&amp;x=17873&amp;s=&amp;y=11361&amp;zoom=2&amp;s=Gali" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: -144px; top: -165px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://mt1.google.com/mt?n=404&amp;v=ap.69&amp;hl=en&amp;x=17873&amp;s=&amp;y=11362&amp;zoom=2&amp;s=Galil" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: -144px; top: 91px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://mt3.google.com/mt?n=404&amp;v=ap.69&amp;hl=en&amp;x=17873&amp;s=&amp;y=11363&amp;zoom=2&amp;s=Galile" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: -144px; top: 347px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://mt0.google.com/mt?n=404&amp;v=ap.69&amp;hl=en&amp;x=17874&amp;s=&amp;y=11361&amp;zoom=2&amp;s=Galileo" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 112px; top: -165px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://mt2.google.com/mt?n=404&amp;v=ap.69&amp;hl=en&amp;x=17874&amp;s=&amp;y=11362&amp;zoom=2&amp;s=" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 112px; top: 91px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://mt0.google.com/mt?n=404&amp;v=ap.69&amp;hl=en&amp;x=17874&amp;s=&amp;y=11363&amp;zoom=2&amp;s=G" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 112px; top: 347px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://mt1.google.com/mt?n=404&amp;v=ap.69&amp;hl=en&amp;x=17875&amp;s=&amp;y=11361&amp;zoom=2&amp;s=Ga" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 368px; top: -165px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://mt3.google.com/mt?n=404&amp;v=ap.69&amp;hl=en&amp;x=17875&amp;s=&amp;y=11362&amp;zoom=2&amp;s=Gal" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 368px; top: 91px; width: 256px; height: 256px; -moz-user-select: none;"><img src="http://mt1.google.com/mt?n=404&amp;v=ap.69&amp;hl=en&amp;x=17875&amp;s=&amp;y=11363&amp;zoom=2&amp;s=Gali" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 368px; top: 347px; width: 256px; height: 256px; -moz-user-select: none;"></div></div><div style="position: absolute; left: 0px; top: 0px; z-index: 100;"></div><div style="position: absolute; left: 0px; top: 0px; z-index: 101;"></div><div style="position: absolute; left: 0px; top: 0px; z-index: 102;"><img class="gmnoprint" src="http://maps.google.com/intl/en_ALL/mapfiles/shadow50.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 176px; top: 86px; width: 37px; height: 34px; -moz-user-select: none; z-index: -4820921;"></div><div style="position: absolute; left: 0px; top: 0px; z-index: 103;"></div><div style="position: absolute; left: 0px; top: 0px; z-index: 104; cursor: default;"><img class="gmnoprint" src="http://maps.google.com/intl/en_ALL/mapfiles/marker.png" style="border: 0px none ; margin: 0px; padding: 0px; width: 20px; height: 34px; -moz-user-select: none; z-index: -4820921; position: absolute; left: 176px; top: 86px;"><img class="gmnoscreen" src="http://maps.google.com/intl/en_ALL/mapfiles/markerff.gif" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 176px; top: 86px; width: 20px; height: 34px; -moz-user-select: none; z-index: -4820921;"></div><div style="position: absolute; left: 0px; top: 0px; z-index: 105;"></div><div style="position: absolute; left: 0px; top: 0px; z-index: 106;"><img usemap="#gmimap0" class="gmnoprint" src="http://maps.google.com/intl/en_ALL/mapfiles/markerTransparent.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 176px; top: 86px; width: 20px; height: 34px; -moz-user-select: none; z-index: -4820921;"><map name="gmimap0"><area id="mtgt_unnamed_0" href="javascript:void(0)" alt="" shape="poly" coords="9,0,6,1,4,2,2,4,0,8,0,12,1,14,2,16,5,19,7,23,8,26,9,30,9,34,11,34,11,30,12,26,13,24,14,21,16,18,18,16,20,12,20,8,18,4,16,2,15,1,13,0" log="miw"></map></div><div style="position: absolute; left: 0px; top: 0px; z-index: 107; cursor: default;"></div></div></div><div dir="ltr" style="color: black; font-family: Arial,sans-serif; font-size: 11px; white-space: nowrap; text-align: right; -moz-user-select: none; position: absolute; right: 3px; bottom: 2px;"><span>Map data ©2008  Tele Atlas - </span><a style="color: rgb(119, 119, 204);" target="_blank" href="http://www.google.com/intl/en_ALL/help/terms_maps.html">Terms of Use</a></div><span style="-moz-user-select: none; position: absolute; left: 2px; bottom: 2px;" class="gmnoprint"><a target="_blank" href="http://maps.google.com/maps?ll=48.209206,16.372778&amp;spn=0.006864,0.015879&amp;z=15&amp;key=ABQIAAAAZcTFKYEqNYwr2zPqsEVE-xQkvDUIRHiym6lHr11K0xtG2ZGcYxQyhZO3Y2Qy9KTjGMi0lX6CO4u9aA&amp;oi=map_misc&amp;ct=api_logo" title="Click to see this area on Google Maps"><img src="http://maps.google.com/intl/en_ALL/mapfiles/poweredby.png" style="border: 0px none ; margin: 0px; padding: 0px; width: 62px; height: 30px; -moz-user-select: none; cursor: pointer;"></a></span><div class="gmnoprint" style="width: 37px; height: 94px; -moz-user-select: none; position: absolute; left: 7px; top: 7px;"><img src="http://maps.google.com/intl/en_ALL/mapfiles/smc.png" style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: 37px; height: 94px; -moz-user-select: none;"><div title="Pan up" style="position: absolute; left: 9px; top: 0px; width: 18px; height: 18px; cursor: pointer;"></div><div title="Pan left" style="position: absolute; left: 0px; top: 18px; width: 18px; height: 18px; cursor: pointer;"></div><div title="Pan right" style="position: absolute; left: 18px; top: 18px; width: 18px; height: 18px; cursor: pointer;"></div><div title="Pan down" style="position: absolute; left: 9px; top: 36px; width: 18px; height: 18px; cursor: pointer;"></div><div title="Zoom In" style="position: absolute; left: 9px; top: 57px; width: 18px; height: 18px; cursor: pointer;"></div><div title="Zoom Out" style="position: absolute; left: 9px; top: 75px; width: 18px; height: 18px; cursor: pointer;"></div></div><div style="-moz-user-select: none; position: absolute; right: 7px; top: 7px; color: black; font-family: Arial,sans-serif; font-size: small; width: 187px; height: 18px;" class="gmnoprint"><div id="amtc_option_0" title="Show street map" style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 5em; cursor: pointer; right: 10.2em;"><div style="border-style: solid; border-color: rgb(52, 86, 132) rgb(108, 157, 223) rgb(108, 157, 223) rgb(52, 86, 132); border-width: 1px; font-size: 12px; font-weight: bold;">Map</div></div><div id="amtc_option_1" title="Show satellite imagery" style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 5em; cursor: pointer; right: 5.1em;"><div style="border-style: solid; border-color: white rgb(176, 176, 176) rgb(176, 176, 176) white; border-width: 1px; font-size: 12px;">Satellite</div></div><div id="amtc_option_2" title="Show imagery with street names" style="border: 1px solid black; position: absolute; background-color: white; text-align: center; width: 5em; cursor: pointer; right: 0em;"><div style="border-style: solid; border-color: white rgb(176, 176, 176) rgb(176, 176, 176) white; border-width: 1px; font-size: 12px;">Hybrid</div></div></div></div><div class="narrow">Dieses Element kann nur in der Mittelspalte angezeigt werden.</div>' , null);
  },
  afterCreate: function() {/*load(document.getElementById('locAddress').value)*/}
})








Xilinus.Widget.NewsFlash = Class.create(Xilinus.Widget, {
  initialize: function($super,settings) {
    this._class="Xilinus.Widget.NewsFlash";
    $super(null, "DiePresse.com Newsflash", 'Wird geladen...', null);
    this.settings=settings;
    if(!(this.settings && this.settings['channel'])) {this.settings={};this.settings['channel']=1;}
    var a=this.settings['channel'];
    this.divSettings.firstChild.firstChild.firstChild.innerHTML='<table><tr><td><label for="channel">Channel: </label></td><td><select><option value="1" '+(a==1?'selected="selected"':'')+'>Nachrichten</option><option value="2" '+(a==2?'selected="selected"':'')+'>Wirtschaft</option><option value="3" '+(a==3?'selected="selected"':'')+'>Politik</option><option value="4" '+(a==4?'selected="selected"':'')+'>Panorama</option><option value="5" '+(a==5?'selected="selected"':'')+'>Sport</option><option value="6" '+(a==6?'selected="selected"':'')+'>Kultur</option><option value="7" '+(a==7?'selected="selected"':'')+'>Leben</option><option value="8" '+(a==8?'selected="selected"':'')+'>Tech &amp; Science</option></select></td></tr></table>';
    //this.update();
  },
  afterCreate: function() {
        this.getElement().addClassName('presse');
	this.update();
  },
  appl: function($super,inputs) {
  	this.settings['channel']=inputs[0].value;
	//console.log('newsflash channel now' + this.settings['channel']);
	$super();
  },
  update: function() {
	console.log(this.portal+'thisportal');
	channel=this.settings['channel'];
	if(typeof(reservoir)=="object" && this.portal==reservoir)
	this.setContent('<iframe class="wide" frameborder="0" src="widgets/newsflash.html?top=true&channel='+this.settings['channel']+'" style="border:none;width:343px;height:100px" scrolling="no"></iframe><div class="narrow">Dieses Element kann nur in der Mittelspalte angezeigt werden.</div>');
	else
	//this.setContent('<iframe class="wide" frameborder="0" src="widgets/newsflash.html?channel='+this.settings['channel']+'" style="border:none;width:343px;height:230px"></iframe><div class="narrow">Dieses Element kann nur in der Mittelspalte angezeigt werden.</div>');
	this.setContent('<div class="wide"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="200" title="Newsflash"><param name="movie" value="widgets/newsflash.swf?12334" /><param name="quality" value="high" /><param name="FlashVars" value="channel='+channel+'" /><embed FlashVars="channel='+channel+'" src="widgets/newsflash.swf?12334" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="200"></embed></object></div><div class="narrow">Dieses Element kann nur in der Mittelspalte angezeigt werden.</div>');
  }
})

Xilinus.Widget.Hilfe = Class.create(Xilinus.Widget, {
  initialize: function($super) {
    this._class="Xilinus.Widget.Hilfe";
    $super(null, "Willkommen", '<strong>"Meine Presse" ist Ihre persönliche Startseite. Diese können Sie nach Ihren Interessen beliebig zusammenstellen: Unter "<a href="#" onclick="Effect.toggle(\'add\',\'blind\',{afterFinish:switchr}); return false;">Inhalte hinzufügen</a>" finden Sie ein breites Angebot an Nachrichten und Services.</strong><br /><br />Die Elemente Ihrer Wahl können Sie auf Ihre Startseite ziehen und dort frei anordnen. Klicken Sie das X in der rechten oberen Ecke eines Elements, um dieses wieder zu löschen. Das Schraubenschlüssel-Symbol öffnet das Einstellungsmenü.', null);
  },
  afterCreate: function() {
	this.getElement().addClassName('hilfe');
  }
})


Xilinus.Widget.Uhr = Class.create(Xilinus.Widget, {
  initialize: function($super,settings) {
    this._class="Xilinus.Widget.Uhr";
    $super(null, "Uhr", '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="180" title="Uhr"><param name="movie" value="widgets/uhr.swf" /><param name="wmode" value="transparent" /><param name="quality" value="high" /><embed wmode="transparent" src="widgets/uhr.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="180"></embed></object>', null);
    this.settings=settings;
    if(!(this.settings && this.settings['zone'])) {this.settings={};this.settings['zone']=1;}
    var a=this.settings['zone'];
    this.divSettings.firstChild.firstChild.firstChild.innerHTML='<label for="offset">Zeitzone: </label><br /><select name="offset" style="font-size:0.8em;margin:0.5em 0;"><option value="-12" '+(a==-12?'selected="selected"':'')+'>Eniwetok (GMT-12)</option><option value="-11">Samoa (GMT-11)</option><option value="-10">Hawaii-Aleutian (GMT-10)</option><option value="-10">Aleutian-Hawaii (GMT-10)</option><option value="-9">Alaska Standard Time(GMT-9)</option><option value="-8">Alaska Daylight Time(GMT-8)</option><option value="-8">Pacific Standard Time (GMT-8)</option><option value="-8">San Francisco (GMT -8 PST)</option> <option value="-7">Pacific Daylight Time (GMT-7)</option><option value="-7">Mountain Standard Time (GMT-7)</option><option value="-6">Mountain Daylight Time (GMT-6)</option><option value="-6">Central Standard Time (GMT-6)</option><option value="-5">Central Daylight Time (GMT-5)</option><option value="-5">Eastern Standard Time (GMT-5)</option><option value="-5">New York (GMT -5 EST)</option><option value="-4">Atlantic Standard Time (GMT-4)</option><option value="-4">Eastern Daylight Time (GMT-4)</option><option value="-3">Atlantic Daylight Time (GMT-3)</option><option value="-3">Brazilia (GMT-3)</option><option value="-2">Mid-Atlantic (GMT-2)</option><option value="-1">Azores (GMT-1)</option><option value="0">Greenwich Mean Time (GMT)</option> <option value="0">London (GMT)</option> <option value="1" selected="selected">Wien, Berlin, Paris, Rom (GMT +1)</option><option value="2">Israel (GMT +2)</option> <option value="3">Moscow (GMT +3)</option> <option value="4">Baku (GMT +4)</option> <option value="5">New Delhi (GMT +5)</option> <option value="6">Dhakar (GMT +6)</option> <option value="7">Bangkok (GMT +7)</option><option value="8">Hong Kong (GMT +8)</option><option value="9">Tokyo (GMT +9)</option> <option value="10">Sydney (GMT +10)</option><option value="11">Magadan (GMT +11)</option> <option value="12">Wellington (GMT +12)</option> <option value="12">Fiji (GMT +12)</option></select>';
    this.update();
  },
  afterCreate: function() {
	this.getElement().addClassName('uhr');
  },
  appl: function($super,inputs) {
  	this.settings['zone']=inputs[0].value;
	$super();
  },
  update: function() {
    this.setContent('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="100%" height="180" title="Uhr"><param name="movie" value="widgets/uhr.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="FlashVars" value="timeOffset='+this.settings['zone']+'" /><embed wmode="transparent" FlashVars="timeOffset='+this.settings['zone']+'" src="widgets/uhr.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="180"></embed></object>');
  }
})



Xilinus.Widget.Notes = Class.create(Xilinus.Widget, {
  initialize: function($super,settings,statics) {
    this._class="Xilinus.Widget.Notes";
    if (typeof(statics) == 'undefined' || typeof(statics.notesContent)=='undefined') tmp="Hier können Sie Notizen eingeben";
    else {this.statics=statics;tmp=statics.notesContent}
    $super(null, "Notizzettel", '<textarea class="notes_content" rows="10" onkeyup="this.parentNode.parentNode.parentNode.parentNode.widget.statics.notesContent=this.value">'+tmp+'</textarea>', null);
    this.statics={};
    this.statics.notesContent=tmp;
  },
  afterCreate: function() {
  }
})





//--------------------------mein thema schlagwortfeed ------------------------------

//rss widget
Xilinus.Widget.SearchRSSWidget = Class.create(Xilinus.Widget, {
  initialize: function($super,settings,statics) {
    this._class="Xilinus.Widget.SearchRSSWidget";
    $super(null, "Wird geladen...", "Wird geladen...", null);
    this.settings=settings;
    var a=this.settings['ress'];
    this.statics=statics;
    if(!this.settings.anzahlItems) this.settings.anzahlItems=5;
    this.divSettings.firstChild.firstChild.firstChild.innerHTML='<table><tr><td><label for="begriff">Schlagwort: </label></td><td><input type="text" class="text" name="begriff" id="begriff" value="'+this.settings.begriff+'"/></td></tr><tr><td><label for="anzahlItems">Anzahl: </label></td><td><div class="slider"><input class="slider-input anzahlItems"/></div></td></tr></table><fieldset id="resSel" class="suche">	<legend>Ressorts</legend><br/><div class="searchressort"><input type="checkbox" id="ress1" value="1" name="ress" class="noborder" '+(a[0]?'checked="checked"':'')+'/> <label for="ress1">Politik</label></div><div class="searchressort"><input type="checkbox" id="ress2" value="2" name="ress" class="noborder" '+(a[1]?'checked="checked"':'')+'/> <label for="ress2">Wirtschaft</label></div><div class="searchressort"><input type="checkbox" id="ress3" value="3" name="ress" class="noborder" '+(a[2]?'checked="checked"':'')+'/> <label for="ress3">Kultur</label></div><div class="searchressort"><input type="checkbox" id="ress4" value="4" name="ress" class="noborder" '+(a[3]?'checked="checked"':'')+'/> <label for="ress4">Panorama</label></div><div class="searchressort"><input type="checkbox" id="ress5" value="5" name="ress" class="noborder" '+(a[4]?'checked="checked"':'')+'/> <label for="ress5">Leben</label></div><div class="searchressort"><input type="checkbox" id="ress6" value="6" name="ress" class="noborder" '+(a[5]?'checked="checked"':'')+'/> <label for="ress6">Sport</label></div><div class="searchressort"><input type="checkbox" id="ress7" value="7" name="ress" class="noborder" '+(a[6]?'checked="checked"':'')+'/> <label for="ress7">Tech & Science</label></div><div class="searchressort"><input type="checkbox" id="ress8" value="8" name="ress" class="noborder" '+(a[7]?'checked="checked"':'')+'/> <label for="ress8">Meinung</label></div><div class="searchressort"><input type="checkbox" id="ress10" value="10" name="ress" class="noborder" '+(a[9]?'checked="checked"':'')+'/> <label for="ress10">Spectrum</label></div><div class="searchressort"><input type="checkbox" id="ress11" value="11" name="ress" class="noborder" '+(a[10]?'checked="checked"':'')+'/> <label for="ress11">Rechtspanorama</label></div><div class="searchressort"><input type="checkbox" id="ress9" value="9" name="ress" class="noborder" '+(a[8]?'checked="checked"':'')+'/> <label for="ress9">Sonstige</label></div><br style="clear: both;"/><br/><div style="display: block;" class="smtext">Auswählen: <a onclick="Element.select(this.parentNode.parentNode,\'input\').each(function(e){e.checked=true}); return false;" href="#">alle</a> / <a onclick="Element.select(this.parentNode.parentNode,\'input\').each(function(e){e.checked=false}); return false;" href="#">keine</a></div><br/></fieldset>';
    this.update();
  },
  update: function($super) {
	//IE-Verhalten: Hier muss widget selbst übergeben werden, nicht ID, weil mittels ID $() nicht funktioniert
	//ajax(this.settings['feedUrl'],Xilinus.Widget.RSSWidget.renderFeed,this._id);
	var ress="";
	var ressary=this.settings['ress'];
	for(var i=0;i<ressary.size();i++) if (ressary[i]) ress+="&ress="+(i+1);
//        this.setContent(UPDATE_MSG);
	ajax("/feeds/rsssearch.do?resultsPage=0&resetForm=0&action=search&autor=0&autorname=&zeitpunkt=0&dayFrom=1&monthFrom=1&yearFrom=2008&dayTo=11&monthTo=3&yearTo=2008&dayOnly=11&monthOnly=3&yearOnly=2008"+ress+"&searchText="+escape(this.settings['begriff']),Xilinus.Widget.SearchRSSWidget.renderFeed,this);
	$super();
  },
  appl: function($super,inputs) {
  	this.settings['begriff']=inputs[0].value;
  	this.settings['anzahlItems']=inputs[1].value;
	this.settings['ress']=[]
	for(var i=0;i<11;i++) this.settings['ress'][i]=inputs[i+2].checked;
  	//this.settings.each(function(e){document.appendChild(e)});
	$super();
  },
  afterCreate: function() {
	this.getElement().addClassName('presse');
  },
  hack: function() {
        if (!this.hacked) {
                this.hacked=true;
        this.slider=[];
        var a=new Slider(this._div.select('.slider')[0],this._div.select('.slider-input')[0]);
        a.setMaximum(10);
        a.setValue(this.settings.anzahlItems);
        this.slider[0]=a;
        }
  }

})

Xilinus.Widget.SearchRSSWidget.renderFeed = function(resp,el) {
	//widget= $(el).widget;//geht IE nicht
	widget=el;
	var items=resp.responseXML.getElementsByTagName('item');
//	console.log(resp.responseXML);
	var st='<ul>'; //<h4>'+resp.responseXML.getElementsByTagName('title')[0].firstChild.nodeValue+'</h4>';
	for(var i=0;i<items.length && i<el.settings.anzahlItems;i++) {
		st+='<li><a href="'+items[i].getElementsByTagName('link')[0].firstChild.nodeValue.replace('from=rss','from=rss.portal')+'">'+items[i].getElementsByTagName('title')[0].firstChild.nodeValue;
		st+="</a>";
		if (items[i].getElementsByTagName('description')[0].firstChild) 
			st+='<div>'+items[i].getElementsByTagName('description')[0].firstChild.nodeValue+'</div>';
		st+='</li>';
	}
	st+='</ul>'
	widget.setContent(st);
	widget.setTitle('<img src="http://diepresse.com/favicon.ico" /> Mein Thema: '+widget.settings.begriff);

}
