
function getSiteHeight ()
{
  var h = 0;
  if (window && window.innerHeight) {
    h = window.innerHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) {
    h = document.documentElement.clientHeight;
  } else if (document.body && document.body.clientHeight) {
    h = document.body.clientHeight;
  }
  if (h > 289) {
    return h-210;
  } else
    return 500;
}

function documentLoad ()
{
  //document.getElementById('_siteHeight').height = getSiteHeight();
  if (document.getElementById('_infoHeight')) {
    document.getElementById('_infoHeight').height = getSiteHeight()-80;
  } else if (document.getElementById('_productHeight')) {
    document.getElementById('_productHeight').height = getSiteHeight()-300;
  }
}

function popupWindow (url, name, width, height)
{
  var posx = 50;
  var posy = 50;
  if (screen.width) {
    posx = (screen.width-width)/2;
    posy = (screen.height-height)/2;
  }
  window.open(url, name, 'toolbar=0,menubar=1,resizable=1,scrollbars=1,width='+width+',height='+height+',screenX='+posx+',screenY='+posy+',top='+posy+',left='+posx);
}

function infoPopup (key, e)
{
  var posx = e.screenX-250;
  var posy = e.screenY-150;
  window.open('info_popup.php?key='+key, 'zepto_info', 'resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width=500,height=400,screenX='+posx+',screenY='+posy+',top='+posy+',left='+posx);
}

var VisitorLogger = {

  createCookie: function (name,value,days,minutes)
  {
	if (days||minutes) {
		var date = new Date();
		if (minutes) {
			date.setTime(date.getTime()+(minutes*60*1000));
		} else {
			date.setTime(date.getTime()+(days*24*60*60*1000));
		}
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
  },

  readCookie: function (name)
  {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
  }

};
