function goPage(obj)
{
	document.form1.operation.value=obj;
	document.form1.submit();
}

function goPageParent(obj)
{
	opener.form1.operation.value=obj;
	opener.form1.submit();
	window.close();

}

function goPagev2(main, sub)
{
	document.form1.operation.value = main;
	document.form1._cmd_.value = sub;
	document.form1.submit();
}

function goMobileSignup()
{
	document.form1.operation.value = "signupD";
	document.form1.selectedPlan.value = "106";
	document.form1.submit();
}

function goPageSavingsSimulator()
{
	document.form1.action = "/content/savings_simulator.jsp"
	document.form1.operation.value = "";
	document.form1.submit();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function clearWarning(fieldname){
	if(document.getElementById(fieldname) != null)
		document.getElementById(fieldname).innerHTML = '';
}


function dontRefresh(event) 
{
	var key;
	if (window.event)
	   key = window.event.keyCode;
	else if (event)
	   key = event.which;

	if (key==116) {
		if (window.event){
			window.event.keyCode=0; 
			window.event.returnValue=false;
		}	
		return false
	}	
	return true;
}

function goPageCheckPermission(targetpage,message){

	var xmlHttpReq = false;
	var self = this;
	var selectedaccountid = document.form1.selectedaccountid.value;

	qstr = 'ajaxoperation=checkPermission&selectedaccountid='+escape(selectedaccountid);  // NOTE: no '?' before querystring

	var strURL = "../service/AjaxServlet?"+qstr;
	// Mozilla/Safari
	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
	}
	// IE
	else if (window.ActiveXObject) {
		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	}
	self.xmlHttpReq.open("POST", strURL, true);
	self.xmlHttpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	self.xmlHttpReq.onreadystatechange = function() {
		if (self.xmlHttpReq.readyState == 4) {
		    updateCheckPermission(self.xmlHttpReq.responseText,targetpage,message);
		}
	}
	self.xmlHttpReq.send(null);
}

function updateCheckPermission(str,targetpage,message){
	if(str == '1'){
		goPage(targetpage);
	}else{
		alert(message);
	}
}


