function windowOpen(_url, _title, _width, _height, _scrollbars, _toolbar, _menubar, _location)
{
    var posX = screen.width / 2 - (_width / 2);
    var posY = screen.height / 2 - (_height / 2);
    
    window.open(_url, _title, "left=" + posX + ",top=" + posY + ",height=" + _height + ",width=" + _width + ",scrollbars="+ _scrollbars + ",toolbar="+ _toolbar + ",menubar=" + _menubar + ",location=" + _location);
}

function window_open(_url, _width, _height)
{
    var posX = screen.width / 2 - (_width / 2);
    var posY = screen.height / 2 - (_height / 2);

    window.open(_url, "xms" , "left=" + posX + ",top=" + posY + ",height=" + _height + ",width=" + _width + ",scrollbars=yes,toolbar=no,menubar=no,location=no");
}


function checkEmailFormat(obj) 
{
    if (obj.value.length > 0)
    {  
        var at = obj.value.indexOf("@");      
        if (at == -1)
        {	
            obj.focus();	   
            return false
        }
          
        var at2 = obj.value.indexOf("@", (at+1));
        
        var dot = obj.value.indexOf(".",at);
        var len = obj.value.length;
        var comma = obj.value.indexOf(",");
        var space = obj.value.indexOf(" ");
        var lastToken = obj.value.lastIndexOf(".") + 1;
        
        if ((at2 != -1) || (dot <= (1+1)) || (comma != -1) || (space != -1) || (len-lastToken < 2) || (len-lastToken > 3)) 
        {
            obj.focus();
            return false; // format error
        }    
    } 
    else 
    {
        obj.focus();
        return false; // no data
    }
    return true;
}

function returnSelection(theRadio) 
{ 
	var selection=1; 
	for(var i=0; i < theRadio.length; i++) 
	{ 
        if(theRadio[i].checked) 
        { 
                selection=theRadio[i].value; 
                return selection; 
        } 
	} 
		return selection;		
} 

function swapImgSrc(el,which)
{
	el.src=el.getAttribute(which||"origsrc");
} 

function isHtmlFile(filename)
{
    if (filename == "") return false;
    
    var rep = /.*(htm|html|mht)$/;
    
    if (filename.match(rep))   
    {	            
        return true;
    } 
    else
    {
        return false;
    }    
} 