function designArticle(print) { 
	
	if (typeof(arrImages) == "undefined") {
		arrImages = new Array();
	}

	//Get Text
	if (document.getElementById('gt') === null) {
		varText = '';
	} else {	
		varText = document.getElementById('gt').innerHTML;
	}
	
	//Bilder im Textfluss
	for (var i = 2; i < arrImages.length; i++) {
		//Create IMG-Box
		varIMG = '';
		varIMG += '<div class=\"imgbox\"><img src=\"' + arrImages[i]['src'] + '\"><div class=\"legende\">' + arrImages[i]['legende'] + '<\/div><\/div>';
		//z = i + 1;
		varText = varText.replace(new RegExp('#-#IMG' + i + '#-#'), varIMG);
	}
	
	
	//quotes
	if (varText.match(/#-#QUOTE#-#/g) != null) {
		quote = 0;
		tmp = varText.split("#-#QU");
		varText = '';
		for (var i in tmp) {
			if (!isNaN(i)) {
				if (tmp[i].match(/OTE#-#/g) != null && quote == 0) {tmp[i] = tmp[i].replace(/OTE#-#/g, "<div class=\"quote\">"); quote = 1;}
				if (tmp[i].match(/OTE#-#/g) != null && quote == 1) {tmp[i] = tmp[i].replace(/OTE#-#/g, "</div>"); quote = 0;}
				varText = varText + tmp[i];
			}
		}
	}
	
	//small
	if (varText.match(/#-#SMALL#-#/g) != null) {
		small = 0;
		tmp = varText.split("#-#SMA");
		varText = '';
		for (var i in tmp) {
			if (!isNaN(i)) {
				if (tmp[i].match(/LL#-#/g) != null && small == 0) {tmp[i] = tmp[i].replace(/LL#-#/g, "<div class=\"small\">"); small = 1;}
				if (tmp[i].match(/LL#-#/g) != null && small == 1) {tmp[i] = tmp[i].replace(/LL#-#/g, "<\/div>"); small = 0;}
				varText = varText + tmp[i];
			}
		}
	}
	
	//Seitenumbrüche
	//----------------------------------------------------------------
	if (print == 0) {
		pageCount = 0;

		if (varText.match(/#-#PAGE#-#/g) != null) {
			pageCount = varText.match(/#-#PAGE#-#/g).length;
		}

		//Create Paging
		varText = '<div id=\"page_1\" class=\"articlepaging\">' + varText;
		for (var i = 1; i <= pageCount; i++) {
			z = i + 1;
			varText = varText.replace(new RegExp('#-#PAGE#-#'), '<\/div><div id=\"page_' + z + '\" style=\"display: none\;\" class=\"articlepaging\">');
		}
		
		varText = varText + '<\/div>';
			
		//Write TXT
		if (document.getElementById('gt') != null) document.getElementById('gt').innerHTML = varText;
	
		//Select Page
		selected = 1;
		tpage = document.location.href.match(/p=\d+/);
		if (tpage != null) {
			selected = tpage.toString().match(/\d+/);
		}
	
		for (var i = 1; i <= pageCount; i++) {
			document.getElementById('page_' + i).style.display = 'none';
		}
	
		if (selected != 1) {
			document.getElementById('lead').style.display = 'none';
			document.getElementById('legende').style.display = 'none';
			document.getElementById('mainimg').style.display = 'none';
		}
	
		if (document.getElementById('page_' + selected) != null) document.getElementById('page_' + selected).style.display = 'block';
	
		if (pageCount > 0) {
			docURL = document.location.href.replace(/\?p=\d+/, '');
	
			//Paging
			varPaging = '' + selected + ' / ' + (pageCount + 1);
			if (selected > 1) varPaging = '<a href=\"' + docURL + '?p=' + (parseInt(selected) - 1) + '\">&laquo zur&uuml;ck<\/a>&nbsp;&nbsp;&nbsp;' + varPaging;
			if (selected <= pageCount) varPaging = varPaging + '&nbsp;&nbsp;&nbsp;<a href=\"' + docURL + '?p=' + (parseInt(selected) + 1) + '\">weiter &raquo;<\/a>';
		
			document.getElementById('bottompage').innerHTML = varPaging;
			if (selected > 1) document.getElementById('toppage').innerHTML = varPaging;
			
			if (pageCount > 0 && selected <= pageCount) { document.getElementById('article_multimedia').style.display = 'none'; }
			if (pageCount > 0 && selected > pageCount) { document.getElementById('article_multimedia').style.display = 'block'; }
			
			//socialbookmarks
			//if (selected > pageCount) document.getElementById('socialbookmarks').style.display = 'block';
		} else {
			//socialbookmarks
			//document.getElementById('socialbookmarks').style.display = 'block';
		}
	
	} else {
		//Replace Page-Marks
		pageCount = 0;

		if (varText.match(/#-#PAGE#-#/g) != null) {
			pageCount = varText.match(/#-#PAGE#-#/g).length;
		}

		//Create Paging
		varText = '<div id=\"page_1\" class=\"articlepaging\">' + varText;
		for (var i = 1; i <= pageCount; i++) {
			z = i + 1;
			varText = varText.replace(new RegExp('#-#PAGE#-#'), '');
		}
		
		//Write TXT
		if (document.getElementById('gt') != null) document.getElementById('gt').innerHTML = varText;
		
		//Print
		window.print();
		
	}
	//----------------------------------------------------------------
	
}

function showBildstrecke() {
	if (typeof(arrImages) != "undefined") {
		arrMediaBoxImages = new Array();
		for (var i = 2; i < arrImages.length; i++) {
			arrMedia = new Array(arrImages[i]['src1'],arrImages[i]['legende'],'');
			arrMediaBoxImages.splice(0,0,arrMedia);
		}
		Mediabox.open(arrMediaBoxImages,0);
	}
	
	
}
		
