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("Por favor, ingrese una direccion de email valida");

		return false;

	}

	

	return true;

}



function add_favorites()

{

	var detect = navigator.userAgent.toLowerCase();

	//alert(detect);

	

	if(detect.indexOf('opera') + 1) alert("After you close this dialog please press CTRL+T to add SEOarticles4U to Favorites");

	else if(detect.indexOf('msie') + 1) window.external.AddFavorite("http://www.SEOarticles4U.com","~SEOarticles4U.com");

	else if(detect.indexOf('firefox') + 1) alert("After you close this dialog please press CTRL+D to add SEOarticles4U to Favorites");

	else if(detect.indexOf('netscape') + 1) alert("After you close this dialog please press CTRL+D to add SEOarticles4U to Favorites");

	else alert("Please use your browser's menu to add SEOarticles4U to Favorites");

}



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 update_price(price)

{

	tag_len = document.form.tag.value.length;



	tag_size = document.form.tag_size.value;

	switch(tag_size) 

	{

		case '12px':add_size = 0;break;

		case '15px':add_size = 2;break;

		case '20px':add_size = 4;break;

		case '25px':add_size = 8;break;

		case '30px':add_size = 16;break;

		case '35px':add_size = 32;break;

	}



	tag_color = document.form.tag_color.value;

	switch(tag_color) 

	{

		case '#000000':add_color = 0;break;

		case '#FFFFFF':add_color = 0;break;

		case '#C2D220':add_color = 4;break;

		case '#D65421':add_color = 4;break;

		case '#D5B920':add_color = 4;break;

		case '#20A0CF':add_color = 6;break;

		case '#DF2278':add_color = 6;break;

	}



	tag_back = document.form.tag_back.value;

	switch(tag_back) 

	{

		case '#FFFFFF':add_back = 0;break;

		case '#000000':add_back = 5;break;

		case '#C2D220':add_back = 5;break;

		case '#D65421':add_back = 5;break;

		case '#D5B920':add_back = 5;break;

		case '#20A0CF':add_back = 8;break;

		case '#DF2278':add_back = 8;break;

	}



	p = document.getElementById('total_price');

	p.childNodes[0].data = tag_len*(price + add_size+add_color+add_back);

	

	document.getElementById('price').value=tag_len*(price + add_size+add_color+add_back);

}



function update_tag_size(price)

{

	charSize = document.form.tag_size.value;

	document.getElementById('sample_tag').style.fontSize = charSize;

	update_price(price);

}



function update_tag_color(price)

{

	charColor = document.form.tag_color.value;

	document.getElementById('sample_tag').style.color = charColor;

	update_price(price);

}



function update_tag_back(price)

{

	backColor = document.form.tag_back.value;

	document.getElementById('sample_tag').style.backgroundColor = backColor;

	update_price(price);

}