/* JavaScript include commn2.js: Activities scondary windows */

function TopPath()
{   var path;
   	if (top==parent && top!=self && top.LAmandier){path= top}
   	else if (top == self && opener != null && opener.LAmandier){path=opener}
   	else if (top == parent && parent.opener!= null && parent.opener.LAmandier){path=parent.opener}
   	return path;
}

function Open(filename,winname)
{	//Open in new window from main window	
   	var path=TopPath();   	            
    if (!path) { return true } //true: normal HREF in <A> tag is actioned  
    return path.OpenNewWindow(filename,winname,false);              
}

function Close()
{   // close spawned windows           
    var path=TopPath();    
    if(path){ path.CloseWindows('popup') }       
}      

function Replace(page)
{	// move to correct page in website, or Home page if already in website                	
	var url = 'http://www.au-village.com/index.php';            
    if (location.protocol == 'file:'){ url = 'index.html' }
    else if (1+location.href.indexOf('http://localhost')){ url = 'index.php' }      
    var path = TopPath();                
    if (path){page = '' }
    else {path=top}
    if(page.length>0 && page.charAt(0) != '?'){ page='?' + page }
    path.location.href=url + page;
    return false;     
}        