function setCookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}

function deleteCookie ( cookie_name )
{
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}

function getCookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}

function setVisibility(objId, sVisibility) {
	/* setVisibility(objId, sVisibility)
	* Parameters: 
	* objId - the id of an element (case sensitive)
	* sVisibility - "block" | "inherit" | "none" (case insensitive)
	*/         
	var obj = document.getElementById(objId);
//    obj.style.visibility = sVisibility;
		obj.style.display = sVisibility;
      }

function collapse(blockId){
	if (document.getElementById(blockId)) {
	setVisibility(blockId, 'none') ; }
}

function expand(blockId, grpId){
  var obj = document.getElementById(blockId);
  if (obj.style.display=='none'){
	  obj.style.display='block' ;
	  visibleBlock.push(grpId) ;
	  //Effect.SlideDown($(blockId));
	  }
	  else{
	  i = visibleBlock.indexOf(grpId) ;
	  visibleBlock.splice ( i, 1 );
	  Effect.SlideUp(blockId);
	  }
  setCookie('MenuStatus', visibleBlock.join ( ", " )) ;
}

function showImage(pth){
	var obj = document.getElementById('imageBox');
	obj.innerHTML = "<img src='"+pth+"' alt='' />" ;
}

function moveThmsUp(distance){
	var obj = document.getElementById('glrThumbnails');
	alert(obj.style.marginTop);
	obj.style.marginTop = obj.style.marginTop - distance ;
}

function moveThmsDown(distance){
	var obj = document.getElementById('glrThumbnails');
//	obj.style.marginTop = obj.style.marginTop + distance ;
	obj.style.marginTop = "-200px";
}

