//<!--

//MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2008 Valerio Proietti, <http://mad4milk.net>, MIT Style License.
Fx.Slide=new Class({Extends:Fx,options:{mode:"vertical"},initialize:function(B,A){this.addEvent("complete",function(){this.open=(this.wrapper["offset"+this.layout.capitalize()]!=0);
if(this.open&&Browser.Engine.webkit419){this.element.dispose().inject(this.wrapper);}},true);this.element=this.subject=$(B);this.parent(A);var C=this.element.retrieve("wrapper");
this.wrapper=C||new Element("div",{styles:$extend(this.element.getStyles("margin","position"),{overflow:"hidden"})}).wraps(this.element);this.element.store("wrapper",this.wrapper).setStyle("margin",0);
this.now=[];this.open=true;},vertical:function(){this.margin="margin-top";this.layout="height";this.offset=this.element.offsetHeight;},horizontal:function(){this.margin="margin-left";
this.layout="width";this.offset=this.element.offsetWidth;},set:function(A){this.element.setStyle(this.margin,A[0]);this.wrapper.setStyle(this.layout,A[1]);
return this;},compute:function(E,D,C){var B=[];var A=2;A.times(function(F){B[F]=Fx.compute(E[F],D[F],C);});return B;},start:function(B,E){if(!this.check(arguments.callee,B,E)){return this;
}this[E||this.options.mode]();var D=this.element.getStyle(this.margin).toInt();var C=this.wrapper.getStyle(this.layout).toInt();var A=[[D,C],[0,this.offset]];
var G=[[D,C],[-this.offset,0]];var F;switch(B){case"in":F=A;break;case"out":F=G;break;case"toggle":F=(this.wrapper["offset"+this.layout.capitalize()]==0)?A:G;
}return this.parent(F[0],F[1]);},slideIn:function(A){return this.start("in",A);},slideOut:function(A){return this.start("out",A);},hide:function(A){this[A||this.options.mode]();
this.open=false;return this.set([-this.offset,0]);},show:function(A){this[A||this.options.mode]();this.open=true;return this.set([0,this.offset]);},toggle:function(A){return this.start("toggle",A);
}});Element.Properties.slide={set:function(B){var A=this.retrieve("slide");if(A){A.cancel();}return this.eliminate("slide").store("slide:options",$extend({link:"cancel"},B));
},get:function(A){if(A||!this.retrieve("slide")){if(A||!this.retrieve("slide:options")){this.set("slide",A);}this.store("slide",new Fx.Slide(this,this.retrieve("slide:options")));
}return this.retrieve("slide");}};Element.implement({slide:function(D,E){D=D||"toggle";var B=this.get("slide"),A;switch(D){case"hide":B.hide(E);break;case"show":B.show(E);
break;case"toggle":var C=this.retrieve("slide:flag",B.open);B[(C)?"slideOut":"slideIn"](E);this.store("slide:flag",!C);A=true;break;default:B.start(D,E);
}if(!A){this.eliminate("slide:flag");}return this;}});


