function TextAreasToSpan(){
	var isViewPage = false;
	var theSheets;
	var tempText, tempClass;
	
	if( document.styleSheets ){
		if( document.styleSheets.length ){
			theSheets = document.styleSheets;
		}
		else
			return;
	}
	else
		return;
	
	for(i=0;i<theSheets.length;i++){
		
		if(theSheets[i].href.toLowerCase().indexOf('viewpage') > -1){
			isViewPage = true;
			break;
		}
	}
	
	if(isViewPage){
		var textAreas = document.getElementsByTagName('textarea');
		var newP;
		var txt;
		var newT;
		var newBR;
		
		if(textAreas.length > 0){
			for(i=0;i<=textAreas.length;i++){ 
				tempText = textAreas[0].value;

				tempText = tempText.replace(/\r\n/g, "<BR/>");
				tempText = tempText.replace(/\n/g, "<BR/>"); 
				tempText = tempText.replace(/\r/g, "<BR/>");
				
				var arTexts = tempText.split("<BR/>");
				tempClass = textAreas[0].className;
				newP = document.createElement("div");
				newP.className = tempClass;
				newP.style.padding = 0;
				try{
	            newP.style.display = 'table';
	            newP.style.Float = 'left;';
	            }
	            catch(ee){
	            //
	            }
				for(x=0;x<arTexts.length;x++){
					newT = document.createTextNode(arTexts[x]);
					newBR = document.createElement("br");
					
					newP.appendChild(newT);
					newP.appendChild(newBR);
				}

				//if(textAreas[0].id == '_ctl1_txtProductDescription')
				newP.style.width = textAreas[0].style.width;
					
				textAreas[0].parentNode.replaceChild(newP, textAreas[0]);	
			}
		}
	}
}

TextAreasToSpan();

//Set workIsDone variable
function SetWorkIsDone(){
	var oHrefs = document.getElementsByTagName('A');   //for menu and all other links that were used
	var oTables = document.getElementsByTagName('TABLE');	//for datagrid rows
	var oSelects = document.getElementsByTagName('SELECT');	//for autopostback combos
	var oInputs = document.getElementsByTagName('INPUT'); //for autopostback checkboxes
	
	for(i = 0; i < oHrefs.length; i++){
		addEvent(oHrefs[i],'onclick', function(event){workIsDone=true;} ); 
	}
	
	for(i = 0; i < oTables.length; i++){
		if(oTables[i].className == 'clsDataGrid'){
			//addEvents to all table rows
			var oTds = oTables[i].getElementsByTagName('TD');
			for(j = 0; j < oTds.length; j++){
				addEvent(oTds[j],'onclick', function(event){workIsDone=true;} ); 
			}
			//and the table itself
			addEvent(oTables[i],'onclick', function(event){workIsDone=true;} ); 
			
		}
	}
	
	for(i = 0; i < oTables.length; i++){
		if(oTables[i].className == 'clsDataGrid'){
			//addEvents to all table rows
			var oTds = oTables[i].getElementsByTagName('TD');
			for(j = 0; j < oTds.length; j++){
				addEvent(oTds[j],'onclick', function(event){workIsDone=true;} ); 
			}
			//and the table itself
			addEvent(oTables[i],'onclick', function(event){workIsDone=true;} ); 
			
		}
	}
	
	for(i = 0; i < oSelects.length; i++){
		if(oSelects[i].onchange != undefined){
			//addEvents to all table rows
			addEvent(oSelects[i],'onclick', function(event){workIsDone=true;} ); 
			
		}
	}
	
	/*
	for(i = 0; i < oInputs.length; i++){
		if(oInputs[i].onclick != undefined){
			//addEvents to all table rows
			addEvent(oInputs[i],'onclick', function(event){workIsDone=true;} ); 
			
		}
	}
	*/
} 

//SetWorkIsDone();

