﻿$(document).ready(function() {
    if (document.getElementById('hfLogin').value == "false") {
        alert("Session has expired, please login again");
        parent.window.location.href = "http://www.locallinkup.com";
    }
});

function selected(id) {
    document.getElementById('hfSelected').value = id;
    __doPostBack('hfSelected', '');
}

function returnToParent() {
    parent.showNewPageInPageEditor(document.getElementById('hfPageID').value);
}

function OnScrollClick(id) {
    var timer = 0;
    var galleryTop = document.getElementById('content2').offsetTop;
    var galleryHeight = document.getElementById('content2').offsetHeight;
    if (galleryTop == 0 | galleryTop % 170 == 0) {
        if (id == "down") {
            if (galleryTop < 0) {
                var newPos = (galleryTop + 170).toString() + "px";
                $("#content2").each(function(i) {
                    timer = (timer * .8 + 800);
                    $("#content2").animate({ top: newPos }, timer);
                });
            }
        }
        if (id == "up") {
            if (galleryHeight + galleryTop > 500) {
                var newPos = (galleryTop - 170).toString() + "px";
                $("#content2").each(function(i) {
                    timer = (timer * .8 + 800);
                    $("#content2").animate({ top: newPos }, timer);
                });
            }
        }
    }
}

function setHelpText(id) {
    parent.setWizardText(id);
}

function showDropDown() {
    if (document.getElementById('pageListContainer').style.display == "inline") {
        document.getElementById('pageListContainer').style.display = "none";
    }
    else {
        document.getElementById('pageListContainer').style.display = "inline";
    }
}

function selectPage(id) {
    document.getElementById('hfPageSelected').value = id;
    __doPostBack('hfPageSelected', '');
}
