function wishlist() {
	
	this.delete = function($giftId){
		this.rpc("/tools/rpc.php?action=deleteGift&giftId="+$giftId);
	}

	this.disable = function($giftId){
		this.rpc("/tools/rpc.php?action=disableGift&giftId="+$giftId);
	}

	this.enable = function($giftId){
		this.rpc("/tools/rpc.php?action=enableGift&giftId="+$giftId);
	}

	this.disableGift = function($giftId, $message){
		document.getElementById("gift-"+$giftId).className = "gift disabled";
		document.getElementById("gift-hidden-"+$giftId).innerHTML = $message;
	}

	this.enableGift = function($giftId){
		document.getElementById("gift-"+$giftId).className = "gift";
		document.getElementById("gift-hidden-"+$giftId).innerHTML = "";
	}

	this.rpc = function( $url ){
		if (window.$_urlRpcElement){
			window.document.body.removeChild(window.$_urlRpcElement);
		}
		window.$_urlRpcElement = window.document.createElement("SCRIPT");
		window.$_urlRpcElement.src = $url;
		window.document.body.appendChild(window.$_urlRpcElement);
	}

	this.changepass = function(){
		this.rpc("/tools/rpc.php?action=getPass&email="+document.getElementById("receivepass").value);
	}
}

$wishlist = new wishlist();

//======================================================================================

function gift() {

	this.reserve = function( $giftId ){
		$wishlist.rpc("/tools/rpc.php?action=reserveGift&giftId="+$giftId);
	}
	this.unreserve = function( $giftId ){
		$wishlist.rpc("/tools/rpc.php?action=unreserveGift&giftId="+$giftId);
	}

	this.clone = function ($giftId){
		$wishlist.rpc("/tools/rpc.php?action=cloneGift&giftId="+$giftId);
	}

	this.showForm = function(){
		document.getElementById("gift-new-form").style.display = "";
		document.getElementById("gift-select-action").style.display = "none";
		return false;
	}
	this.hideForm = function(){
		document.getElementById("gift-new-form").style.display = "none";
		document.getElementById("gift-select-action").style.display = "";
		return false;
	}
	
}
$gift = new gift();

function focusSelect($select, $isPass)
{
	if ($select.isChanged){
		return;
	}
	$select.value = "";
	$select.isChanged = 1;
	if ($isPass){
		$select.type = "password";
	}
	$select.style.color = "#000000";
}
