// xScrollTop, Copyright 2001-2006 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xScrollTop(e, bWin)
{
  var offset=0;
  if (!xDef(e) || bWin || e == document || e.tagName.toLowerCase() == 'html' || e.tagName.toLowerCase() == 'body') {
    var w = window;
    if (bWin && e) w = e;
    if(w.document.documentElement && w.document.documentElement.scrollTop) offset=w.document.documentElement.scrollTop;
    else if(w.document.body && xDef(w.document.body.scrollTop)) offset=w.document.body.scrollTop;
  }
  else {
    e = xGetElementById(e);
    if (e && xNum(e.scrollTop)) offset = e.scrollTop;
  }
  return offset;
}


// xNum, Copyright 2001-2006 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xNum()
{
  for(var i=0; i<arguments.length; ++i){if(isNaN(arguments[i]) || typeof(arguments[i])!='number') return false;}
  return true;
}

// xDef, Copyright 2001-2006 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xDef()
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}


// xGetElementById, Copyright 2001-2006 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xGetElementById(e)
{
  if(typeof(e)=='string') {
    if(document.getElementById) e=document.getElementById(e);
    else if(document.all) e=document.all[e];
    else e=null;
  }
  return e;
}



function showToolTip(e,text){
        var posx = 0;
        var posy = 0;
        if (!e) var e = window.event;
        if (e.pageX || e.pageY)
        {
        posx = e.pageX;
        posy = e.pageY;
        }
        else if (e.clientX || e.clientY)
        {
            var theTop;
            if (document.documentElement && document.documentElement.scrollTop)
                theTop = document.documentElement.scrollTop;
            else if (document.body)
                theTop = document.body.scrollTop
        
            posx = e.clientX + 10 + document.body.scrollLeft;
            posy = e.clientY + 15 + theTop;
            //posy = xScrollTop(e, true);
        }
      ToolTip.style.left=(posx);
      ToolTip.style.top=(posy);
      //text += posy;
      document.all.ToolTip.innerHTML="<table><tr><td class=ToolTipTD>"+text+"</td></tr></table>";
      ToolTip.style.visibility="visible";
}
function hideToolTip(){
      ToolTip.style.visibility="hidden";
}

// for herf palnning locatin finder
var popUp;

function SetControlValue(controlID, newDate, isPostBack)
{
    popUp.close();
    var mytag = xGetElementById(controlID)
    if(mytag != null) {
        mytag.innerHTML = newDate;
    }

    //document.forms[0].elements[controlID].value=newDate;
    //__doPostBack(controlID,'');
}


function SetLocDivValue(controlID, newDate)
{
    var mytag = xGetElementById(controlID)
    if(mytag != null) {
        mytag.innerHTML = newDate;
    }

}

function OpenPopupPage (pageUrl, controlID, isPostBack, width, height, left, top)
{
    popUp=window.open(pageUrl+'?controlID='+controlID+'&isPostBack='+ isPostBack,'popupcal', 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + ',scrollbars=yes,resizable=yes,status=yes,location=yes'); 
}
// end herf plan location finder

function pop_up(url) {
    window.open(url,"popup","top=0,left=0,width=600,height=550,buttons=no,scrollbars=yes,location=yes,menubar=no,resizable=no,status=yes,directories=no,toolbar=yes,screenX=0,screenY=0");
}
/*function pop_up(url) {
    window.open(url,"popup","top=0,left=0,width=1024,height=768,buttons=no,scrollbars=yes,location=yes,menubar=yes,resizable=yes,status=yes,directories=no,toolbar=yes,screenX=0,screenY=0");
}*/
function pop_up_locator(url) {
    window.open(url,"popup","top=0,left=0,width=500,height=550,buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=yes,directories=no,toolbar=no,screenX=0,screenY=0");
}

function dynpop_up(url, vars) {
    var popup = window.open(url,"popup",vars);
    popup.focus();
}

