﻿// JScript File
var GlobalFormId

var ArticleBody
var radAL
var PagesVisited = new Array()
var TopicsPage
var CurrentPage = 0
var CurrentArticle
PagesVisited[0] = 1
function ArticleMouseOver(ControlId,PageId){
    ControlId.src = "/images/articles/paging/" + PageId + "o.jpg"
}

function ArticleMouseOut(ControlId,PageId){
    Visited = false
    for(i=0;i<PagesVisited.length-1;i++){
        if(PagesVisited[i] == PageId) { Visited = true }
    }
    if(CurrentPage == PageId){
        ControlId.src = "/images/articles/paging/" + PageId + "o.jpg"
    } else {
        if(Visited == true ){
            ControlId.src = "/images/articles/paging/" + PageId + "v.jpg"
        } else {
            ControlId.src = "/images/articles/paging/" + PageId + "l.jpg"
        }
    }
}

function ChangePage(rad,PageId){
    Visited = false
    CurrentPage = PageId + 1
    for(i=0;i<PagesVisited.length;i++){
        if(PagesVisited[i] == (PageId+1)) { Visited = true }
    }
    if(Visited == false ){
        PagesVisited[PagesVisited.length] = PageId + 1
    }
    ajaxManager = $find(rad);
    ajaxManager.ajaxRequest(PageId);
}

function UpdatePaging(){
    for(i=0;i<PagesVisited.length;i++){
        if(CurrentPage != PagesVisited[i]){
            document.getElementById("Page" + PagesVisited[i]).src = "/images/articles/paging/" + PagesVisited[i] + "v.jpg"
        } else {
            document.getElementById("Page" + PagesVisited[i]).src = "/images/articles/paging/" + PagesVisited[i] + "o.jpg"
        }
    }
    location.hash = "#Top"
    LoadTopics()
}

function GoToArticle(ArticleId){
    ajaxManager = $find(radAL);
    ajaxManager.ajaxRequest(ArticleId);
}

function SliderLoaded(sender, eventArgs) {  
    FontSlider = sender
    setTimeout("SliderInitialLoad()",100)
}
function SliderInitialLoad(){
    FontSlider.set_value(FontSize)
}
function SliderChanged(sender, eventArgs) {
    UpdateFontSize(sender.get_value())
    SaveFontSize()
}

function UpdateFontSize(NewSize){
    FontSize = NewSize
    document.getElementById("ArticleBody").style.fontSize = NewSize + "px";
}

function SaveFontSize(){
    if(IsSaving == false) {
        ajaxManager = $find(radFont);
        ajaxManager.ajaxRequest(FontSize);
        IsSaving = true;
    } else {
        setTimeout("SaveFontSize()",1000)
    }
}
function SaveComplete(){
    IsSaving = false
}

function LoadTopics(){
    document.getElementById("TopicLocation").innerHTML = document.getElementById("ltTest").innerHTML
    document.getElementById("ltTest").innerHTML = ""
}

function MenuOver(ControlId){
    ControlId.className = "TopicOn"
}
function MenuOut(ControlId){
    ControlId.className = "TopicOff"
}
function EmailThisPage(){
    LoadTellAFriend("articles.aspx?ArticleTitle=" + CurrentArticle, CurrentArticle,3)
}
function GoToTopic(rad, TopicId){
    ajaxManager = $find(rad);
    ajaxManager.ajaxRequest(TopicId);
}
function GoReadMore(){
    window.location.href= TopicsPage
}

function RightCheck(PubDate,Source){
    var hasSource = false
    if(Source != ""){
        document.write("Source:&nbsp;<i>" + Source + "</i>")
    }
    if(PubDate != ""){
        if(hasSource == true){
            document.write("&nbsp;&nbsp;|&nbsp;&nbsp;")
        }
        hasDate = true
        var mon = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')
        var dte = new Date(PubDate)
        document.write(",&nbsp;&nbsp;" + mon[dte.getMonth()] + " " + dte.getFullYear() + "  ")
    }
}