window.onload=externalLinks;

// Variables/Expressions
var emailExp=/^([a-zA-Z0-9._-]+)@([a-zA-Z0-9-])+(\.[a-zA-Z0-9-]+)+$/;

// Functions
function externalLinks() { 
	if (!document.getElementsByTagName)return; 
	var anchors=document.getElementsByTagName("a"); 
	for(var i=0;i<anchors.length;i++) { 
		var anchor=anchors[i]; 
		if(anchor.getAttribute("href")&&anchor.getAttribute("rel")=="external")anchor.target="_blank"; 
	}
}
function isEmpty(obj) {if((obj.replace(/ /g,"")).replace(/\r\n/g,"")=="")return true;else return false;}
function genemail(user,domain,suffix,text) {
	mailto=user+'@'+domain+'.'+suffix;
	text=(text)?text:mailto;
	document.write('<a href="mailto:'+mailto+'">'+text+'</a>');
}
function getQueryVariable(variable) {
	var query=window.location.search.substring(1);
	var vars=query.split("&");
	for(var i=0;i<vars.length;i++){var pair=vars[i].split("=");if(pair[0]==variable)return pair[1];}
	return null;
}
function hide(obj){if(document.getElementById(obj))document.getElementById(obj).style.display="none";else obj.style.display="none";}
function show(obj){if(document.getElementById(obj))document.getElementById(obj).style.display="block";else obj.style.display="block";}
function txtCt(obj,maxlimit){if(obj.value.length>maxlimit)obj.value=obj.value.substring(0,maxlimit);}
function toggleTestimonial(href,id) {
	href=(document.getElementById(href))?document.getElementById(href):href;
	obj=document.getElementById(id);
	if (obj.style.display=="none"||obj.style.display==""){href.className="uppercase";show(obj);}
	else{href.className="";hide(obj);}
}
function showTestimonials() {
	var testimonials=getQueryVariable("testimonials");
	if (!testimonials)return;
	testimonials=testimonials.split("|");
	for(var i=0;i<testimonials.length;i++)
		if(document.getElementById("tb_"+testimonials[i]))
			toggleTestimonial("tb_"+testimonials[i]+"_a","tb_"+testimonials[i]);
}
