/*** Popup windows v1.0 RL ***/

$(document).ready(function () {
	// SCOM links (1024x768 to fit scom template)
	$("a[href^='https://service.gemoney.com.au']").click(function(event){
		// Define defaults for older browsers that have issues
		var winWidth = 400; 
		var winheight = 400;
		var winMaxWidth = 1024;
		var winMaxHeight = 768;
		var winLeft = 0;
		var winTop = 0;
		
		if (screen.availWidth) { // Check if we have screen.avail...
			// Go to a maximise size of 1024x768
		   winWidth = (screen.availWidth > winMaxWidth) ? winMaxWidth : screen.availWidth;
		   winHeight = (screen.availHeight > winMaxHeight) ? winMaxHeight : screen.availHeight;
		}
		// Check we have window.open
		if (window.open) {
			// Open the new window
			var winLeft = (screen.availWidth/2)-(winWidth/2);
			var scomWin = window.open($(this).attr("href"),'scom','toolbar=no,location=yes,scrollbars=yes,resizable=yes,width='+winWidth+',height='+winHeight+',left='+winLeft+',top='+winTop);
			// Provide focus
			scomWin.focus();
			event.preventDefault();
		} 
	}); 
	// eApps links (622x[availHeight] for eApps template)
	$("a[href^='https://apply.gemoney.com.au/eapps/Apply.faces?cardType=wizard']").click(function(event){
		// Define defaults for older browsers that have issues
		var winWidth = 820; 
		var winheight = 768;
		var winLeft = 0;
		var winTop = 0;
		
		if (screen.availHeight) { // Check if we have screen.avail...
			winHeight = screen.availHeight;
		}
		// Check we have window.open
		if (window.open) {
			// Open the new window
			var winLeft = (screen.availWidth/2)-(winWidth/2);
			var appWin = window.open($(this).attr("href"),'app','toolbar=no,location=yes,scrollbars=yes,resizable=yes,width='+winWidth+',height='+winHeight+',left='+winLeft+',top='+winTop);
			// Provide focus
			appWin.focus();
			event.preventDefault();
		} 
	}); 
	
	
});

