﻿// JScript File

// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required

var AC_FL_RunContent = 0;
var DetectFlashVer = 0;

var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 24;
// -----------------------------------------------------------------------------
// -->


function addMemberComment(ArticleId,MemberId)
{
    window.radopen('./AddMemberComment.aspx?a='+ArticleId+'&m='+MemberId,'AddMemberCommentForm');
}

function showMemberRegistraion()
{
    window.radopen('./MemberRegistration.aspx','RegistrationForm');
}  

function showMemberRegistrationNewsLetter()
{
    window.radopen('./MemberRegistration.aspx?newsletter=1','RegistrationForm');
}      

function showMemberRegistrationBeforeVote(voteid)
{
    var msg ='To vote you must register here as a MiNDFOOD member. If you are already a MiNDFOOD member, sign in and then vote. '; 
    var title ='Vote here';
    window.radopen('./MemberRegistration.aspx?newsletter=1' +'&rsig=' + voteid +'&msg=' + msg + '&title=' + title,'RegistrationForm');
}
     
function showLogon(mode,msg,title)
{
   window.radopen('./MemberLogon.aspx?mode=' + mode +'&msg=' + msg +'&title=' + title,'GetInTouchForm');
}     
     
function showGetInTouch()
{
    window.radopen('./GetInTouch.aspx','GetInTouchForm');
}         
    
function showSubScription()
{
    window.radopen('./Subscription.aspx','SubScriptionForm');
}

function showRegionSelection()
{
    window.radopen('./SelectRegion.aspx','SubScriptionForm');
}

function showNewsLetter()
{
    window.radopen('./newsletter/index.html','NewsLetter');
}


function showEmailToFriend(ahref)
{
    window.radopen('./EmailToFriend.aspx?subject=article&a='+ahref,'EmailToFriendForm');
}
    
function showEmailToFriendAll()
{
    window.radopen('./EmailToFriend.aspx?subject=mindfood','EmailToFriendForm');
}

function showForgotPassword()
{
    window.radopen('./ForgotPassword.aspx','ForgotPassword');
}
    

    
function ToggleAccountInfo()
{
    document.getElementById("AccountContainer").style.display=(document.getElementById("AccountContainer").style.display=='none'?'':'none');
}

function showInfo(InfoString)
{
    radalert(InfoString,500, 200);
}

function showSuccess(InfoString)
{
    radprompt(InfoString,'',500,200);
}

function showSuccessAndRefresh(InfoString)
{
    radconfirm(InfoString,'',500,200);
}
    
    
    
    
function Bookmark()
{
    var urlAddress = "http://www.mindfood.com";
    var pageName = "MindFood";

    if (window.external)
    {
        window.external.AddFavorite(urlAddress,pageName); 
    }
    else
    { 
    alert("Sorry! Your browser doesn't support this function.");
    }
}
    
function PopupSubscribe(url)
{
	
	newwindow=window.open(url,'Subscribe','resizable=1,toolbar,menubar,scrollbars,status,titlebar,width=950,height=650,alwaysRaised=yes');
	if (window.focus) {newwindow.focus()}
}

function checkKeyword()
{
    var keywordInput = document.getElementById('ctl00$tbSearch');
    if (keywordInput!=null)
    {
        if (keywordInput.value.length==0 || keywordInput.value=='Enter keywords')
        {
            retrievePosition(keywordInput);
            alert("Please enter keywords")
        }else
        {
            return true;
        }
    }
    return false;
}
	
function setKeyword(e,status,initValue)
{
    var keywordInput = e;
    if (keywordInput!=null)
    {
        if (status=='0')
        {
            if (keywordInput.value==initValue)
            {
                keywordInput.value='';
            }
        }
        else
        {
            if (keywordInput.value.replace(/ /,'').length==0)
            {
                keywordInput.value =initValue;
            }
        }
            
    }
}
	
	
	
function retrievePosition(e)
{
    if (e!= null)
    {
	    setTimeout(function(){e.focus();e.select();} ,1);
	}
}

function CheckLength(TargetObject, MaxLenth)
{
    LenString = TargetObject.value.length;
    if (LenString > MaxLenth){
        TargetObject.value = TargetObject.value.substring(0,MaxLenth);
    }
}