//--Open pop up window and centre in the middle of the screen--
function fnPopUp(filePath,height,width,attributes){
	var sScreenX = screen.width
	var sScreenY = screen.height
	var x = sScreenX - width
	var y = sScreenY - height
	var winLeft = x/2
	var winTop =  y/2 
	window.open(filePath,"","width=" + width + ",height=" + height + "," + attributes + ",left=" + winLeft + ",top=" + winTop)
}


//--------------------------------------------------------------
//--------------------------------------------------------------
//OLD FUNCTIONS STILL NEEDED BY CMS--
function fnOpenPdfWin(filePath){
	var sScreenX = screen.width
	var sScreenY = screen.height
	var x = sScreenX - 650
	var y = sScreenY - 450
	var winLeft = x/2
	var winTop =  y/2 
	window.open(filePath,"pdf_window","width=650,height=450,toolbar=no,location=no,status=yes,menubar=yes,scrollbars=no,resizable=yes,left=" + winLeft + ",top=" + winTop)
}

function fnCMSnoPopup(filePath){
	alert ('You cannot follow links from a preview page.');
}

function fnOpenDocWin(filePath){
    var sScreenX = screen.width
    var sScreenY = screen.height
    var x = sScreenX - 650
    var y = sScreenY - 450
    var winLeft = x/2
    var winTop =  y/2 
    window.open (filePath,"document_window","width=650,height=450,toolbar=no,location=no,status=yes,menubar=yes,scrollbars=no,resizable=yes,left=" + winLeft + ",top=" + winTop)
}

function fnOpenMain(filePath){
	//checks to see if if window has opener
	//if not, opens up link in window and sets current window to focus
	//if yes, opens in opener
	if (window.opener){
		window.opener.location = filePath;
		window.focus();
	} else {
		window.open (filePath,"site_window","width=800,height=600,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes")
		window.focus();
	}
	
}

function newAgyW(c,w){	
	newAgyWin =window.open(w,"win"+c,"width=500,height=500,toolbar=no,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=no")
}

function newEveW(c,w){	
	newWin=window.open(w,"win"+c,"width=500,height=500,toolbar=no,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=no")
}

function newW(c,w){	
	newWin=window.open(w,"win"+c,"scrollbars=yes,menubar=yes,width=500,height=500")
}

