	function clearText(thefield)
	{
		if (thefield.defaultValue==thefield.value)
			thefield.value = ""
	} 

	if (/Mozilla\/5\.0/.test(navigator.userAgent))
	{
		document.write('<script type="text/javascript" src="/js/mozInner.js"><\/script>');
	}

	var gIsActive;
	gIsActive = true;
	gIsIEMode = 0;

	function MozillaWinFocused(aEvent) 
	{
		gIsActive = true;
		gEBI('verytest1').innerHTML = "uniseek focused moz " + gIsActive;
	}
	
	function MozillaWinLost(aEvent) 
	{ 
		gIsActive = false;
		gEBI('verytest1').innerHTML = "uniseek lost moz " + gIsActive;
	}
	
	function IEWinFocused() 
	{
		gIsActive = true;
		gEBI('verytest1').innerHTML = "uniseek focused " + gIsActive;
	}
	
	function IEWinLost() 
	{ 
		gIsActive = false;
		gEBI('verytest1').innerHTML = "uniseek lost " + gIsActive;
	}


	function FavoriteListingItem(pItemId, pFlag, pItemType)
	{
		if (pFlag == 'off')
		{
			var answer = confirm ("Listing will be removed from favorites. \r\n Are you sure?");
			if (answer)
			{
				$j.ajax({
					type: "POST",
					url: "/listingmanager.php",
					data: "action=dofavoritelisting&flag="+pFlag+"&itemid="+pItemId+"&itemtype="+pItemType,
					success: function(){
						if ($j('#fav_div').length)
							$j("#fav_div").html('<a onclick="FavoriteListingItem(\''+pItemId+'\', \'on\', \''+pItemType+'\');return false;"  href="#"><img style="vertical-align: middle;" class="png" src="/img3/badge_fav_off.png" title="Save for later" alt="Save for later" /> Save for later</a>');
						if ($j('#fav_li').length)
							$j("#fav_li").html('<img src="/img2/fav_blue.gif" alt="" style="vertical-align: middle" /> <a href="#" onclick="FavoriteListingItem(\''+pItemId+'\', \'on\', \''+pItemType+'\');return false;">Mark item as favorite</a>');
						if ($j('#result_'+pItemId).length)
							$j('#result_'+pItemId+' .description span.nowrap').html(' - [<a onclick="FavoriteListingItem(\''+pItemId+'\', \'on\', \''+pItemType+'\');return false;"  href="#">save for later</a>]');
							
						if ($j('#result_'+pItemId+'_fav').length)
							$j('#result_'+pItemId+'_fav').remove();
						
	   				}
				});
				return false;
			}
			else
			{
				return false;
			}
		}
		
		$j.ajax({
			type: "POST",
			url: "/listingmanager.php",
			data: "action=dofavoritelisting&flag="+pFlag+"&itemid="+pItemId+"&itemtype="+pItemType,
			success: function(){
				if ($j('#fav_div').length)
					$j("#fav_div").html('<a onclick="FavoriteListingItem(\''+pItemId+'\', \'off\', \''+pItemType+'\');return false;"  href="#"><img style="vertical-align: middle;" class="png" src="/img3/badge_fav_on.png" title="Remove from favorites" alt="" /> Remove from saved items</a>');
				if ($j('#fav_li').length)
					$j("#fav_li").html('<img src="/img2/fav_delete.gif" alt="" style="vertical-align: middle" /> <a href="#" onclick="FavoriteListingItem(\''+pItemId+'\', \'off\', \''+pItemType+'\');return false;">remove favorite mark</a>');
				if ($j('#result_'+pItemId).length)
				{
					//alert('222');
					$j('#result_'+pItemId+' .description span.nowrap').html(' - [<a onclick="FavoriteListingItem(\''+pItemId+'\', \'off\', \''+pItemType+'\');return false;"  href="#">remove from saved items</a>]');
					
				}
					
   			}
		});
		
		return false;
	}

	
	
	
	