﻿function _popup(url) {
	myWin = window.open(url, 'blank', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=780');
}
function _popOpenerLink(url) {
	myWin = window.open("/members/index.aspx?print=true&puid="+url, 'blank', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=780');
}

//function _gotoprint(id, qs) {
//	myWin = window.open("/members/index.aspx?print=true&puid=" + id + '&' + qs, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=750');
//}
function _gotoprint(id) {
	myWin = window.open("/members/index.aspx?print=true&puid=" + id, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=750');
}
function _gotoprintpop (puid){	
	myWin = window.open("/members/printview.aspx?puid=" + puid , 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=700,height=720');
}
function _gotoprintpopup(id) {
	myWin = window.open("/members/index.aspx?print=true&puid=" + id, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=750');
}
function _gotoprinturlpop (url) {	
	myWin = window.open("/members/printview.aspx?" + url , 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=700,height=720');
}
//function _gotoprintfoodlog(id, qs) {
//	myWin = window.open( id + '&' + qs, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=750');
//}

function _gotourlpop(url) {
	myWin = window.open(url, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=650,height=750');
}
function _gotopop(puid) {
	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');
}

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;
	}
}
function _gotourl(url, multipagearticleid) {	
	if (multipagearticleid != null) {	
		top.location.href = url + "&p=" + multipagearticleid;
	} else {
		top.location.href = url;
	}
}

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');
}
function _sendtofriendurlpop(url) {	
	myWin = window.open("/mail/sendmail.aspx?url=" + url, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=670,height=715');
}

function _sendtofriendpopfitness(st) {
    myWin = window.open("/mail/sendmail.aspx?" + st, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=675,height=715');
}

function _gotoprintfitness(id, d) {
    myWin = window.open("/members/index.aspx?print=true&puid=" + id + "&" + d, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=675,height=750');
}

function goNutritionSearch() {
   
    encodedString = escape(document.getElementById("txtNutritionSearch").value);
    window.location.href = "/members/foodandrecipes/nutrition/search.aspx?s=" + encodedString;
    return false;
}
function goRecipeSearch() {
    location.href = "/members/foodandrecipes/recipes/search.aspx?search=" + document.getElementById("txtRecipeSearch").value;
}


function popToggle(url) {
    var myWin = window.open(url, 'myWin', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=650,height=750');
}


//REMO - Marketing Task
function sitePerformedInvite(id) {
    return document.cookie.match(/REMO_INVITE=[^;]+/);
}
function siteInvited(id) {
    var ex = new Date(new Date().getTime() + (86400000 * 30));
    document.cookie = 'REMO_INVITE' + '=' + escape(id || '1') + '; expires=' + ex.toGMTString();
}

//returns an element based on name
function FindElement(e) {
    var elm = null;
    for (i = 0; i < document.forms[0].elements.length; i++) {
        if (document.forms[0].elements[i].name.indexOf(e) != -1) {
            elm = document.forms[0].elements[i];
            break;
        }
    }
    return elm;
}

addEvent(window, 'load', NutritionSearch, false);
