cookiesEnabled = 0;
setCookie('cookiesOKsf','cookiesOK', '', '');
mySFdate = new Date();
sf_cur_time = Math.round(mySFdate.getTime() / 1000);

function setVisible(objID)
{
	obj = document.getElementById(objID);
	obj.style.visibility = 'visible';
}

function closePopup(objID)
{
	obj = document.getElementById(objID);
	obj.style.visibility = 'hidden';
	setCookie('popupShownSF', sf_cur_time, '', '');
//	setCookie('popupShownSF','0', '', '');
}

function submitForm()
{
	setCookie('popupShownSF', sf_cur_time, '', '');
}


function placeIt(obj)
{
	var x = 20; // default x (spacing from div to left of page)
	var y = 180; // default y (spacing from div to top of page)

	obj = document.getElementById(obj);
	if (document.documentElement)
	{
		theLeft = document.documentElement.scrollLeft;
		theTop = document.documentElement.scrollTop;
	}
	else if (document.body)
	{
		theLeft = document.body.scrollLeft;
		theTop = document.body.scrollTop;
	}
	theLeft += x;
	theTop += y;
//	obj.style.left = theLeft + 'px' ;
	obj.style.top = theTop + 'px' ;
	setTimeout("placeIt('email_request')",500);
}



var DisplayPopupSF =
{
  init: function()
  {
		var showPopUpEvery; // after popup is closed by user (using the x button) show it again every x hours
//		showPopUpEvery = 86400; //86400 seconds = 24 hours
		showPopUpEvery = 21600; //21600 seconds  = 6 hours
//		showPopUpEvery = 15;

		var secondsElapsed;
		secondsElapsed = (sf_cur_time - (getCookieValue('popupShownSF')));
		
//		alert('se: ' + secondsElapsed + ' and check:' + showPopUpEvery);
		
		if((getCookieValue('cookiesOKsf') == 'cookiesOK') && ((getCookieValue('popupShownSF') == null) || (secondsElapsed >  showPopUpEvery ))){
//			alert(sf_cur_time - (getCookieValue('popupShownSF')));
			setVisible('email_request');
			window.onscroll = setTimeout("placeIt('email_request')",500);
		}

  },
	showagain: function()
	{
			setVisible('email_request');
			window.onscroll = setTimeout("placeIt('email_request')",500);
	}
	
};
