function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

function expandFloatBox(){

	expandStep = 16;
	division = document.getElementById('floatBox');
	
	if(!division.style.height)
	division.style.height = '0';
	
	division.style.display = 'block';
	
	currentHeight = parseInt(division.style.height);
	newHeight = currentHeight + expandStep;
	
	if(currentHeight < 350){

	newHeight = newHeight + "px";
	division.style.height = newHeight;
	currentHeight = parseInt(division.style.height);
	setTimeout('expandFloatBox();', 15);
	
	}else{
	division.style.height = '350px';
	}
	
	set_cookie('shown',true,1);

}

function shrinkFloatBox(){

	expandStep = 16;
	division = document.getElementById('floatBox');
	
	if(!division.style.height){
	division.style.height = '290px';
	}
	currentHeight = parseInt(division.style.height);
	newHeight = currentHeight - expandStep;
	
		if(currentHeight > 26){
		
		newHeight = newHeight + "px";
		division.style.height = newHeight;
		currentHeight = parseInt(division.style.height);
		setTimeout('shrinkFloatBox();', 15);
		
		}else{
		division.style.display = 'none';
		}
		

}

function set_cookie(c_name,value,expiredays){
	var exdate = new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	if(document.cookie = c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())){
	return true;
	}else{
	return false;
	}
}

function get_cookie(c_name){
	if (document.cookie.length > 0){
	c_start = document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){
		c_start=c_start + c_name.length + 1; 
		c_end=document.cookie.indexOf(";",c_start);
			if (c_end == -1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return false;
}

function check_cookieval(){

	if(set_cookie('test','test',1))
	return true;

}

function clear_cookie(c_name){
	set_cookie(c_name,false,0);
}	

var shown = get_cookie('shown');
	if(shown != 'true'){
	setTimeout('expandFloatBox();', 5000);
	setTimeout('opacity("floatBox", 0, 100, 500);', 5000);
}
