action = null;

function SingleNoLoginFunction() {}
SingleNoLoginFunction.constructor = SingleNoLoginFunction;
SingleNoLoginFunction.prototype.onLoad = function(result) {
    if (result == "OK") {
		if(action == "mail") {
			window.location = BASE_URL + catID + "/newmail.html"
		} else if (action == "favorite") {
			setFav();
		} else if(action == "note") {
			window.location = BASE_URL + activeID + "/addnote.html"
		} else if(action == "calendar") {
			window.location = BASE_URL + "calendar.html";
		} else if(action == "budget") {
			window.location = BASE_URL + "budget.html";
		} else if(action == "guest") {
			window.location = BASE_URL + "guests.html"
		} else if(action == "mailbox") {
			window.location = BASE_URL + "mail.html"			
		} else if(action == "notes") {
			window.location = BASE_URL + "notes.html"
		} else if(action == "cmail") {
			window.location = BASE_URL + activeID + "/newcouplesmail.html";
		} else if (action == "cfavorite") {
			setFav();
		} else if (action == "gift") {
			window.location = BASE_URL + "gift.html";
		} else {
			window.location = BASE_URL;
		} 
    } else {
    	this.ErrorMessage('Грешно име или парола!');
    }
}

SingleNoLoginFunction.prototype.nSend = function() {
    uname = parent.document.getElementById("idname").value;
    passwd =  parent.document.getElementById("idpass").value;
    this.fastPostUrl("nologin.html", "username=" + uname + "&pass=" + passwd);
}

SingleNoLoginFunction.prototype.send = function() {
    uname = document.getElementById("idname").value;
    passwd =  document.getElementById("idpass").value;

    if( uname == "" || passwd == "") {
    	this.clear();
		document.getElementById("trname").style.color="#DA1347";
		document.getElementById("trpasswd").style.color="#DA1347";
		document.getElementById("aMsg").innerHTML = 'Всички полета са задължителни!';
    	return;
    } else {
    	document.getElementById("trname").style.color="";
    	document.getElementById("trpasswd").style.color="";
    	addr= new Array();
    	addr[0] = BASE_URL + "nologin.html";
    	addr[1] = "username=" + uname + "&pass=" + passwd;
    	swapFunction.sendData("getLoginData", addr);
   	}
}
SingleNoLoginFunction.prototype.clear = function() {
    	document.getElementById("idname").value = "";
    	document.getElementById("idpass").value = "";
}
SingleNoLoginFunction.prototype.clearClose = function(msg) {
		document.getElementById("flashPlayer").style.visibility = "visible";
		if (document.getElementById("vendorsGalleryPane").style.height != "460px") {
			document.getElementById("Zoom").style.visibility = "visible";
		}
		document.getElementById("loginRequired").style.display = "none";
		document.getElementById("trname").style.color="";
		document.getElementById("trpasswd").style.color="";
		document.getElementById("upload").style.display = "none";
		document.getElementById("aMsg").innerHTML = "";
		document.getElementById("message").value = "I found this while doing some wedding research.  Check it out:";
		resizeHandler.openWindow = false;
		this.clear();
}
SingleNoLoginFunction.prototype.ErrorMessage = function(msg) {
	document.getElementById("aMsg").innerHTML = msg;
	this.clear();
}
SingleNoLoginFunction.prototype.CloseShareWin = function() {
	shareWin.close();
	resizeHandler.openWindow = false;
	document.getElementById("flashPlayer").style.visibility = "visible";
	if (document.getElementById("vendorsGalleryPane").style.height != "460px") {
		document.getElementById("Zoom").style.visibility = "visible";
	}
	document.getElementById("sMsg").innerHTML = "";
	document.getElementById("upload").style.display = "none";
	document.getElementById("message").value = "I found this while doing some wedding research.  Check it out:";
}
function alertMessage(whoMessage, newAction) {
	if(whoMessage == 2) {
		action = newAction;
		document.getElementById("popupWindowTitle").innerHTML = "Вход в системата";
		document.getElementById("blanket").style.display = "block";
		document.getElementById("popupBoxContainer").style.display = "block";
		document.getElementById("centerPopUpContainer").style.display = "block";
		setTransparentPosition("popupBoxContainer");
	}
}

function forgotPassword() {
	document.getElementById("popupWindowTitle").innerHTML = "Забрвена парола";
	document.getElementById("blanket").style.display = "block";
	document.getElementById("popupBoxContainer").style.display = "block";
	document.getElementById("lostPassword").style.display = "block";
	setTransparentPosition("popupBoxContainer");
}