function dynNamedpop_up(url, name) {
    window.open(url,name,"top=0,left=0,width=595,height=540,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no,screenX=40,screenY=20");
}

function testpop_up(url, name) {
    window.open(url,name,"top=0,left=0,width=595,height=540,buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no,screenX=40,screenY=20");
}

function winnerspop_up(url) {
    window.open(url,"Winners","top=0,left=0,width=595,height=540,buttons=no,scrollbars=yes,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no,screenX=20,screenY=20");
}

function relocateParent(url) {
    window.opener.location.href = url;
}

function navigate(url) {
	window.location.href = url;
}

function changeScreenSize(w,h)     {       window.resizeTo( w,h )     }

//used to show and hide panel that is passed...sorta like an on/off
function showpanelonoff(strpanelname)
{//begin funchtion

	var i=0;
	var objtemp;	
	//objtemp=document.all.tags("div");	
	objtemp=xGetElementById(strpanelname);
	//alert('count of divs ' + objtemp.style.display);
    if (objtemp.style.display=='none' || objtemp.style.display=='') {//begin if  
        //alert('blocked'); 			    				
		objtemp.style.display='block';
	}	//end if
	else
	{	//begin else
	    //alert('noned');			    
		objtemp.style.display='none';
	} //end else
	/*
	//alert('count of divs ' + objtemp.length);
	for (i==0;i<=objtemp.length-1;i++) { //begin for
	    alert(objtemp[i].id);
	    
		if (objtemp[i].id==strpanelname) {//begin if
		    //alert(objtemp[i].style.visibility);
		    alert(objtemp[i].style.display);
		    if (objtemp[i].style.display=='none' || objtemp[i].style.display=='') {//begin if   			    				
				objtemp[i].style.display='block';
			}	//end if
			else
			{	//begin else			    
				objtemp[i].style.display='none';
			} //end else

		} // end if
	
	} //end for
	*/
} //end function

function toggleFlash(strpanelname, stroffon)
{//begin funchtion    
	var i=0;
	var objtemp;
	//alert(strpanelname.split(","));
	var myarray = strpanelname.split(",");	
	//alert(myarray.length);
	for(i=0;i<myarray.length;i++) {
	    //alert(myarray[i]);	
	    //objtemp=xGetElementById(strpanelname);
	    objtemp=xGetElementById(myarray[i]);
	    //alert('count of divs ' + objtemp.style.display);
        if (stroffon=='on') {//begin if  
            //alert('blocked'); 			    				
		    objtemp.style.display='block';
	    }	//end if
	    else
	    {	//begin else
	        //alert('noned');			    
		    objtemp.style.display='none';
	    } //end else
	}

} //end function

//PLEASE READ BEFORE USING
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//this function ASSUMES that the DIV title is set to 'foldercontainer', if its not then it WILL NOT work..
function showpanel(strpanelname)
{//begin funchtion
	var i=0;
	var objtemp
	objtemp=document.all.tags("div");
	
	
	//alert(strpanelname);
	
	//alert('count of divs ' + objtemp.length);
	//turn all the jankes off
	for (i==0;i<=objtemp.length-1;i++) { //begin for
	    
	    if ((objtemp[i].title=='foldercontainer') && (objtemp[i].id!=strpanelname))
	    {//begin if
	        //alert(objtemp[i].id + ' ' + objtemp[i].title);
	 	    objtemp[i].style.visibility='hidden';
		    objtemp[i].style.display='none';
		}//end if
		else
		{//begin else
				objtemp[i].style.visibility='visible';
				objtemp[i].style.display='block';
		}//end else
	} //end for
	
} //end function

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



function DeletePost()
{//begin functio n


if (window.confirm('Are you sure you want to delete current post?'))
{//begin if
    //document.form1.method='deletepost.aspx?postid=' + document.form1.
    //document.form1.submit();
}//end if
}//end function


function DeleteEvent(inteventid,streventname)

