var rememberedAd = false;

function openWindowAbuse (id, aid) {
	window.open ("/abuse.php?id=" + id + "&adID=" + aid, "", "status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=0, scrollbars=0, height=280, width=400");
}

function openSendToFriend (id) {
	window.open ("/sendToFriend.php?adID=" + id, "", "status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=0, scrollbars=0, height=380, width=400");
}

function rememberAd (id, cid) {

	rememberedAd = !rememberedAd;

	if (rememberedAd) {

		document.getElementById('empty').style.display = "none";
		document.getElementById('loading').style.display = "";

		new Ajax.Request('/saveCheck.php?act=save&adID=' + id + '&catID=' + cid, {
			method:'post',
			onSuccess: function(transport) {
				var response = transport.responseText || "no response text";
				document.getElementById('loading').style.display = "none";
				document.getElementById('check').style.display = "";
			},
			onFailure: function() {
				alert('Something went wrong...')
			}
		});

	} else {

		document.getElementById('check').style.display = "none";
		document.getElementById('loading').style.display = "";

		new Ajax.Request('/saveCheck.php?act=remove&adID=' + id + '&catID=' + cid, {
			method:'post',
			onSuccess: function(transport) {
				var response = transport.responseText || "no response text";
				document.getElementById('loading').style.display = "none";
				document.getElementById('empty').style.display = "";
			},
			onFailure: function() {
				alert('Something went wrong...')
			}
		});

	}

}

function showPicture(path, width, height, scroll) {
  window.open("/picture.php?" + path, "", "left=" + ((screen.width - width) / 2) + ",top=" + ((screen.height - height) / 2) + ",width=" + width + ",height=" + height + ",scrollbars=" + scroll);

  return false;
}
