window.onload = function()
{
	var anchors = document.getElementsByTagName("a");	
	for(var x = 0; x < anchors.length; x++)
	{
		if(anchors[x].getAttribute("rel") == "external")
			anchors[x].target = "_blank";
	}
}

function AuthorsJumpMenu(obj, type)
{
	window.location = "http://www.singhsabhacanada.com/" + type + "/By/" + obj.options[obj.selectedIndex].value;
}

function Validate()
{	
	var error = "";
	
	if(document.getElementById("txtName").value == "")
		error += "<li>Name is required.</li>";
	
	var emailRegex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 	
	var txtEmail = document.getElementById("txtEmail");
	
	if(txtEmail.value == "")
		error += "<li>Email address is required.</li>";
	else if(!emailRegex.test(txtEmail.value))
		error += "<li>Email address is invalid.</li>";

	if(document.getElementById("txtMessage").value == "")
		error += "<li>Message is required.</li>";
	
	if(error == "")
		return true;

	var divError = document.getElementById("Error");
	divError.innerHTML = "<strong>Please fix the following errors:</strong><ul>" + error + "</ul>";
	divError.style.display = "block";
	
	return false;
}

function ShowSlideShow(sender)
{
	$("div.SlideShow").hide();
	$("div#" + sender).show();
}
