function OpenProfile(id) 
{ 
	var MyLink; 
	var myPopUp; 
	
	MyLink = rootPath + '/Community/MemberProfileView.aspx?ShowHeader=no&AccountID=' + id.toString();
	myPopUp = window.open(MyLink,'MyWindow','width=750,height=550,toolbar=no,status=no,location=no,directories=no,menubar=no,resizable=no,scrollbars=yes,left=10,top=10,dependent=yes'); 
}

function OpenProfileFromForum(id) 
{ 
	var MyLink; 
	var myPopUp; 
	
	MyLink = '../Community/MemberProfileView.aspx?ShowHeader=no&AccountID=' + id.toString();
	myPopUp = window.open(MyLink,'MyWindow','width=750,height=550,toolbar=no,status=no,location=no,directories=no,menubar=no,resizable=no,scrollbars=yes,left=10,top=10,dependent=yes'); 
}

function OpenPicture(id, h, w)
{
	MyLink = '../Photos/PictureViewer.aspx?PictureID=' + id.toString();
	var scroll = "no";
	
	if (window.screen.width < w)
	{
		w = window.screen.width - 50;
		scroll = "yes";
	}
	if (window.screen.height < h)
	{
		h = window.screen.height - 50;
		scroll = "yes";
	}
		
	myPopUp = window.open(MyLink,'MyWindow','width=' + w.toString() + ',height=' + h.toString() + ',toolbar=no,status=no,location=no,directories=no,menubar=no,resizable=yes,scrollbars=' + scroll + ',left=0,top=0,dependent=yes'); 
}

function mhHover(tbl, idx, cls)
{
	var t,d;
	
	if (document.getElementById)
		t=document.getElementById(tbl);
	else 
		t=document.all(tbl);
	
	if(t==null)
		return;
		
	if(t.getElementsByTagName)
		d=t.getElementsByTagName("TD");
	else 
		d=t.all.tags("TD");
		
	if(d==null)
		return;
		
	if(d.length<=idx)
		return;
		
	d[idx].className=cls;
}

function OpenPopup(url)
{
	var myPopUp; 
	
	myPopUp = window.open(url,'MyWindow','width=500,height=550,toolbar=no,status=no,location=no,directories=no,menubar=no,resizable=no,scrollbars=yes,left=10,top=10,dependent=yes'); 
}

 function ToggleGalleryThumbnail(pictureID, clientID) 
 {
    largeThumbDiv = document.getElementById('SecondaryThumbDiv' + pictureID);
    smallThumb = document.getElementById(clientID);

    if (largeThumbDiv.className == "secondaryThumbnailHidden") {
      largeThumbDiv.className = "secondaryThumbnailPopup";
      largeThumbDiv.style.left = getposOffset(smallThumb, "left") - ((largeThumbDiv.offsetWidth - smallThumb.offsetWidth) / 2) + "px";
      largeThumbDiv.style.top = getposOffset(smallThumb, "top")  - ((largeThumbDiv.offsetHeight - smallThumb.offsetHeight) / 2) + "px";
      setTimeout(function() { largeThumbDiv.style.visibility = "visible"; }, 5);
    } else {
	  largeThumbDiv.className = "secondaryThumbnailHidden";
    }
  }
  
  function getposOffset(what, offsettype){
  var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
  var parentEl=what.offsetParent;
  while (parentEl!=null){
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
  }
  return totaloffset;
}
