 




var total_style = 57;





// Array Alphabet
var alphabet = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");


// Array style beginning URL
var dominant_url = "http://www.htmate.com/glitter/styles/";
var style_url = new Array();

// Creating Style URL

for(i=1;i<=total_style;i++){
	
	var style_numero = "style" + i;
	style_url[i-1] = dominant_url + style_numero + "/" + style_numero + "_files/";
	

}



// Arrays of all the styles
	

	var style = new Array();
	for(var i = 1; i<=total_style; i++) {
		
		 style[i] = new Array();
		
			
					
					
			
				for(var j = 0; j<26; j++) {
										
						style[i][j] =  style_url[i-1] + alphabet[j] + ".gif";

						}

				
				}// End of for
	



function list_styles() {
		// LIST STYLES
		
		
		var list = "<table><tr>";
	
	for(var i = 1; i<=total_style; i++) {
		list += '<td style="border:3px solid #62A0D1" width="80" height="80" id="style' + i + "_id" + '" onClick="select_style(id)"><img src="' + style[i][0] + '" border="0"><br/>' + "<b>" + i + '</b></td>';
		
		if((i%5)==0) {
			
			list = list + "</tr><tr>";
			
			}
		
	
	
	
		} 
		
	list += "</tr></table>";
	document.getElementById('style_list').innerHTML = list;
		

	
}


function parsetext(preview) {		



	var text = document.form.txt.value;
	
	
	text = text.replace(/(\[\w+\])/g, ",$1" );
	text = text.replace(/(\[\/\w+\])/g, "$1,");
	
var  text_array = new Array();
	text_array = text.split(',');
	
	
var text_imgHTML = "";
	
	
	for(var h = 0; h<text_array.length; h++) {
		
		
		
		// Text between tag [Sx] , x = number
		
		
	if(text_array[h].match(/\[(\w+)\](\s*\w*)(\[\/\w+\])/g)) {
			
			
		 var style_text = text_array[h].match(/\[(\w+)\](\s*\w*)(\[\/\w+\])/);
			
			
			
			var characters = new Array();
			characters = style_text[2].split(''); 
			
			style_number = style_text[1].replace(/[sS]/g,"");
			
		
		
	for(var i = 0; i<characters.length; i++) {
				
				
				if((style_number<=total_style) && (style_number>=1)) {
					if(characters[i] == " ") { text_imgHTML += '<a href="http://www.htmate.com/glitter/"><img src="' + "http://www.htmate2.com/glitter/styles/blank.gif" + '" border="0">';}
						else {
								
								text_imgHTML += '<a href="http://www.htmate.com/glitter/"><img src="' + style_url[style_number-1] + characters[i].toLowerCase() + ".gif" + '" border="0"></a>';
					
						
				
						} // End of Else
						
					
					
					
				} // End of if
				
			
			
			} // End of for		Loop through all characters between the Tag [Sx] with x representing a number between 1 and total_style
		
		
		} // End of if		Parse between tag [Sx]text[/Sx]
	
	
	
	
	
		
		else if(text_array[h].match(/[a-zA-Z\s*]/g)) {
		
			var characters_notag = new Array();
			characters_notag = text_array[h].split(''); 
			
			if (document.form.default_style.value == ""){
					var selected_style = 1;} 
				else {
			var selected_style = document.form.default_style.value; }
				
			
			for(var i = 0; i<characters_notag.length; i++) {
			
			
			
						if((selected_style<=total_style) && (selected_style>=1)) {
						
							if(characters_notag[i] == " ") { text_imgHTML +='<a href="http://www.htmate.com/glitter/"><img src="' + "http://www.htmate2.com/glitter/styles/blank.gif" + '" border="0"></a>';}
						else {
						
								
								text_imgHTML += '<a href="http://www.htmate.com/glitter/"><img src="' + style_url[selected_style-1] + characters_notag[i].toLowerCase() + ".gif" + '" border="0"></a>';
					
						
				
							} // End of else
						
						} // End of if
			
			
				} // End of for loop through all characters without tag
			
			

		
		
		
		} // End of else if 	Parse default style text
	

	
	} // End of for
	
	


document.form.code.value = text_imgHTML;
document.form2.scrollingcode.value = text_imgHTML;

if(preview==1) {
document.getElementById('preview').innerHTML = document.form.code.value;
} else if (preview==2) {
	document.form.submit();
} else if (preview==3) {
	
	document.form2.submit();
}

document.getElementById('previewscroll').innerHTML = '<MARQUEE WIDTH="100%" BEHAVIOR="scroll" SCROLLAMOUNT="7" DIRECTION="left">' + text_imgHTML + '</MARQUEE>';

} // End of function parsetext


function select_style(id) {

	for(var i = 1; i<=total_style; i++) {
		thisId = document.getElementById("style"+i+"_id");
		thisId.style.border = "3px solid #62A0D1";
		thisId.style.backgroundColor = "#FFFFFF";
		thisId.style.color = "#6e6e6e";
	
	}
	getthisId = document.getElementById(id);
	getthisId.style.border = "10px solid #6D9CEF";
	getthisId.style.backgroundColor = "#FFFFFF";
	
	
	var selected_style_1 = id.replace("_id","");
	var selected_style = selected_style_1.replace("style","");
	document.form.default_style.value = selected_style;
	parsetext(1);
	

}

function example(){

	document.form.txt.value = "[16]Hey[/16] [4]everyone[/4] [6]I[/6] made [20]this[/20]";
	parsetext(1);

}



//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){

return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){

return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("return false;")


