///*
///*************** BOOKMARK (Lesezeichen + TellaFriend) *******************************************
///*

	
	function sendTellaFriend () {
		
		Ext.getCmp('tellafriend').form.submit({ 
					url:		'Components/TellFriend/mail_send.php', 
					method:		'POST',
					waitMsg:	'Ihre Nachricht wird versendet ...',						
					success: 	function (form, action) 
									 {
									  Ext.Msg.show({msg: action.result.nachricht, buttons: Ext.MessageBox.OK, icon: 'ok'}); 
									  Ext.getCmp('tellafriend').form.reset();
									  Ext.getCmp('tellaFriendWin').hide();								  
									  },
					failure:	function(form, action)											 
									 {
									  Ext.Msg.show({msg: action.result.nachricht, buttons: Ext.MessageBox.OK, icon: 'error'}); 
									 }
					});																			
	};
	 
	function tellaFriend () {

		
		if (!tellaFriendWin){

		var	tellaFriend = 	
				{
				xtype:			'form',
				id: 			'tellafriend',
				defaultType: 	'textfield',
				monitorValid: 	true,											
				border: 		false,
				autoScroll: 	true,
				labelAlign: 	'top',
				autoHeight:		true,
				bodyStyle: 		'backgroundColor: #363636; color: #FFFFFF; padding: 20px;',
				frame:			true,
				defaults: 		{msgTarget: 'side'},
				buttonAlign: 	'center',
				items:		   [
								{
								 hidden: 		true,
								 hideLabel: 	true,
								 name:			'fallid',
								 value: 		fallid
								},	
								{
								 hidden: 		true,
								 hideLabel: 	true,
								 name:			'url',
								 value: 		SeitenURL
								},			
								{
								 fieldLabel: 	'Ihr Name',
								 anchor:	 	'-20',
								 allowBlank: 	false,
								 vtype: 		'alpha',
								 name:			'ihrname'
								},
								{
								 fieldLabel: 	'Ihre eigene E-Mail',
								 anchor:	 	'-20',
								 allowBlank: 	false,
								 vtype: 		'email',
								 name:			'ihreemail'
								},
								{
								 fieldLabel: 	'E-Mail des Empfängers',
								 anchor:	 	'-20',
								 allowBlank	: 	false,
								 vtype: 		'email',
								 name:			'freundemail'
								},													
								{
								 fieldLabel: 	'Ihre Nachricht',
								 xtype: 		'textarea',
								 anchor:	 	'-20',
								 height: 		150,
								 allowBlank	: 	false,
								 name:			'text',
								 value: 		'Auf www.eDocTrainer.de gibt es einen interessanten klinischen Fall:\n'+fallname+' in der Kategorie '+kategoriename+'\n\nIch glaube, dieser könnte auch für Dich interessant sein.'
								}
								
								
								]
			 };
			
			
			var tellaFriendWin = new Ext.Window ({
									title: 			'Tell a friend...',
									id: 			'tellFriend',
									layout:			'fit',
									closeAction: 	'hide',
									modal: 			true,
									width: 			350,
									autoHeight:		true,
									autoScroll: 	true,
									buttons: 		[{
													  text: 	'Schlie&szlig;en',
													  iconCls: 	'cross',
													  handler: 	function (){
														  				Ext.getCmp('tellFriend').hide();
																		
																		if (Ext.get('bildInhalt')) {			
																			Ext.get('bildInhalt').setStyle('visibility', 'visible');
																		}
																}
													  },
													  {
													  text: 	'Senden',
													  iconCls: 	'senden',
													  id: 		'senden',
													  formBind: true,
													  handler: 	function () {
																			sendTellaFriend();																			
																			}
													   }												  
													],
									items: 			[tellaFriend]
								});
		}
		
		if (Ext.get('bildInhalt')) {			
			Ext.get('bildInhalt').setStyle('visibility', 'hidden');
		}
							
		tellaFriendWin.show();
	};



	function Lesezeichen(){
		
		var SeitenURL = "http://"+window.location.hostname+"/?kat=K"+kategorieid+"&fall="+fallid;
		var SeitenTitel = "eDocTrainer - "+fallname;
		var Kommentar = "in der Kategorie "+kategoriename;
	
	  if (window.sidebar)
		{
		// firefox
		window.sidebar.addPanel(SeitenTitel,SeitenURL,Kommentar);
		}
	  else if(window.opera && window.print)
		{
		// opera
		var elem = document.createElement('a');
		elem.setAttribute('href',SeitenURL);
		elem.setAttribute('title',SeitenTitel);
		elem.setAttribute('rel','sidebar');
		elem.click();
		}
	  else if(document.all)
		{
		// ie
		window.external.AddFavorite(SeitenURL,SeitenTitel);
		}
	  else if (Ext.isChrome) {
		  
		  Ext.Msg.show({
		   title:'Info',
		   msg: 'Leider &uuml;nterst&uuml;tzen die Browser Chrome und Netscape<br>keine automatische Erstellung von Lesezeichen.',
		   buttons: Ext.Msg.OK,
		   animEl: 'bookmarkIcon',
		   icon: Ext.MessageBox.WARNING
		});

		}
		
	}
	
	if (!Ext.isChrome) {
		var bookmark = [
							{
							xtype: 'button',
							icon: 'design/Admin/star.png',
							id: 'bookmarkIcon',
							handler: function () {Lesezeichen();}
							},
							'-'
						]
		
	}
	else {var bookmark = []}

	var url = {
		title: 			'Link zum Fall',
		height: 		58,
		layoutConfig: 	{align: 'stretch'},
		layout: 		'hbox',
		items: 			[
						{
						xtype: 		'panel',
						flex: 		1,
						bodyStyle: 	'background-color: #363636;',
						border: 	false,
						padding: 	"3px 0 0 0",
						items: 		[
									{
									xtype: 		'textfield',
									readOnly: 	true,
									id: 		'urlText',
									width: 		143
									}
									]
						},
						{
						xtype:		'toolbar',
						width: 		59,
						items: 		[
									
									bookmark,
									
									{
									xtype: 		'button',
									icon: 		'design/mail.png',
									id: 		'tellafriendIcon',
									handler: 	tellaFriend
									}	
									]
						}
					   	]			
	};
