function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(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;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
function showhide(id)
{
   obj = getobj(id);
   if (!obj) return false;
   if (obj.style.display == '')
       obj.style.display = 'none';
   else
      obj.style.display = '';
   if (document.timer)
      clearTimeout(document.timer);
   getobj('shadow').style.height = Viewport() + "px";
   document.timer = setTimeout('setShadow()',1050);
   return false;
}
function setCookieAndClose()
{
   eraseCookie("newsletter");
   createCookie("newsletter","done",60);
   showhide('pic_layer');
   $("embed").show();
   $("object").show();
}
function setShadow()
{
   getobj('shadow').style.height = Viewport() + "px";
}
function getobj(id)
{
    if ((typeof(plus2id)=="undefined") && (document.getElementById('plusId')))
        plus2id=document.getElementById('plusId').value + '_';
    if(typeof(plus2id)=="undefined")
        plus2id='';
    if (document.getElementById(plus2id+id))
        return document.getElementById(plus2id+id);
    return document.getElementById(id);
}
function setBigPic(name)
{
    getobj('bigpic').src = name;
}
function Viewport()
{ 
    this.windowX = (document.documentElement && document.documentElement.clientWidth) || window.innerWidth || self.innerWidth || document.body.clientWidth; 
    this.windowY = (document.documentElement && document.documentElement.clientHeight) || window.innerHeight || self.innerHeight || document.body.clientHeight; 
    this.scrollX = (document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft; 
    this.scrollY = (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop; 
    this.pageX = (document.documentElement && document.documentElement.scrollWidth) ? document.documentElement.scrollWidth : (document.body.scrollWidth < document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth; 
	this.pageY = document.all ? Math.max(Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.body.scrollHeight)) : (document.body ? document.body.scrollHeight : ((document.documentElement.scrollHeight != 0) ? document.documentElement.scrollHeight : 0));
    if (this.pageY < 5)
        this.pageY = (document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight : (document.body.scrollHeight < document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight;
    return this.pageY;
}
function slide(obj,fX,fY,tX,tY)
{
    document.slideObj = obj;
    document.slideObj_fX = fX;
    document.slideObj_fY = fY;
    document.slideObj_dX = tX-fX;
    document.slideObj_dY = tY-fY;
    document.slideObj_count = 1;
    slideObj_move();
}
function slideObj_move()
{
    document.slideObj_fX += document.slideObj_dX/10;
    document.slideObj_fY += document.slideObj_dY/10;
    document.slideObj.style.width = Math.floor(document.slideObj_fX) + 'px';
    document.slideObj.style.height = Math.floor(document.slideObj_fY) + 'px';
    if (document.slideObj_count++ > 10)
        document.slideTimer = setTimeout('slideObj_move()',2);
}
function hideFlashObjects()
{
    $(document).ready(function(){
        $("embed").hide();
        $("object").hide();
     });
}
