function spnFAQ_onclick() 
{
    window.open('../FAQ/studyB4FAQ_' + myVars.CurrentLanguage + '.htm','mywindow','toolbar=no, location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no, resizable=yes,height=580,width=780,left=' + (screen.width-780)/2 + ',top=' + (screen.height-580)/2 );
}

function cmdDownload_onclick() 
{
    //Generate a random number so it will force to be taken from the server and not from client cache
    var strUrl = "../Downloads/studyB4Setup.msi?Key=" + Math.floor(Math.random()*100000000);
    
    window.open(strUrl,"_self");
}

function cmdDemoStudy_onclick() 
{
    var intWidth        = 800;
    var intHeight       = 500;

    window.open("../Study/StudyB4Demo.aspx","_blank",'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,copyhistory=no,title="studyB4 Demo",resizable=no,height=' + intHeight + ',width=' + intWidth + ',top=' + (screen.height-intHeight)/2 + ',left=' + (screen.width-intWidth)/2);
}

function spnVideo_onclick()
{
    window.open("page_Video.aspx",'studyB4Video',"toolbar=no, scrollbars=0,location=no,directories=no,status=no,menubar=no,copyhistory=no, resizable=no,height=580,width=790,left=" + (screen.width-790)/2 + ",top=" + (screen.height-580)/2 );
}

// Login with existing account and modify profile
function menuClick(strLocation,strMenuId) 
{   
    var stripeTop = top.document.getElementById("studyB4Master_stripeTop");
    
    if (stripeTop && stripeTop.contentWindow)
    {
        var stripeTopContentWindow = stripeTop.contentWindow;

        if (stripeTopContentWindow.replaceStripeMain)
            stripeTopContentWindow.replaceStripeMain(strLocation,null,strMenuId)
    }
}

function cmdReports_onclick() 
{   
    //More than 1 child, no childs at all, or not logged on
    studyB4_SetBackgroundFilter(true);
    window.location.replace("../Pages/page_Reports.aspx?ReportId=1&Period=rpLastMonth");
}

function cmdContacts_onclick()
{
    if (myVars.IsLoggedOn =="true")
    {
        var divContacts     = document.getElementById("studyB4Master_bodyContent_divContacts");
        var ifrmContacts    = document.getElementById("studyB4Master_bodyContent_ifrmContacts");

        if (ifrmContacts.src)
            ifrmContacts.contentWindow.location.reload(true);
        else
            ifrmContacts.src = "../Frames/frame_Contacts.aspx?Mode=InnerDiv";
        
        divContacts.style.display                                                               = "block";
        document.getElementById("studyB4Master_bodyContent_divRegisteredUser").style.display    = "none";
    }
    else
        window.location.replace("page_Login.aspx?LastUrl=page_Welcome.aspx?Contacts=true");
}

function cmdRegister_onclick()
{
    studyB4_SetBackgroundFilter(true);
    window.location.replace("page_ParentProfile.aspx?New=true");                
}

function closeContacts(intFriendsCount)
{
    document.getElementById("studyB4Master_bodyContent_divRegisteredUser").style.display = "block";
}