{//begin function

    //alert('here');
    if (window.confirm("Are you sure you want to delete event '" + streventname + "'?"))
    {//begin if
        document.aspnetForm.action='ManageEvents.aspx?EventAction=deleteevent&EventId=' + inteventid;
        document.aspnetForm.method='post';
        document.aspnetForm.submit();
    }//end if
}//end function


function jumpTo( url ) // for bookmark during paging
{
   window.location = url ;
}




function DeleteEventType(intitemid)

{//begin function

    document.aspnetForm.action='ManageEventTypes.aspx?FunctionAction=deleteeventtype&ItemId=' + intitemid;
    document.aspnetForm.method='post';
    document.aspnetForm.submit();


}//end function

function DeleteThread(intitemid,strThreadName)
{//begin function

    //var objthread
    //alert('here');
    var objform
    var threadwin


    //alert(strThreadName);
    threadwin=window.open("confirmthreaddelete.aspx?ThreadId=" + intitemid + "&ThreadName=" + strThreadName, "threadwin", "top=250,left=250,width=375,height=75,scrollbars=no,location=no,menubar=no,resizable=yes,status=yes,directories=no,toolbar=no,screenX=0,screenY=0");

    
//    if (window.confirm("Are you sure you want to delete event type '" + intitemid + "'?"))
//    {//begin if
        
      //this opens the new win and submits the form on the new win in order to do the delete
//    //alert('here 1');
//    objform = threadwin.document.forms[0];
//    alert(threadwin.document.forms.length);
//    //eval(objform);
//    alert("here 2");
//    objform.action="ThreadDetails.aspx?FunctionAction=DELETETHREADFROMID&ItemId=" + intitemid;
//    //alert("here 3");
//    objform.submit();
    

//    }//end if

}//end function


function DeletePost(intitemid,strPostSubject)
{//begin function

    //var objthread
    //alert('here');
    var objform
    var postwin


    //alert(intitemid);
    postwin=window.open("confirmpostdelete.aspx?PostId=" + intitemid + "&PostSubject=" + strPostSubject, "postwin", "top=250,left=250,width=400,height=75,scrollbars=no,location=no,menubar=no,resizable=yes,status=yes,directories=no,toolbar=no,screenX=0,screenY=0");


}//end function


function RefreshPostThreadSearch()
{//begin function

    //call the button click event to refresh the screen
    window.aspnetForm.ctl00_ContentPlaceHolder1_btnSearchThreadPost.click()

}//end function

function HidePanelThreadDetails()
{//begin function
    
    var objPanel
    
    //alert('here');
    //this gets the correct panel and hides it
    objPanel=document.all.item("ctl00_ContentPlaceHolder1_panelThreadDetails");
	objPanel.style.visibility='hidden';
    objPanel.style.display='none';

}//end function


function HidePanelPostDetails()
{//begin function
    
    var objPanel
    
    //alert('here');
    //this gets the correct panel and hides it
    objPanel=document.all.item("ctl00_ContentPlaceHolder1_panelPostDetails");
	objPanel.style.visibility='hidden';
    objPanel.style.display='none';

}//end function




///****************other
		/*
		document.onmousemove = mouseCoordinates;
		function mouseCoordinates(e) {
            var posx = 0;
            var posy = 0;
            if (!e) var e = window.event;
            if (e.pageX || e.pageY)
            {
            posx = e.pageX;
            posy = e.pageY;
            }
            else if (e.clientX || e.clientY)
            {
                var theTop;
                if (document.documentElement && document.documentElement.scrollTop)
	                theTop = document.documentElement.scrollTop;
                else if (document.body)
	                theTop = document.body.scrollTop
	        
                posx = e.clientX + document.body.scrollLeft;
                posy = e.clientY + theTop;
            }
            // posx and posy contain the mouse position relative to the document
            // Do something with this information

			window.status = "X:" + posx + " y:" + posy
		}
		*/