function load_c_details(objectID, requestFile, offset, obj)
{
	objectID = document.getElementById(objectID);
	requestDoc(requestFile, objectID);
	if(offset)
	{
		if(offset > 0)
		{
			objectID.style.marginTop = offset+"px";
		}
	}
	objectID.style.visibility = "visible";

	if(obj)
	{
		bpi = setInterval("goanchor('"+obj+"')",150);
	}
}

function load_c_details_i(objectID, requestFile, info_objectID)
{
	objectID = document.getElementById(objectID);
	objectID.style.height = "400px";
	requestDoc(requestFile, objectID);

	if(info_objectID)
	{
		info_object   = document.getElementById(info_objectID);
		source_object = document.getElementById(requestFile);
		if(info_object && source_object)
		{
			info_object.innerHTML = source_object.innerHTML;
			info_object.style.visibility = 'visible';
		} else {
			info_object.style.visibility = 'hidden';
		}
	}
}

function goanchor(anchor)
{
    Scroller.speed = 15;
    clearInterval(bpi);
    a = document.getElementsByTagName("a");
    for (i = 0; i < a.length; i++) {
        if (a[i].name == anchor) {
            clearInterval(Scroller.interval);
            Scroller.interval = setInterval("Scroller.scroll(" + Scroller.offsetParent(a[i]) + ")", 10);
        }
    }

}

function requestDoc(postParam, resID)
{
  var http = null;
  var pParam = "action";
  var pURL = "i/c_gallery.php";

  if(window.XMLHttpRequest)
  	http = new XMLHttpRequest();
  else
    if (window.ActiveXObject)
    http = new ActiveXObject("Microsoft.XMLHTTP");

  http.onreadystatechange = function()
  {
    if(http.readyState == 4)
    {
       if(http.status == 200){
       	if(resID)
       	{
			if(http.responseText.length > 0)
				resID.innerHTML = http.responseText;
		}
	   }
    }
  };
  http.open("POST", pURL, true);
  http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  http.send(pParam+"="+postParam);
}


bpi = setInterval("goanchor('pp')",50);