function popup (page) {
  var width  = '660';
  var height = '600';
  if (page == 'demo') {
    url = '/sales-assistant/';
    /*width  = '890';
    height = '650';*/
  } else if (page == 'liveChat') {
    url = '/livechat/';
  } else if (page == 'newsletter') {
    url = '/newsletter/';
  } else if (page == 'agreement') {
	url = '/cart/notice';
	height = '290';
  } else {
    url = '/';
  }
  window.open(
    url,
    'newWin',
    'width='+width+',height='+height+',scrollbars=1,location=1'
  );
  return false;
}

function navigate (page) {
  if (page == 'plans') {
    url = siteUrl+'cart/packages/us/';
  } else {
    url = 'http://a2btv.com';
  }
  location.href=url;
}

$(document).ready(function(){
  $('#liveChatHours').tooltip({ 
    delay: 0, 
    showURL: false, 
    bodyHandler: function() { 
      return $("div#liveChat").html(); 
    }
  });

  $('#nav ul li a').hover(
    function(){
      var imgName = $(this).attr('class').replace('item_', '');
      $(this).find('img').attr('src', siteUrl+'assets/images/header/'+imgName+'_ov.gif');
    },
    function(){
      var imgName = $(this).attr('class').replace('item_', '');
      $(this).find('img').attr('src', siteUrl+'assets/images/header/'+imgName+'_dw.png');
    }
  );
  $('#servicePlansContainer').click(function(){
    navigate('plans');
  });
  $(".serviceNotice").fancybox({
	'overlayOpacity'  : 0.8,
	'overlayColor'    : '#000000',
  });
  $("#videoTour").fancybox({
	'type'            : 'swf',
	'overlayShow'     :	true,
	'overlayOpacity'  : 0.8,
	'overlayColor'    : '#000000',
	'width'           : 630,
	'height'          : 400,
	'autoScale'       : false,
  	'href'            : 'http://a2btv.com/assets/flash/a2bTVVideoPlayer.swf',
  	'swf'             : {
  	                      'wmode': 'transparent',
  	                      'allowScriptAccess' : 'always'
  	                    }
	});
});

