_GET=document.location.href.split("#");
_URL=_GET[0];

_SETHASH=new Object();

if(_GET[1]){
	_GET=_GET[1].split("&");
	for(i=0;i<_GET.length;i++){
		vars=_GET[i].split("=");
		if(vars[0]){
			if(vars[1]==null){
				value=1;
			}
			else {
				value=vars[1];
			}
			_SETHASH[vars[0]]=vars[1];
		}
	}
}
_GET=_SETHASH;

function setJSGET(varname,value,unset){
	url=document.location.href.split("#");
	url=url[0]+"#";
	
	if(unset){
		_GET[varname]='[NULL]';
	}
	else {
		_GET[varname]=value;
	}

	for(i in _GET){
		if(_GET[i]!=='[NULL]'){
			url+=i+'='+_GET[i]+'&';
		}
	}
	if(url[(url.length-1)]=='&'){
		url=url.substr(0,(url.length-1));
	}
	document.location.href=url;	
}

function SeenMessage(MessageId,HideVar){
	if($(MessageId)){
		if(!_GET[HideVar]){
			$('#'+MessageId).show();
			setJSGET(HideVar,'true');
		}
	}
}

SortablesTimeouts=new Object();

function DragDropSort(Name,enable,exec){
	if(enable){
		if(SortablesTimeouts[Name]){
			clearTimeout(SortablesTimeouts[Name]);
		}
		if(!Sortable.options(Name)){
			Sortable.create(Name,{tag:'tr',dropOnEmpty:true,constraint:false,scroll:window,scrollSensitivity:40,onUpdate:function(){if(exec){ eval(exec); } Sortable.destroy(Name);}});	
		}
	}
	else {
		SortablesTimeouts[Name]=setTimeout("Sortable.destroy('"+Name+"');",2000);
	}
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}
