// main.js

function checkNewWindowLocation() {	 
	var x = document.forms['pageHeaderSubView1:headerProductSearchSelectorForm']['pageHeaderSubView1:headerProductSearchSelectorForm:selectedAction'].value;
	var y = document.forms['pageHeaderSubView1:headerProductSearchSelectorForm']['pageHeaderSubView1:headerProductSearchSelectorForm:selectedSegment'].value;
	
	if ( y==1 & (x == 2 || x == 4)) {		
		openLocation("http://web.aig.com/2009/luk8777/index.html");
	} 

}

function openContent(location) {

	//contentUrl = '/AIGLifeUK/pdf?location=' + location;
	contentUrl = '/AIGPrivateClientUK/pdf?location=' + location;
	var win = window.open(contentUrl, '_blank');
	win.resizeTo(800,600);
	win.focus();
}

function openLocation(location) {

	//var win = window.open(location, "AIGLifeUK", 'toolbar=yes, directories=yes, location=yes, status=yes, menubar=yes, resizable=yes, scrollbars=yes, width=800, height=600');
	var win = window.open(location, "AIGPrivateClientUK", 'toolbar=yes, directories=yes, location=yes, status=yes, menubar=yes, resizable=yes, scrollbars=yes, width=800, height=600');
	win.focus();
}

function openExternalLocation(location){

	alert('Please note that this link is to an external site with content that is not owned by AIG Life.');
	//var win = window.open(location, "AIGLifeUK", 'toolbar=yes, directories=yes, location=yes, status=yes, menubar=yes, resizable=yes, scrollbars=yes, width=800, height=600');
	var win = window.open(location, "AIGPrivateClientUK", 'toolbar=yes, directories=yes, location=yes, status=yes, menubar=yes, resizable=yes, scrollbars=yes, width=800, height=600');
	win.focus();
}

function setAnchor(form, anchor) {
	if (anchor) {
		var index = form.action.indexOf("#");
		if (index != -1) {
			resetAnchor(form);
		}
		form.action += "#" + anchor;
	} else {
		resetAnchor(form);
	}
}

function resetAnchor(form) {
	alert(form.action);
	var index = form.action.indexOf("#");
	if (index != -1) {
		form.action = form.action.substring(0, index);
	} 
}

