function relTags(){
	if (document.getElementsByTagName) 
	{
		var anchors = document.getElementsByTagName( "a" );
		for (var loop = 0; loop < anchors.length; loop++) 
		{
			var anchor = anchors[loop];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") 
			{
				anchor.target = "_blank";
			}
		}
	}
}	

window.onload = function(){
	relTags();
}

function check_mail(email){	
	var re3 = /^\s*([a-zA-Z0-9\._\-]{1,100})@([a-zA-Z0-9\.\-_]){1,100}\.([a-zA-Z]{2,4})\s*$/gi;
     
    if (email.value.length>=0 && !email.value.match(re3)) 
	{
		alert("Please enter a valid email address");
		return false;
	}	
	return true;
}

function counter(field, count, max){
	if (field.value.length > max) {
		field.value = field.value.substring(0, max);
	}
	else {
		obj = document.getElementById(count);
        obj.childNodes[0].data = max - field.value.length;
	}
}

function updatesize(){
	charSize = document.form.tag_size.value;
	document.getElementById('tagpreview').style.fontSize = charSize;
	update_price();
}

function updatecolor(){
	charColor = document.form.tag_color.value;
	document.getElementById('tagpreview').style.color = charColor;
	update_price();
}

function updateback(){
	backColor = document.form.tag_back.value;
	document.getElementById('tagpreview').style.backgroundColor = backColor;
	update_price();
}