// This function decodes the 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 decodeURIComponent(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 "";
}
//////////////////////////////////////////

function dumpProps(obj, parent) {
   // Go through all the properties of the passed-in object
   for (var i in obj) {
      // if a parent (2nd parameter) was passed in, then use that to
      // build the message. Message includes i (the object's property name)
      // then the object's property value on a new line
      if (parent) { var msg = parent + "." + i + "\n" + obj[i]; } else { var msg = i + "\n" + obj[i]; }
      // Display the message. If the user clicks "OK", then continue. If they
      // click "CANCEL" then quit this level of recursion
      if (!confirm(msg)) { return; }
      // If this property (i) is an object, then recursively process the object
      if (typeof obj[i] == "object") {
         if (parent) { dumpProps(obj[i], parent + "." + i); } else { dumpProps(obj[i], i); }
      }
   }
}
