// JavaScript Document

var xmlHttp1;
var elem;
function do_ajaxRequest_bc(uri,elem1)
{ 
	elem = elem1;
	xmlHttp1=GetXmlHttpObject()
	if (xmlHttp1==null)
	 {
		 alert ("Browser does not support HTTP Request");
		 return;
	 } 
	var url=uri;
	xmlHttp1.onreadystatechange=stateChanged ;
	xmlHttp1.open("GET",url,true);
	xmlHttp1.send(null);
}

function stateChanged() 
{ 
	if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
		document.getElementById(elem).innerHTML = xmlHttp1.responseText;
}

function GetXmlHttpObject()
{
	var xmlHttp1=null;
	try
 	{
	 // Firefox, Opera 8.0+, Safari
	 	xmlHttp1=new XMLHttpRequest();
	 }
	catch (e)
	 {
	 //Internet Explorer
		try
		{
			xmlHttp1=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp1=new ActiveXObject("Microsoft.XMLHTTP");
		}
	 }
	return xmlHttp1;
}


function emailValidator(val){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(val.match(emailExp))
		return true;
	else
		return false;
}

function windowOpener(windowHeight, windowWidth, windowName, windowUri)
{
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open(windowUri, windowName, 'scrollbars=1,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight);

    newWindow.focus();
    return newWindow.name;
}
