/*--- WEB VIEW NAVIGATION ---*/

	//goto a puid
	function _goto(puid, multipagearticleid)
	{	
		if (multipagearticleid != null)
		{	
			top.location.href = "/members/index.aspx?puid=" + puid + "&p=" + multipagearticleid;
		}
		else
		{	
			top.location.href = "/members/index.aspx?puid=" + puid;
		}
	}

	//goto a url
	function _gotourl(url, multipagearticleid)
	{	
		if (multipagearticleid != null)
		{	
			top.location.href = url + "&p=" + multipagearticleid;
		}
		else
		{	
			top.location.href = url;
		}
	}

/*--- WEB VIEW POP ---*/

	//goto using puid (POPUP)
	function _gotopop(puid)
	{
		var myWin = window.open("/members/index.aspx?puid=" + puid, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=750');
	}

	//goto using url (POPUP)
	function _gotourlpop(url)
	{
		var myWin = window.open(url, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=750');
	}

/*--- EMAIL VIEW POP ---*/

	//goto send to a friend using puid (POPUP)
	function _sendtofriendpop(puid)
	{	
		myWin = window.open("/mail/sendmail.aspx?puid=" + puid, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=715');
	}

	//goto send to a friend using url (POPUP)
	function _sendtofriendurlpop(url)
	{	
		myWin = window.open("/mail/sendmail.aspx?" + url, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=715');
	}

/*--- PRINT VIEW POP ---*/

	//goto print using puid (POPUP)
	function _gotoprintpop (puid)
	{	
		myWin = window.open("/members/printview.aspx?puid=" + puid , 'myWin4', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=700,height=720');
	}
	
	//goto print using url (POPUP)
	function _gotoprinturlpop (url)
	{	
		myWin = window.open("/members/printview.aspx?" + url , 'myWin4', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=700,height=720');
	}

/*-- SEARCH --*/



function DoSearchHitEnter(event, txtsearch)
{

	if (document.all)
	{
		if(event.keyCode==13)
		{
			event.returnValue=false;
			event.cancel = true;
			DoSearch(txtsearch);
		}
	}
	else if (document.getElementById)
	{
  		if (event.which == 13)
		{
  			event.returnValue=false;
   			event.cancel = true;
   			DoSearch(txtsearch);
		}
	}
	else if(document.layers)
	{
		if(event.which == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			DoSearch(txtsearch);
		}
	}			
}

//Search Site or Recipes based on rblType
function DoSearch(txtsearch)
{
	//go through rbltype radio button list and set searchtype = checked value
	//for( i = 0; i < rbltype.length; i++ )
	//{
	//	if( rbltype[i].checked == true )
	//		searchtype = rbltype[i].value;
	//}
	if(document.getElementById("recipes").checked)
	{
		searchtype = "recipes";
	}else
	{	
		searchtype = "site";
	}

	//depending on searchtype set url
	if (searchtype == "recipes")
	{
		window.location.href = "/members/foodandrecipes/recipes/search.aspx?Search=" + txtsearch;
	}else{
		window.location.href = "/members/search.aspx?q=" + txtsearch;
	}

	//redirect to right search page
	url = "";
	txtsearch = "";

}

//Search Recipes
function DoSearchRecipes(txtsearch, cbfavorite, cbquick)
{
	var url = "/members/tools/recipes/search.aspx?Search=";
	
	url += txtsearch.value;
	
	if(cbfavorite.checked == true)
		url += "&showfavoritesonly=true";
	
	if(cbquick.checked == true)
		url += "&showvaluedatas=quick";
	
	//redirect to right search page
	document.location.href = url;
}

/*-- ARTICLE PRINT--*/
	function printit() {  
		if (window.print) {
			window.print() ;  
		} else {
			var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
			WebBrowser1.ExecWB(6, 2);
		}
	}	
	
function ConfirmCancel() {
	if (confirm("All changes will be lost. Are You sure you want to continue?")) {
		document.location.href  = '/members/blog/landing.aspx';
		
	}
}

function ConfirmDelete() {
	 return confirm("Are you sure you want to delete this item?");
}