function bytBild(link ) {
	$('huvudbild').replace('<img id=\'huvudbild\' src=img/' + link + ' />');
	return;
}

function replaceSwechar (str){
		str.replace('å','&aring;');
		str.replace('Å','&Aring;');
		str.replace('ä','&auml;');
		str.replace('Ä','&Auml;');
		str.replace('ö','&ouml;');
		str.replace('Ö','&Ouml;');
		str.replace('\'','&lsquo;');
		return str;
}

function nl2br_univ (str){
	return str.replace(/\n/g, "<br />");
}

function fakeAjaxShowImageDesigner(bild){
		$('addedPicture').innerHTML = "<img class='addedPicture' src='img/" +bild+ "' />";     
		return true;
}
		

function fakeAjaxShowImage(bild, miniatyr, alt, id){
	switch (alt) {
		// if other main picture
		case '2':
			$('addedPicture').innerHTML = "<img class='addedPicture' src='img/" +bild+ "' />";     
			return true;
		break;
		
		// If main picture in tyger
		case '1':
			$('addedPicture').innerHTML = "<img class='addedPicture' src='img/" +bild+ "' />";     
			$('varianter').show();
		    return true;
		break;
		
		// If variant
		case '0':
			$('varianter').insert({top: '<div class="deletePictureWrapper" id="wrapper'+ id +'">' +
			'<a href="#" class="remove_image" id="remove_image'+ id +'" onMouseOver="$(\'remove_image_anchor'+ id +'\').show()" onMouseOut="$(\'remove_image_anchor'+ id +'\').hide()" onClick="return false;">'+
			'<img class="miniatyr" src="img/'+ miniatyr +'" />'+
			'</a>'+
			'<a href="#" style="display:none;" class="remove_image_anchor" id="remove_image_anchor'+ id +'" onClick="new Ajax.Request(\'editors.php\',{'+
													'method: \'post\','+
													'parameters: {'+
														'id: '+ id +','+
														'caller: \'delete_tyg_image\','+
														'},'+
													'onSuccess: function(transport) {'+
														'$(\'wrapper'+ id +'\').remove();'+
														'return false;'+
													'}'+
													'})" onMouseOver="$(\'remove_image_anchor'+ id +'\').show()">Ta bort</a>'+
			'</div>'});
		    return true;  
		break;
	} 
}
