route = function ( url ){
if(url!="0"){
window.location.href=url;
}
}


PeriodicalExecuter.prototype.registerCallback = function() {
this.intervalID = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
}

PeriodicalExecuter.prototype.stop = function() {
clearInterval(this.intervalID);
}

function ATSWF(){
ScrollArrow('right','navigation','scroller','frame1-pane');
}

function sineInOut(t, b, c, d)
{
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
}

function findElementPos(elemFind)
{
var elemX = 0;
var elemY = 0;
do {
elemX += elemFind.offsetLeft;
elemY += elemFind.offsetTop;
} while ( elemFind = elemFind.offsetParent )
return Array(elemX, elemY);
}


var currentSection = "frame1-pane";
var h_s = "-tab";
var f_s = "-pane";

function ScrollSection(link, scrollArea, offset){
if (currentSection == link) {
return;
}
lastSection = currentSection;
currentSection = link;
    sectionTab = currentSection.split("-")[0] + h_s;
    $(sectionTab).className = "selected";
    if (lastSection) {
    lastTab = lastSection.split("-")[0] + h_s;
    $(lastTab).className = "normal";
}
theScroll = $(scrollArea);
position = findElementPos($(link));
if (offset != "") {
offsetPos = findElementPos($(offset));
position[0] = position[0] - offsetPos[0];
}
scrollStart(theScroll, theScroll.scrollLeft, position[0], "horiz");
}
ScrollArrow = function (direction, toolbar, scrollArea, offset) {
toolbarElem = $(toolbar);
toolbarNames = new Array();
if (toolbarElem.hasChildNodes())
{
var children = toolbarElem.childNodes;
for (var i = 0; i < children.length; i++) 
{
if (toolbarElem.childNodes[i].tagName == "A") {
toolbarNames.push(toolbarElem.childNodes[i].id.split("-")[0]);
}
}
}
for (var i = 0; i < toolbarNames.length; i++) {
if (toolbarNames[i] == currentSection.split("-")[0]) {
if (direction == "left") {
if (i - 1 < 0) {
gotoTab = toolbarNames[toolbarNames.length - 1];
} else {
gotoTab = toolbarNames[i - 1];
}
} else {
if ((i + 1) > (toolbarNames.length - 1)) {
gotoTab = toolbarNames[0];
} else {
gotoTab = toolbarNames[i + 1];
}
}
}
}
ScrollSection(gotoTab+f_s, scrollArea, offset);
}
var scrollanim = {time:0, begin:0, change:0.0, duration:0.0, element:null, timer:null};

scrollStart=function(elem, start, end)
{
if (scrollanim.timer != null) {
clearInterval(scrollanim.timer);
scrollanim.timer = null;
}
scrollanim.time = 0;
scrollanim.begin = start;
scrollanim.change = end - start;
scrollanim.duration = 25;
scrollanim.element = elem;
scrollanim.timer = setInterval("scrollHorizAnim();", 15);
}

scrollHorizAnim=function()
{
if (scrollanim.time > scrollanim.duration) {
clearInterval(scrollanim.timer);
scrollanim.timer = null;
}
else {
move = sineInOut(scrollanim.time, scrollanim.begin, scrollanim.change, scrollanim.duration);
scrollanim.element.scrollLeft = move;
scrollanim.time++;
}
}
