var isUSsite = window.location.href.indexOf("lsi.com");

var answer = 'no';
function setCookie(c_name, value, expiredays)
{
    if (isUSsite == -1) return;
    
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	document.cookie = c_name+ "=" + escape(value)+ ((expiredays==null) ? "" : ";expires=" + exdate.toUTCString());
}
function getCookie(c_name)
{
    if (isUSsite == -1) return;

	if (document.cookie.length > 0)
	{
	    var c_start = document.cookie.indexOf(c_name + "=");
	    if (c_start!=-1)
	    {
		    c_start = c_start + c_name.length+1;
		    var c_end = document.cookie.indexOf(";", c_start);
		    if (c_end == -1) c_end = document.cookie.length;
		    return unescape(document.cookie.substring(c_start, c_end));
	      }
	}
	return "";
}
function checkCookie()
{
    if (isUSsite == -1) return;

	answer = getCookie('survey');
	if (answer == null || answer == "")
	    startPopup();
}

var bottom = 100;
var padding = 5;
var X = 5;
var Y = 0;

function dropPopup()
{
    if (isUSsite == -1) return;

    Y = Y + 5;
    if( Y > bottom ) return;
    document.getElementById("popup").style.top = Y + "px";
    setTimeout("dropPopup()", 25);
}

function startPopup()
{
    if (isUSsite == -1) return;
    if (window.navigator.appVersion.indexOf("MSIE 6.0") < 0)  return;

    var scrolledY;
    if( self.pageYOffset )
        scrolledY = self.pageYOffset;
	else if( document.documentElement && document.documentElement.scrollTop )
        scrolledY = document.documentElement.scrollTop;
    else if( document.body )
        scrolledY = document.body.scrollTop;
    var centerY;
    if( self.innerHeight )
        centerY = self.innerHeight;
    else if( document.documentElement && document.documentElement.clientHeight )
        centerY = document.documentElement.clientHeight;
    else if( document.body )
        centerY = document.body.clientHeight;

    Y = scrolledY;

    document.getElementById("popup").style.right = X + "px";
    document.getElementById("popup").style.display = "block";
    dropPopup();
}

function stopPopup()
{
    if (isUSsite == -1) return;

    document.getElementById("popup").style.display = "none";
	Y = 100000;
}
