/**
 * This function will add a product to the users wishlist
 * 
 * @return boolean if the new value is succes
 */
function addToWishlist( BasePath, ProductIndex, WishlistUrl ) {
	
	var ScriptURL = BasePath + 'Account/Wishlist/Ajax.php';
	
	var httpObject = getHTTPObject();

	var lijst = document.getElementById( 'Verlanglijst' + ProductIndex );
	if ( lijst != null && httpObject != null) {
		
		//Opening the connection
		httpObject.open( "POST", ScriptURL, false );
		httpObject.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
		
		//Setting up params and sending them
		var Params = "ProductIndex=" + ProductIndex;
		httpObject.send( Params );
		
		//Based on the ajax response we will determin if it went ok or not.
		response = httpObject.responseText;
		
		if ( response == 'added' ) {
			
			lijst.innerHTML = '<a href="' + WishlistUrl + '"><img alt="Hyves" src="' + AbsPath + 'images/Social/NaarVerlanglijstje2.png" /></a>';
			var icons = document.getElementById( "SocialIcons" );
			if( icons != null ) {
				icons.innerHTML = '<img alt="Hyves" src="' + AbsPath + 'images/Social/HyvesLarge.png" />&nbsp;<img alt="Twitter" src="' + AbsPath + 'images/Social/TwitterLarge.png" />';
			}
		}
		
	}
	
}

function openWishlistInfo() {
	if( document.getElementById( 'WishlistInfo' ).style.display == 'block' ) {
		document.getElementById( 'WishlistInfo' ).style.display = 'none';
	} else {
		document.getElementById( 'WishlistInfo' ).style.display = 'block';
	}	
}
