

function setRemember(p_createCookie){
	now = new Date();
	now.setDate(now.getDate()+90);
	document.cookie = cookieName+"=true;expires="+(p_createCookie ? now.toGMTString() : "Thu, 01-Jan-1970 00:00:01 GMT");
}

function checkRemember(){
	if(document.cookie.indexOf(cookieName+"=true")!=-1){
		goMain();
	}
}

function checkValid(){
	if(document.cookie.indexOf(cookieName+"_valid=true")==-1){
		document.location.href = gatewayUrl;
	}
}

function goMain(){
	var t_popParam;
	document.cookie = cookieName+"_valid=true";
	if(mainPop){
		t_popParam = "height="+mainPopHeight+", width="+mainPopWidth+", top="+((screen.height-mainPopHeight)/2)+", left="+((screen.width-mainPopWidth)/2);
		//window.open(mainUrl, cookieName, t_popParam);
		if(landingUrl){
			document.location.href = landingUrl;
		}
	}else{
		document.location.href = mainUrl;
	}
}

function sendForm(p_remember){
	setRemember(p_remember);
	goMain();
}

