/* Resize div code */
var smooth_timer = new Array();
 smooth_timer['personalise_news'] ='';

function smoothHeight(id, curH, targetH, stepH, mode) {
	curH=div_height(id);
	diff = targetH - curH;
	
	var diff2;
	
	if(diff<0) 
	{
		diff2=diff*-1;
	} else
	{
		diff2=diff;
	}
	
	
	if (diff != 0 && diff2>=stepH) {

		//set the new height... this will be the current height +/- the number of pixels you pass as "stepH"
		newH = (diff > 0) ? curH + stepH : curH - stepH;

		//add the new height to your current height
		((document.getElementById) ? document.getElementById(id) : eval("document.all['" + id + "']")).style.height = newH + "px";
		if (smooth_timer[id]) window.clearTimeout(smooth_timer[id]);

		//run smoothHeight() again after 5 milliseconds, passing our new height as the current height
		smooth_timer[id] = window.setTimeout( "smoothHeight('" + id + "'," + newH + "," + targetH + "," + stepH + ",'" + mode + "')", 5 );
	}else if(diff!=0)
	{
		stepH=diff2;
		newH = (diff > 0) ? curH + stepH : curH - stepH;

		//add the new height to your current height
		((document.getElementById) ? document.getElementById(id) : eval("document.all['" + id + "']")).style.height = newH + "px";
		if (smooth_timer[id]) window.clearTimeout(smooth_timer[id]);

		//run smoothHeight() again after 5 milliseconds, passing our new height as the current height
		smooth_timer[id] = window.setTimeout( "smoothHeight('" + id + "'," + newH + "," + targetH + "," + stepH + ",'" + mode + "')", 5 );
		
	}
}




function div_height(id)
{
	return document.getElementById(id).offsetHeight;
}


function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+";path=/"+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
} 

function getCookie(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 "";
} 


function in_array(array, value)
{
	if(array.length>0)
	{
		
		for(var x in array)
		{
			if(value==array[x])
			{
			
				return true;
			}
		}
	}
	
	return false;
}

function array_pos(array, value)
{
	if(array.length>0)
	{
		
		for(var x in array)
		{
			if(value==array[x])
			{
			
				return x;
			}
		}
	}
	
	return false;
}

function popup_help()
{
	popup_startupdate('/ajax/popup_help.php');
	setVisible('popup');
}