function showbox(id)
{
    //alert('open id: '+id);
    var showText = document.getElementById('k' + id);
    var showTextHeader = document.getElementById('k' + id + 'opener');
    var cname = 'nest_' + parseUri(window.location).path;
    if (showText.style.display == 'none') {
          //open nest
          showText.style.display = 'block';
          showTextHeader.style.display = 'none';
          //set cookie
          SetNestedCookie (cname, id);
          //alert('set "open" cookie');
    }
    else {
          //close nest
          showText.style.display = 'none';
          showTextHeader.style.display = 'block';
          //clear cookie
          eraseCookie(cname);
          //alert('erase cookie');
    }
}
function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
              return pair[1];
        }
    } 
}
  
    window.addEvent('domready', function(){
   
        //alert($('nav'));
        //function to set up main navigation links
        $('nav').getElements('div.cover').each( function( elem ){
            //alert(elem.id);
            elemid = elem.id;
            elem2id = 'mainnav_' + elemid;
            $('nav').getElements('li.menu').each( function( elem3 ){
                //alert(elem3.id);
                if (elem3.id == elem2id) {
                    var list = elem3.getElement('div.sub');
                    var myFx = new Fx.Slide(list).hide();
                    //var myFx = new Fx.Slide(list);
                    list.setStyle('display', '');
                    elem.addEvents({
                        'mouseenter' : function(){ 
                        //alert('hover');                    
                        myFx.cancel();
                        myFx.slideIn();                    
                    },
                    'mouseleave' : function(){ 
                        myFx.cancel();
                        myFx.slideOut(); 
                        myFx.addEvent('complete', function() 
                        {
                            if (! myFx.open) { 
                                elem.getElement('a').className = '';
                            }
                        }); 
                     }
                    });    
                    elem3.addEvents({
                        'mouseenter' : function(){ 
                         //alert('hover');                    
                        myFx.cancel();
                        myFx.slideIn();                    
                    },
                    'mouseleave' : function(){ 
                        myFx.cancel();
                        myFx.slideOut();
                        elem.getElement('a').className = '';                  
                    }
                    });
                }
            });    
        });
    });
function OpenVideoWindow(theURL) { 
window.open(theURL,'newWindow','width=320, height=240, resizable=no, scrollbars=no, toolbar=no, status=no');
}
function shoutout(txt) {
    alert(txt);
}
function getFileName()
{
   wholeurl = window.location.href;
    //alert(parseUri(wholeurl).path);
    return parseUri(wholeurl).path
    }
 function parseUri (str) {
    var    o   = parseUri.options,
        m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
        uri = {},
        i   = 14;
    while (i--) uri[o.key[i]] = m[i] || "";
    uri[o.q.name] = {};
    uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
        if ($1) uri[o.q.name][$1] = $2;
    });
    return uri;
};
parseUri.options = {
    strictMode: false,
    key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
    q:   {
        name:   "queryKey",
        parser: /(?:^|&)([^&=]*)=?([^&]*)/g
    },
    parser: {
        strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
        loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
    }
};

window.addEvent('domready', function(){
//open the THCF modal video window if the querystring parameter exists
var pageQs = parseUri(window.location).query;
if (pageQs == 'ShowTHCFvideo') {   
    Mediabox.open('/us/en/difference/thcfvideowindow.html', 'Tim Hortons Childrens Foundation', '840 520');
    urchinTracker('THCF_VideoPopup_View');
}
if (pageQs == 'ShowTHCFvideo_fr') {
    Mediabox.open('/us/en/difference/thcfvideowindow.html', 'Tim Hortons Childrens Foundation', '840 520');
    urchinTracker('THCF_VideoPopup_View');
}
if (pageQs == 'ShowTHCFbecausevideo') {   
    Mediabox.open('/us/en/difference/thcfbecausevideo.html', 'Tim Hortons Childrens Foundation', '840 520');
    urchinTracker('THCF_VideoPopup_View');
}
if (pageQs == 'ShowTHCFbecausevideo_fr') {
    Mediabox.open('/us/en/difference/thcfbecausevideo.html', 'Tim Hortons Childrens Foundation', '840 520');
    urchinTracker('THCF_VideoPopup_View');
}
});



