function imgSwap(object,img) {
 if (document.getElementById(object)) {
  document.getElementById(object).src=img;
 }
}

function itemOver(object) {
 document.getElementById(object).style.backgroundColor='#80CFEF';
}

function itemOut(object) {
 document.getElementById(object).style.backgroundColor='';
}

var show = new Array();
show['we_print']=0;
show['you_print']=0;
show['related']=0;
show['vtix_online']=0;

function showMenu(object) {
 hideAll();
 show[object]=1;
 if (document.getElementById(object))
  document.getElementById(object).style.visibility='visible';
}

function hideMenu(object) {
 if (document.getElementById(object) && show[object]==0) {
  document.getElementById(object).style.visibility='hidden';
 }
}

function preHide(object) {
 show[object]=0;
 setTimeout("hideMenu('"+object+"')",500);
}

function hideAll() {
 show['we_print']=0;
 show['you_print']=0;
 show['related']=0;
 show['vtix_online']=0;
 hideMenu('we_print');
 hideMenu('you_print');
 hideMenu('related');
 hideMenu('vtix_online');
}

function openPDF(object) {
 window.open(object,"w"+Math.floor(Math.random()*1000),"toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1");
}

function popThumb(url,name,width,height) {
 window.open(url,name,'width='+width+',height='+height);
 return false;
}

function checkEmail(email) {
 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email.toLowerCase())) {
  return true;
 } else {
  return false;
 }
}

function copyBilling(object) {
 object.s_address.value = object.b_address.value;
 object.s_city.value = object.b_city.value;
 object.s_prov.value = object.b_prov.value;
 object.s_country.value = object.b_country.value;
 object.s_pc.value = object.b_pc.value;
}

function urlEncode(sStr) {
 sStr = escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
 return sStr;
}

var posy=0;
var posx=0;
var screenx=0;
var screeny=0;

function showCell(e,object) {
 document.getElementById('popContent').innerHTML=document.getElementById(object).innerHTML;
 var date = document.getElementById(object+'date').innerHTML;
 var cellnum=object.substring(1);
 var popMonth="";
 if (cellnum < 8 && date > 8)
  popMonth=previousMonth;
 else if (cellnum > 28 && date < 8)
  popMonth=nextMonth;
 else
  popMonth=currentMonth;
 document.getElementById('popHeadline').innerHTML=popMonth+" "+date+" Events";
 getMousePos(e);
 getScreen();
 if (posx > screenx/2+52) {
  document.getElementById('calPop').style.right=screenx-posx+20;
  document.getElementById('calPop').style.left="";
 } else {
  document.getElementById('calPop').style.left=posx+20;
  document.getElementById('calPop').style.right="";
 }
 if (posy > 420) {
  document.getElementById('calPop').style.bottom=screeny-posy+20;
  document.getElementById('calPop').style.top="";
 } else {
  document.getElementById('calPop').style.top=posy+20;
  document.getElementById('calPop').style.bottom="";
 }
 document.getElementById('calPop').style.visibility="visible";
}

function hideCell() {
 document.getElementById('calPop').style.visibility="hidden";
}

function getMousePos(e) {
 //get mouse x and y coordinates
 if (!e) var e = window.event;
 if (e.pageX || e.pageY) {
  posx = e.pageX;
  posy = e.pageY;
 } else if (e.clientX || e.clientY) {
  posx = e.clientX + document.body.scrollLeft
  + document.documentElement.scrollLeft;
  posy = e.clientY + document.body.scrollTop
  + document.documentElement.scrollTop;
 }
}

function getScreen() {
 if (self.innerHeight) { // all except Explorer
  screenx = window.innerWidth;
  screeny = window.innerHeight;
 } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
  screenx = document.documentElement.clientWidth;
  screeny = document.documentElement.clientHeight;
 } else if (document.body) { // other Explorers
  screenx = document.body.clientWidth;
  screeny = document.body.clientHeight;
 }
}

function isInt(myNum) {
 // get the modulus: if it's 0, then it's an integer
  var myMod = myNum % 1;
 if (myMod == 0) {
  return true;
 } else {
  return false;
 }
}

function formatAsMoney(mnt) {
 mnt -= 0;
 mnt = (Math.round(mnt*100))/100;
 return (mnt == Math.floor(mnt)) ? mnt + '.00' 
  : ( (mnt*10 == Math.floor(mnt*10)) ? 
  mnt + '0' : mnt);
}