/**
 * Copyright 2004 - 2005 by Brilho Digital, Lda., All Rights Reserved.
 * http://www.brilhodigital.com/
 */

function checkFlash()
{
  useFlash = readCookie('useFlash');
  if (useFlash == null) {
      df = detectPlugin('Shockwave','Flash');
    if (df)
      useFlash = 1;
    else
      useFlash = 0;
    createCookie('useFlash', useFlash, 30);
  }
}

function toggleFlash()
{
  if (useFlash == 0)
    useFlash = 1;
  else
    useFlash = 0;
  createCookie('useFlash', useFlash, 30);
}

function popup(link, w, h)
{
  w = w + 16;
  h = h + 16;
/*  window.open(link, "", "status=0,toolbar=0,scrollbars=1,directories=0,location=0,resizeable=1,width="+w+",height="+h);*/
  window.open("popup.php?i=" + link + "&w=" + w + "&h=" + h, "", "status=0,toolbar=0,scrollbars=1,directories=0,location=0,resizeable=1,width="+w+",height="+h);
}

function popupWindow(pag)
{
  w=600;
  h=400;
  window.open(pag,"", "status=0,toolbar=0,scrollbars=1,directories=0,location=0,resizeable=1,width="+w+",height="+h+",top=0, left=0");
}

/**
 * This script was originally written by Scott Andrew (http://www.scottandrew.com).
 * http://www.quirksmode.org/js/cookies.html
 */
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=/";
}

/**
 * This script was originally written by Scott Andrew (http://www.scottandrew.com).
 * http://www.quirksmode.org/js/cookies.html
 */
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;
}

/**
 * This script was originally written by Scott Andrew (http://www.scottandrew.com).
 * http://www.quirksmode.org/js/cookies.html
 */
function eraseCookie(name)
{
	createCookie(name,"",-1);
}
