﻿/************************

Uni High A3
this should open and close the block divs
requires (some) Yahoo YUI libraries

last modified:
 Apr. 23, 2007
script by:
 Robert Boyce
 http://rcboyce.com/design

************************/

var curr_open = 'none';
var mouse_in = '';
var timer;

function close_block(id)
	{
	if(curr_open == id)
		{
		var slideclosed = new YAHOO.util.Anim(id, 
			{
			height: { to: 26 }
			}, 1, YAHOO.util.Easing.easeOut);
		slideclosed.animate();
		document.getElementById(id).className = 'block_closed';
		curr_open = 'none';
		}
	}
function open_block(id)
	{
	if(curr_open != id)
		{
		if(curr_open != 'none')
			{
			close_block(curr_open);
			}
		var slideopen = new YAHOO.util.Anim(id, 
			{
			height: { to: 200 }
			}, 1, YAHOO.util.Easing.easeOut);
		slideopen.animate();
		document.getElementById(id).className = 'block_open';
		curr_open = id;
		createCookie("uni_block_open", curr_open, 30);
		}
	}

function block_in(id)
	{
	timer = window.setTimeout("open_block('"+id+"')", 600);
	}
function block_out(id)
	{
	window.clearTimeout(timer);
	}
	
//	Cookies

function createCookie(name, value, minutes)
	{
	if(minutes)
		{
		var date = new Date();
		date.setTime(date.getTime()+(minutes*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;
	}