function OpenPrintWindow(theURL) { 
    var anc1 = parseUri(window.location).anchor;
    var qs1 = parseUri(window.location).query;
    if(qs1 !== '') {
        theURL += '?'+qs1;
        theURL += '&mode=print';
    }else{
        theURL += '?mode=print';
    }
    if(anc1 !== '') {
        theURL += '#'+anc1;
    }
window.open(theURL,'newWindow','width=703, height=600, resizable=yes, scrollbars=yes, toolbar=no, status=no, location=no, menubar=no');
}
function redirecttimcarduser(landingpage) {
    //do nothing
}
//header flash for coffee pour
swfobject.embedSWF("/us/flash/coffeepour_us.swf", "coffeepourflash", "211", "140", "7", "false", "false", {wmode:"transparent"});
function ShowHidePromo(promo1,promo2,promo3,promo4){    
    $(promo1).setStyle('display', 'block');
    $(promo2).setStyle('display', 'none');
    $(promo3).setStyle('display', 'none');
    $(promo4).setStyle('display', 'none');
} 
function loadFreshNews(offset, langvar) {
    $("freshnewscontent").innerHTML = '<img src="/us/images/core/ajax-loader_freshnews.gif" style="margin-left:35px;" />';    
    var qstr =  'offset=' + offset + '&langvar=' + langvar + '&wifi=false&' + Math.random(); 
    var myRequest = new Request({
            method: 'get', 
            url: '/us/ajax/freshnewsAJAX.php',
            data: qstr,
            noCache: true,
            onComplete: function(response) {
                $("freshnewscontent").innerHTML = response;
            }
        });
    //send ajax request
    myRequest.send();
}  

