/************************************************************************************************
//	# File Name: custom.js
//	# File Version: v 1.0
//	# Created By: Patel Dharmesh K.
//	# Created On: 12 Jan 2011
//	# Last Modified By:
//	# Last modified On:
************************************************************************************************/

/************************************************************************************************ 
//  Function Name : chRecipeImage
//	# Created By: Dharmesh K. Patel
//	# Created On: 12 Jan 2011
//	Last Modified By:
//	Last modified On:
//  Purpose : Change Recipe Search Page Image. 
//  Params : imageSrc(Path to image)
************************************************************************************************/
function chRecipeImage(imageSrc,href)
{
	document.getElementById('imgRecipeImage').src=imageSrc;	
	//document.getElementById('divSearchResult a').href=href;
	$('#divSearchResult a').attr('href',href);
}

/************************************************************************************************ 
//  Function Name : chImageSrc
//	# Created By: Dharmesh K. Patel
//	# Created On: 12 Jan 2011
//	Last Modified By:
//	Last modified On:
//  Purpose : Change Vegetable/Fruit Page Image. 
//  Params : imageSrc(Path to image)
************************************************************************************************/

function chImageSrc(imageSrc)
{
	document.getElementById('categoryImage').src=imageSrc;
}

/************************************************************************************************ 
//  Function Name : sortPage
//	# Created By: Dharmesh K. Patel
//	# Created On: 12 Jan 2011
//	Last Modified By:
//	Last modified On:
//  Purpose : Sort Vegetable/Fruit Page Info. 
//  Params : sortBy(Order Of Sorting 'S'=>Sort By Season 'A'=>Sort Alphabatically)
************************************************************************************************/

function sortPage(sortBy)
{
	
	if(sortBy=='S')
	{
		document.getElementById('divSeasonLink').style.display='none';
		document.getElementById('divAlpha').style.display='none';
		
		document.getElementById('divAlphaLink').style.display='block';
		document.getElementById('divSeason').style.display='block';
	}
	else
	{
		document.getElementById('divSeasonLink').style.display='block';
		document.getElementById('divAlpha').style.display='block';
		
		document.getElementById('divAlphaLink').style.display='none';
		document.getElementById('divSeason').style.display='none';
	}
}

/************************************************************************************************ 
//  Function Name : hide_show_data
//	# Created By: Dharmesh K. Patel
//	# Created On: 12 Jan 2011
//	Last Modified By:
//	Last modified On:
//  Purpose : Show Hide Recipe List In Recipe Search Form. 
//  Params : ul_id(link id to show/hide)
************************************************************************************************/

function hide_show_data(ul_id)
{
	if(document.getElementById(ul_id))
	{
		if(document.getElementById(ul_id).style.display=='none')
		{
			document.getElementById(ul_id).style.display='block';
			cText=document.getElementById('link_'+ul_id).innerHTML;
			temp=cText.substring((cText.indexOf('All'))+3);
			document.getElementById('hide_link_'+ul_id).style.display='block';
			document.getElementById('show_link_'+ul_id).style.display='none';
			$('#test_link_'+ul_id).val('true');
			
		}
		else
		{
			document.getElementById(ul_id).style.display='none';
			cText=document.getElementById('link_'+ul_id).innerHTML;
			temp=cText.substring((cText.indexOf('All'))+3);
			document.getElementById('hide_link_'+ul_id).style.display='none';
			document.getElementById('show_link_'+ul_id).style.display='block';
			$('#test_link_'+ul_id).val('false');
		}
			
	}
}

