//Get cookie routine by Shelley Powers
function get_cookie(Name) 
{
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) 
        {
        offset = document.cookie.indexOf(search)
        // if cookie exists
        if (offset != -1) 
            {
            offset += search.length
            // set index of beginning of value
            end = document.cookie.indexOf(";", offset);
            // set index of end of cookie value
            if (end == -1)
                end = document.cookie.length;
            returnvalue = unescape(document.cookie.substring(offset, end))
            }
        }
    return returnvalue;
}


// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well
function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;} function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;} function posTop() {return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} function posRight() {return posLeft()+pageWidth();} function posBottom() {return posTop()+pageHeight();}

function showAlert()
    {
    //alert("get_cookie: " + get_cookie("taoo_cookie"));
    if (get_cookie("taoo_cookie") == "")
        {
        setVisible('layer1');
        document.cookie="taoo_cookie=shown";
        }
    }

/* -----------------------------------------------
   Floating layer - v.1
   (c) 2006 www.haan.net
   contact: jeroen@haan.net
   You may use this script but please leave the credits on top intact.
   Please inform us of any improvements made.
   When usefull we will add your credits.
  ------------------------------------------------ */

x = (pageWidth() - 400)/2;
//alert("Page width: " + pageWidth());
//alert("document.documentElement.clientWidth: " + document.documentElement.clientWidth);
if (x < 0)
    x = 200;
y = 100;
function setVisible(obj)
{
	obj = document.getElementById(obj);

	if (document.documentElement)
        {    	
		theLeft = document.documentElement.scrollLeft;
		theTop = document.documentElement.scrollTop;
        //alert("theLeft: " + theLeft + ", theTop: " + theTop + "\n\n" + "x: " + x + ", y: " + y);
    	}
	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' ;

	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
}

function placeIt(obj)
{
    if (document.getElementById(obj).style.visibility == 'visible')
        {
    	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('layer1')",500);
}

window.onscroll = function(){setTimeout("self.placeIt('layer1')",500);}

function quickEscape()
    {
	obj = document.getElementById('layer2');

	if (document.documentElement)
    	{
		theLeft = document.documentElement.scrollLeft;
		theTop = document.documentElement.scrollTop;
    	}
	else if (document.body)
    	{
		theLeft = document.body.scrollLeft;
		theTop = document.body.scrollTop;
    	}
	obj.style.left = theLeft + 'px' ;
	obj.style.top = theTop + 'px' ;

	obj.style.width = pageWidth() + 'px' ;
	obj.style.height = pageHeight() + 'px' ;

	obj.style.visibility = 'visible';

    window.location = "http://www.google.com/";
    }
