/*<#SETCONTENTTYPE NAME="text/javascript" condition="params.setcontenttype != false">*/
var activeload = null;

function OnLoadPage(obj, html) {
  activeload.innerHTML = html;
}        		
var activetab = null;

function displaypage(tab, display) {
    var t = tab.childNodes[0].src;
    var page = document.getElementById(tab.id.replace('tab_','page_'))
    if (page) {
        if (display) {
            tab.childNodes[0].src = tab.childNodes[0].src.substring(0, tab.childNodes[0].src.indexOf('.gif')) + '_o.gif';
            page.style.display = 'inline';
        } else {
            tab.childNodes[0].src = tab.childNodes[0].src.replace('_o','');
            page.style.display = 'none';
        }
    }
}
var vid_started = false;
var vid_init = false;
var active_img = null;

function switchimage(img) {
    if (active_img != img) {
        if (active_img)
            active_img.style.borderColor = '#333333';
        active_img = img;
        active_img.style.borderColor = '#e7f65d';
        document.getElementById('img_main').src = active_img.src.replace('&height=63&width=100','&height=300&width=400');
    }
}
function doVideoTour(targetdiv, url) {
    if (!activetab)
        activetab = document.getElementById('tab_media');
    displaypage(activetab, false);
    activetab = document.getElementById(targetdiv);
    displaypage(activetab, true);
    document.getElementById(targetdiv).childNodes[0].src = url;
}

function getAsyncContent(e, destination, overrideurl) {
    e.blur();
    if (vid_started) {
        sendEvent('embeddedvid', 'playpause');
        vid_started = false;
    }            
    if ((e.id == 'tab_map')&&(!document.getElementById('myMap')))
        return false;        
    if (!activetab) 
        activetab =  document.getElementById('tab_media');
    displaypage(activetab, false);
    activetab = e;
    displaypage(activetab, true);
    switch (activetab.id) {
        case 'tab_map':
            GetMap();
            break;
        case 'tab_video':
            if (!vid_started) {		
                if (vid_init)  				    
                    sendEvent('embeddedvid', 'playpause');
                else
                    so.write('divVideo');
                vid_started = true;
            }
            break;
    }
   if (overrideurl){  
      var ul = e.parentElement.parentElement;
      var atag = ul.getElementsByTagName('A');
      for (var i = 0; i < atag.length; i++) {
        atag[i].className = '';
      }
      e.className = 'active';
      activeload = document.getElementById(destination);
      loadpage(overrideurl, OnLoadPage);
  }
  
  return false; 
}

function sendEvent(swf,typ,prm) { 
    thisMovie(swf).sendEvent(typ,prm); 
}
function getUpdate(typ,pr1,pr2,swf) {}
function thisMovie(swf) {
  if(navigator.appName.indexOf("Microsoft") != -1) {
    return window[swf];
  } else {
    return document[swf];
  }
}