		var keySwitch=0;
		var layerSwitch=-1;
		var currDispID=0;
		var offsetx = 5;
		var offsety = 6;

		function showObject(div)
		{
			document.getElementById(div).style.display = "";
			document.getElementById(div).display="";
		}

		function hideObject(div)
		{
			document.getElementById(div).style.display = "none";	
			document.getElementById(div).display="none";
		}

		function disp(id,newClass)
		{
			var TdSubjectName,TdUserName,TdDateName,TdContentName;
			TdSubjectName="MsgSubject"+id;
			TdUserName="MsgUserName"+id;
			TdDateName="MsgDate"+id;
			TdContentName="MsgContentTD"+id;
			try
			{
				document.getElementById(TdSubjectName).className=newClass;
				document.getElementById(TdUserName).className=newClass;
				document.getElementById(TdDateName).className=newClass;
			}
			catch(e)
			{
			}
			
			if(currDispID!="")
				if(!isNaN(currDispID))
					hideContents(currDispID);
					
			if ((keySwitch==0 && layerSwitch==id) || layerSwitch!=id)
			{
				currdiv="MsgContent"+id;			
				showObject(currdiv);
				keySwitch=1;
				currDispID=id;
			}
			else
			{
				keySwitch=0;
				layerSwitch=-1;
			}
			
			layerSwitch=id;
		}

		function hideContents(id)
		{
			hideObject("MsgContent"+id);
			return false;
		}

		function PrintMsg(strParam)
		{
			target="PrintMsg.aspx?" + strParam;
			window.open(target,null,"top=50,left=50,width=650,height=400,status=no,menubar=no,toolbar=no,location=no,scrollbars=yes");
		}

		function SendMsg(strParam)
		{
			target="SendToFriend.aspx?" + strParam;
			window.open(target,null,"top=120,left=180,height=200,width=410,status=no,menubar=no,toolbar=no,location=no,scrollbars=no");
		}
		
		function openMessage(strParam)
		{
			target="message.aspx?" + strParam;
			window.open(target,null,"top=100,left=100,height=400,width=620,status=no,menubar=no,toolbar=no,location=no,scrollbars=yes");
		}

		function ConfirmDel()
		{
			return window.confirm("Are you sure want to delete this message?");
		}
		
		function ForumSearch(forum_id)
		{			

			var strSearch = new String(document.getElementById("txtsearch").value);
			if (strSearch.length < 3)
			{
				window.alert("Please insert at least 3 characters");
				document.getElementById("txtsearch").focus();
				return false;
			}
			else
			{				
				document.location.href = "search.aspx?fid=" + forum_id + "&srchString=" + encodeURIComponent(document.getElementById("txtsearch").value);
			}
			return false;	
		}
		
		function srchentr(forum_id) {
			if (window.event && window.event.keyCode == 13)
				return ForumSearch(forum_id);		
			else
				return true;}	
				
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6////
/////////////////////////////////


function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}

function initializedrag(e){
crossobj=ns6? document.getElementById("divAlert") : document.all.divAlert
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////

function hidebox(){
crossobj=ns6? document.getElementById("divAlert") : document.all.divAlert
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.divAlert.visibility="hide"
}		

function showbox(){
crossobj=ns6? document.getElementById("divAlert") : document.all.divAlert
if (ie4||ns6)
crossobj.style.visibility="visible"
else if (ns4)
document.divAlert.visibility="visible"
}		
	