function loadFreshNewsWifi(offset, langvar) {
    $("freshnewscontent").innerHTML = '<img src="/us/images/core/ajax-loader_freshnews.gif" style="margin-left:35px;" />';    
    var qstr =  'offset=' + offset + '&langvar=' + langvar + '&wifi=true&' + Math.random(); 
    var myRequest = new Request({
            method: 'get', 
            url: '/us/ajax/freshnewsAJAX.php',
            data: qstr,
            noCache: true,
            onComplete: function(response) {
                $("freshnewscontent").innerHTML = response;
            }
        });
    //send ajax request
    myRequest.send();
} 
function showshare1() {
    $("socialmedia").style.visibility = "";
    showtimer = setTimeout("hideshare()",5000);
}
function showshare2() {
    $("socialmedia").style.visibility = "";
    clearTimeout(showtimer);
}
function hideshare() {
    $("socialmedia").style.visibility = "hidden";
}
window.onload = function() {
    document.body.onclick = function() {
        if ($("socialmedia").style.visibility != "hidden") {
            hideshare();
        }
    }
} 
//Social Media links javascript
function dg_click() {
                u=location.href;
                t=document.title;
                window.open('http://digg.com/submit?url='+encodeURIComponent(u)+'&title='+encodeURIComponent(t)+'&bodytext='+encodeURIComponent(t)+'&media=news&topic=tech_news','sharer','toolbar=0,status=0,scrollbars=1,width=800,height=600');
                return false;
}
function ms_click() {
                u=location.href;
                t=document.title;
                window.open('http://www.myspace.com/Modules/PostTo/Pages/?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t)+'&c=','sharer','toolbar=0,status=0,scrollbars=1,width=800,height=600');
                return false;
}
function fb_click() {
                u=location.href;
                t=document.title;
                window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,scrollbars=1,width=800,height=600');
                return false;
}
function dl_click() {
                u=location.href;
                t=document.title;
                window.open('http://delicious.com/post?url='+encodeURIComponent(u)+'&title='+encodeURIComponent(t),'sharer','toolbar=0,status=0,scrollbars=1,width=800,height=600');
                return false;
}
function tw_click() {
                u=location.href;
                t=document.title;
                window.open('http://twitter.com/home?status='+encodeURIComponent(t)+'%20'+encodeURIComponent(u),'sharer','toolbar=0,status=0,scrollbars=1,width=800,height=600');
                return false;
}
function su_click() {
                u=location.href;
                t=document.title;
                window.open('http://www.stumbleupon.com/submit?url='+encodeURIComponent(u)+'&title='+encodeURIComponent(t),'sharer','toolbar=0,status=0,scrollbars=1,width=800,height=600');
                return false;
} 
function CheckAnchor(anchor) {
    var anc = '#'+anchor;
    var nanc = 'K'+anchor;
    var qs = location.hash;
    //alert(qs);
    if (qs!== '') {
        //alert(anc == qs);
        if (anc == qs) {
            //alert(nanc);
            showbox(anchor);    
        } 
    }  
}
function SetCookie (name, value) {  
    var argv = SetCookie.arguments;  
    var argc = SetCookie.arguments.length;  
    var expires = new Date("July 21, 2200 01:15:00");
    var path = "/"  
    var domain = "timhortons.com" 
    var strcookie = name + "=" + escape (value) + "; expires=" + expires.toGMTString() + "; path=" + path + "; domain=" + domain;
    //alert(strcookie);
    document.cookie = strcookie
}
function SetNestedCookie (name, value) {   
    var path = "/"  
    var domain = "timhortons.com" 
    var strcookie = name + "=" + escape (value) + "; path=" + path + "; domain=" + domain;
    //alert(strcookie);
    document.cookie = strcookie
}
function getCookieVal(offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
    endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}
   function GetCookie (name) {  
        var arg = name + "=";  
        var alen = arg.length;  
        var clen = document.cookie.length;  
        var i = 0;  
        while (i < clen) {    
            var j = i + alen;    
            if (document.cookie.substring(i, j) == arg)      
                return getCookieVal (j);    
                i = document.cookie.indexOf(" ", i) + 1;    
                if (i == 0) break;   
        }  
        return null;
    }
function eraseCookie(name) {
    var date = new Date();
    date.setTime(date.getTime()+(-1*24*60*60*1000));
//alert(date);
    //var expires = "; expires="+date.toGMTString();
    
  SetCookie(name, "", date);
}
function ChangeLangVar(url, lang) {
    SetCookie("thlang", lang);
    //alert(url);
    var anc = parseUri(window.location).anchor;
    //alert(anc);
    var qs = parseUri(window.location).query;
    //alert(qs);
    if(qs !== '') {
        //alert('querystring found');
        if (qs.indexOf("sLanguage") != -1 && lang == 'ENC') {
            qs = "";
        }
        if (qs.indexOf("195616") != -1 && lang == 'FRC') {
            qs = qs.replace(/195616/, "197055");
        }
        if (qs.indexOf("197055") != -1 && lang == 'ENC') {
            qs = qs.replace(/197055/, "195616");
        }
        if (qs.indexOf("lang_en") != -1 && lang == 'FRC') {
            qs = qs.replace(/lang_en/, "lang_fr");
        }
        if (qs.indexOf("lang_fr") != -1 && lang == 'ENC') {
            qs = qs.replace(/lang_fr/, "lang_en");
        }
        if (qs.indexOf("ShowTHCFvideo") != -1 && lang == 'FRC') {
            qs = qs.replace(/ShowTHCFvideo/, "ShowTHCFvideo_fr");
        }
        if (qs.indexOf("ShowTHCFvideo_fr") != -1 && lang == 'ENC') {
            qs = qs.replace(/ShowTHCFvideo_fr/, "ShowTHCFvideo");
        }
        url += '?'+qs;
        //alert('new url'+url);
    }
    if(anc !== '') {
        //alert('anchor found');
        url += '#'+anc;
        //alert('new url'+url);
    }
    var protocol = parseUri(window.location).protocol+'://';
    var domain = parseUri(window.location).host;
    var newurl = protocol+domain+url;
    //alert(newurl);
    window.location.href = newurl;   
}
function ChangeLocale(site) { // desired site: 'ca' or 'us'
    //user has decided to change countries...set cookie approprately
    SetCookie("thsite", site);
    var url = window.location.href;
    var domain = 'http://' + parseUri(url).host
    var newurl = '';
    if (site == 'ca') {
        //switching to canada, check cookie to see which language
        var calang = GetCookie('thlang');
        if (calang !='') {
            if (calang == 'FRC'){
                newurl = domain + '/ca/fr/index.html';
            } else {
                newurl = domain + '/ca/en/index.html';
            }
        } else {
            SetCookie("thlang", 'ENC');
            newurl = domain + '/ca/en/index.html';
        }
    } else {
        SetCookie("thlang", 'ENC');
        newurl = domain + '/us/en/index.html';
    }
    window.location = newurl;
}

function showbox(id)
{
    //alert('open id: '+id);
    var showText = document.getElementById('k' + id);
    var showTextHeader = document.getElementById('k' + id + 'opener');
    var cname = 'nest_' + parseUri(window.location).path;
    if (showText.style.display == 'none') {
          //open nest
          showText.style.display = 'block';
          showTextHeader.style.display = 'none';
          //set cookie
          SetNestedCookie (cname, id);
          //alert('set "open" cookie');
    }
    else {
          //close nest
          showText.style.display = 'none';
          showTextHeader.style.display = 'block';
          //clear cookie
          eraseCookie(cname);
          //alert('erase cookie');
    }
}
 
//scripts for the investor landing scroller
function ccbnSetZIndex(objID,index){
    if (document.layers && document.layers[objID] != null) {
        document.layers[objID].zIndex = index;
    }
    else if (document.all) {
        document.all[objID].style.zIndex = index;
    }
    else if (document.getElementById){
       document.getElementById(objID).style.zIndex = index;
    }
}
/* moves the object to the specified X and Y coordinates */
function ccbnDoMove(objectID, moveToX, moveToY, moveToPx) {
//alert('move started');
    if (document.layers && document.layers[objectID] != null) {
        document.layers[objectID].left = moveToX + moveToPx;
        document.layers[objectID].top = moveToY + moveToPx;
    }
    else if (document.all) {
        document.all[objectID].style.posLeft = moveToX;
        document.all[objectID].style.posTop = moveToY;
    }
    else if (document.getElementById){
       document.getElementById(objectID).style.left = moveToX + moveToPx;
       document.getElementById(objectID).style.top = moveToY + moveToPx;
    }
}
function ccbnSetScrollLayerBoundaries(){
    switch(this.scrollDirection){
        case 0:    
                //set the scrollTop for the current layer
                this.scrollTop=this.scrollHeight*-this.scrollLayer;
                //set the scrollScrollLayerY to zero it out
                this.scrollLayerY=this.scrollTop+this.scrollHeight;
                
                break;
        
        case 1:
                //set the scrollTop for the current layer
                this.scrollTop=this.scrollHeight*-this.scrollLayer;
                        
                //set the scrollScrollLayerY to zero it out
                this.scrollLayerY=this.scrollTop;
                        
                //set the scrollTop for the current layer
                this.scrollLeft=0;
                this.scrollLayerX=this.scrollWidth;
                
                break;
    }
}
var IdNo=0;
function ccbnScroller(scrollContainer,scrollWidth,scrollHeight,scrollPause,scrollSpeed,scrollTime,scrollDirection){
/* ||||||||||||||||||||||||||||||||||||||||||||||||||||
    ccbnScroller - This is an object that will scroll
    all div's that are contained within the scrollContainer
    arguments
    scrollContainer - an object that contains the divs to be scrolled
    scrollHeight - this is an integer representing the height, in pixels, of the container
    scrollPause - this is an integer representing the amount of time to wait once a div has completed its scroll, before triggering the next div to begin its scroll; the time is in milliseconds
    scrollSpeed - this is an integer representing the number of pixels to move the div each time the move is triggered
    scrollTime - this is an integer representing the amount of time to wait before triggering the movement; the time is in milliseconds (1000 = 1 second)
                    Example
                    scrollPause = 5000
                    scrollSpeed = 1
                    scrollTime = 10
                    The div will move by 1 pixel every 10 milliseconds.  Once it has finished scrolling, the current div will remain on the page for 5000 milliseconds before the next div will begin to scroll
   |||||||||||||||||||||||||||||||||||||||||||||||||||| */
   
    //Save a reference to myself
    this.id = "myObject" + IdNo++;
    window[this.id] = this;
    
    this.container=scrollContainer;
    this.layers=this.container.getElementsByTagName("div");
    this.layerCount=this.layers.length;
    this.currentLayer=1;
    this.scrollTime=scrollTime;
    this.scrollSpeed=scrollSpeed;
    this.scrollPause=scrollPause;
    this.scrollWidth=scrollWidth;
    this.scrollHeight=scrollHeight;
    /*  
        scrollDirection:
        0 = scrolls from below
        1 = scrolls from above
        2 = scrolls from right to left
        3 = scrolls from left to right
    */    
    this.scrollDirection=scrollDirection;
    this.currentLayerY;
    this.currentLayerX;    
    this.scrollLayerY=0;
    this.scrollLayerX=0;
    this.ccbn_px=navigator.appName=="Netscape"?'px':'';
    this.runTimeout;
    this.scrollTimeout;
    
    this.stopped;
    
    this.scrollTop;
    this.scrollRight;
    this.scrollBottom;
    this.scrollLeft;
    this.previousLayer;
    this.scrollLayer;
    this.ccbnStartScroll=ccbnStartScroll;
    this.ccbnStopScroll=ccbnStopScroll;
    this.ccbnDoScroll=ccbnDoScroll;    
    this.ccbnRunScroll=ccbnRunScroll;
    this.ccbnRestartScroll=ccbnRestartScroll;
    
    this.ccbnSetScrollLayerBoundaries=ccbnSetScrollLayerBoundaries
    
}
function ccbnStartScroll(){
    //alert('start scrollin'); //---------------------------------------------------------------------------------------------------------------------------
    //alert(this.scrollHeight); //--------------------------------------------------------------------------------------------------------------------------
    //alert(this.layerCount);
    //alert(ccbnGetObj("ccbnNewsScrollHolder"));
    ccbnDoMove(this.layers[this.currentLayer].id, 0, (-this.scrollHeight), this.ccbn_px);
    ccbnDoMove(this.layers[0].id, -1000, -1000, this.ccbn_px);  //move the loading... div    
    this.currentLayerY=-this.scrollHeight;
    this.currentLayerX=0;
    this.runTimeout=setTimeout("window."+this.id+".ccbnRunScroll()",this.scrollPause);
}
function ccbnStopScroll(){
    this.stopped=true;
    clearTimeout(this.runTimeout);
}
function ccbnRestartScroll(){
    this.stopped=false;
    this.runTimeout=setTimeout("window."+this.id+".ccbnRunScroll()",this.scrollPause);
}
function ccbnRunScroll(){
    //if the user has hovered over the div, the scroller is stopped
    if(this.stopped) return;
    
    //move the layer that is now hidden to its original position and zindex
    if(this.previousLayer) ccbnSetZIndex(this.layers[this.previousLayer].id,-1);
    
    //set the index of the currently shown layer
    ccbnSetZIndex(this.layers[this.currentLayer].id,0);
    
    //set the scrollLayer by incremening the currentLayer or, if we have reached the count, setting it back to 1
    this.scrollLayer=(this.currentLayer==(this.layerCount-1))?1:this.currentLayer+1;
    this.ccbnSetScrollLayerBoundaries();
    //set the zIndex for the scrollLayer
    ccbnSetZIndex(this.layers[this.scrollLayer].id,1);        
    
    //move the scroll layer into position which is directly under the clipped area
    ccbnDoMove(this.layers[this.scrollLayer].id, (this.scrollLayerX), (this.scrollLayerY), this.ccbn_px);
    
    //begin the scroll process
    this.scrollTimeout=this.ccbnDoScroll();
        
}
function ccbnSetScrollLayerBoundaries(){
    switch(this.scrollDirection){
        case 0:    
                //set the scrollTop for the current layer
                this.scrollTop=this.scrollHeight*-this.scrollLayer;
                //set the scrollScrollLayerY to zero it out
                this.scrollLayerY=this.scrollTop+this.scrollHeight;
                
                break;
        
        case 1:
                //set the scrollTop for the current layer
                this.scrollTop=this.scrollHeight*-this.scrollLayer;
                        
                //set the scrollScrollLayerY to zero it out
                this.scrollLayerY=this.scrollTop;
                        
                //set the scrollTop for the current layer
                this.scrollLeft=0;
                this.scrollLayerX=this.scrollWidth;
                
                break;
    }
}
function ccbnDoScroll(){
    switch(this.scrollDirection){
        case 0:
    
            if(this.scrollLayerY!=this.scrollTop){
                var ccbn_y=((this.scrollLayerY-this.scrollSpeed)<this.scrollTop)?this.scrollTop:(this.scrollLayerY-this.scrollSpeed);
                ccbnDoMove(this.layers[this.scrollLayer].id, 0, ccbn_y, this.ccbn_px);
                this.scrollLayerY=ccbn_y;
                var ccbn_yCur=this.currentLayerY-this.scrollSpeed;
                ccbnDoMove(this.layers[this.currentLayer].id, 0, ccbn_yCur, this.ccbn_px);
                this.currentLayerY=ccbn_yCur;        
                this.scrollTimeout=setTimeout("window."+this.id+".ccbnDoScroll()",this.scrollTime);
            }
            else{
                //scroll is complete, reset values
                this.previousLayer=this.currentLayer;
                this.currentLayer=this.scrollLayer;
                this.currentLayerY=this.scrollLayerY;
                clearTimeout(this.scrollTimeout);
                clearTimeout(this.runTimeout);
                
                //run the next scroll
                this.runTimeout=setTimeout("window."+this.id+".ccbnRunScroll()",this.scrollPause);    
            }
            
            break;
        
        case 1:
        
            if(this.scrollLayerX!=this.scrollLeft){
                var ccbn_x=((this.scrollLayerX-this.scrollSpeed)<this.scrollLeft)?this.scrollLeft:(this.scrollLayerX-this.scrollSpeed);
                ccbnDoMove(this.layers[this.scrollLayer].id, ccbn_x, this.scrollLayerY, this.ccbn_px);
                this.scrollLayerX=ccbn_x;
                var ccbn_xCur=this.currentLayerX-this.scrollSpeed;
                var jdx = (this.scrollLayerY+(this.scrollHeight*(this.scrollLayer)))
                ccbnDoMove(this.layers[this.currentLayer].id, ccbn_xCur, jdx, this.ccbn_px);
                this.currentLayerX=ccbn_xCur;        
                this.scrollTimeout=setTimeout("window."+this.id+".ccbnDoScroll()",this.scrollTime);
            }
            else{
                //scroll is complete, reset values
                this.previousLayer=this.currentLayer;
                this.currentLayer=this.scrollLayer;
                this.currentLayerX=this.scrollLayerX;
                clearTimeout(this.scrollTimeout);
                clearTimeout(this.runTimeout);
                
                //run the next scroll
                this.runTimeout=setTimeout("window."+this.id+".ccbnRunScroll()",this.scrollPause);    
            }
            
            break;
    
    }
}
function ccbnSetZIndex(objID,index){
    if (document.layers && document.layers[objID] != null) {
        document.layers[objID].zIndex = index;
    }
    else if (document.all) {
        document.all[objID].style.zIndex = index;
    }
    else if (document.getElementById){
       document.getElementById(objID).style.zIndex = index;
    }
}
/* cross browser method that finds named DOM objects on a page */
function ccbnGetObj(objName){
    //alert('* '+objName);
    if (document.layers && document.layers[objName] != null){  return document.layers[objName]; }
    else if (document.all){  return document.all[objName]; }
    else if (document.getElementById){  return document.getElementById(objName); }
}
function setbluetooth( name, value, expires, path, domain, secure )
    {
    // set time, it's in milliseconds
    var today = new Date();
    today.setTime( today.getTime() );
    if ( expires )
        {
        expires = expires * 1000 * 60 * 60;
    }
    var expires_date = new Date( today.getTime() + (expires) );
    document.cookie = name + "=" +escape( value ) +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
}
function rewritelink(oldlink,newlink) {
    //alert(oldlink);
    for (var i=0; i<document.links.length; i++) {
            document.links[i].href = document.links[i].href.replace(oldlink, newlink);
    }
}



//-->

// Used on TDL_general_inquiries     
// Mootools    
/* show hide contents */        
<!--
    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
//-->
