var m_window_height = 0;
var m_window_width = 0;


function setCookie( name, value, expires, path, domain, secure ) 
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) + (( expires ) ? ";expires=" + expires_date.toGMTString() : "") + 
		(( path ) ? ";path=" + path : "") + (( domain ) ? ";domain=" + domain : "") + 
		(( secure ) ? ";secure" : "" );
}


// this deletes the cookie when called
function deleteCookie( name, path, domain ) {
	document.cookie = name + "=" + (( path ) ? ";path=" + path : "") +
		(( domain ) ? ";domain=" + domain : "") + 
		";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

	
function testCookie()
{
	setCookie("test","cookieEnable",1,"/","","");
	var cookieEnabled=(document.cookie.indexOf("test=") == -1)? false : true;
	if(cookieEnabled)
	{
		deleteCookie("test","/","");
	}
	return cookieEnabled;
}

function testFlash()
{
 	var Flasher = new FlashSwapper();
	var hasFlash = true;
	if(Flasher.HasVersion(7)) {
    	// the user has flash version 7 or higher
  	} else if(Flasher.HasVersion(6)) {
    	hasFlash = false;
  	} else if(Flasher.HasFlash) {
			hasFlash = false;
  	} else { // no flash at all.
			hasFlash = false;
	}
	return hasFlash;	 
}

function o_window(url)
{
	var awinl = (screen.width/2 - 260);
	var awint = (screen.height/2 - 280);
	 window.open(url,'new_page','height=560,width=520,left=' + awinl + ',top=' + awint + ',toolbar=no,menubar=no,location=no,directories=no,status=no,resizable=no,scrollbars=yes');
}

function get_window_size()
{
	var browser = BrowserDetect.browser;
	if (browser == "Firefox")
	{
		//IE 4 compatible
		m_window_width = document.body.clientWidth;
		m_window_height = document.body.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
		//IE 4 compatible
		m_window_width = document.body.clientWidth;
		m_window_height = document.body.clientHeight;
	}
	else if( typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		m_window_width = window.innerWidth;
		m_window_height = window.innerHeight;
	}
	else if( document.documentElement &&
		( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
		//IE 6+ in 'standards compliant mode'
		m_window_width = document.documentElement.clientWidth;
		m_window_height = document.documentElement.clientHeight;
	} 
}

function moveDivDown(dist)
{
  // get the stylesheet
  var the_timeout;
  var the_style = getStyleObject("announce");
  
  if (the_style)
  {
    // get the current coordinate and add 5
	var current_top = parseInt(the_style.top);
	var new_top = current_top + 5;

    // set the left property of the DIV, add px at the end unless this is NN4
    if (document.layers) 
    {
	  the_style.top = new_top;
	  the_style.left = (m_window_width/2) - 250;
    }
    else 
    {  
	  the_style.top = new_top + "px";
	  the_style.left = ((m_window_width/2) - 250) + "px";
    }
    
    // if we haven't gone to far, call moveDivDown() again in a bit
    if (new_top < (m_window_height/2)-dist)
    {
      the_timeout = setTimeout('moveDivDown('+dist+');',10);
    }
  }
}

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
}
