// This function decodes any string
// that's been encoded using URL encoding technique


function URLDecode(psEncodeString)
{
  // Create a regular expression to search all +s in the string
  var lsRegExp = /\+/g;
  // Return the decoded string
  return unescape(String(psEncodeString).replace(lsRegExp, " "));
}
function openliks(url,img)
{
	swapimg(img);
	newwindow=window.open(url,'name');
	if (window.focus) {newwindow.focus()}
}
function swapimg(im_nr)
{
  if (document.images) {
	document.images[im_nr].src=document.images[im_nr].src.replace('0\.gif','1\.gif');
	}
  return true;
}
function getcontent(id){
	if (document.getElementById){
		el=document.getElementById(id);
		if (el){
			return el.innerHTML;
		}
	}
	
	return '&nbsp;';
}

function clear_content(content){
	content = content.replace(/\n/,' ');
	return content;
}

function opendiv(id){
	if (document.getElementById){
		el=document.getElementById(id);
		if (el) 
			if (el.style.display=='block') {el.style.display='none';}else{el.style.display='block';}
	}
	
	return '&nbsp;';
}

//cookie handlers///////////////////////////
function setCookie(c_name,value,expiredays){
			
	var exdate=new Date();
	
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie = c_name+ "=" + escape(value) + ((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 "";
}