 function fnShowSub(dropId){
 if(document.getElementById('idSub_'+dropId).style.display=="none"){
  document.getElementById('idSub_'+dropId).style.display="block";
 } else {
  document.getElementById('idSub_'+dropId).style.display="none";
 } 
}

 function fnArrow(button, tmpId){
  if(document.getElementById(button).src==document.getElementById('idCONST_IMAGES').value+"arrow_down.gif"){
   document.getElementById(button).src=document.getElementById('idCONST_IMAGES').value+"arrow_side.gif";
   document.getElementById('idMenu_'+tmpId).style.display="none";
	} else {
   document.getElementById(button).src=document.getElementById('idCONST_IMAGES').value+"arrow_down.gif";
   ajaxGetMenu(tmpId);
	}	
 }
 
 function fnIframeReload(){
  var iframe=document.getElementById('idIframe');
  if (iframe.contentDocument) { // For NS6
    iframeDocument = iframe.contentDocument; 
  } else if (iframe.contentWindow) { // For IE5.5 and IE6
    iframeDocument = iframe.contentWindow.document;
  } else if (iframe.document) { // For IE5
    iframeDocument = iframe.document;
  } else { // We got nothin.
    alert("Error: could not find IFRAME document");
  }
  document.getElementById('idMiddle').innerHTML=iframeDocument.body.innerHTML +'<br/><br/>';
 }

//-- IFRAME

 function fnIframeLoaded(){
  var iframe=document.getElementById('idIframe');
  if (iframe.contentDocument) { // For NS6
    iframeDocument = iframe.contentDocument; 
  } else if (iframe.contentWindow) { // For IE5.5 and IE6
    iframeDocument = iframe.contentWindow.document;
  } else if (iframe.document) { // For IE5
    iframeDocument = iframe.document;
  } else { // We got nothin.
    alert("Error: could not find IFRAME document");
  }
  var redirect_script_uri=document.getElementById('idREDIRECT_SCRIPT_URI').value;
	
	//alert(redirect_script_uri);
	//alert(iframe.src);	
	tmpSrc=iframe.src.split("?", 1);
	//alert(tmpSrc);
	newTmpSrc=tmpSrc[0].replace("http://www.maryvilleartwalk.com/web/", "");
	//alert(newTmpSrc);
	
  if(newTmpSrc){
	if((tmpSrc[0]!="")&&(tmpSrc[0]!=redirect_script_uri)){
   //alert(iframeDocument.body.innerHTML);
   document.getElementById('idMiddle').innerHTML=iframeDocument.body.innerHTML +'<br/><br/>';	
	}	//alert(iframeDocument.body.innerHTML);
	}
	
	tmpShortSrc=iframe.src;
	tmpShortSrc=tmpShortSrc.substring(0,50);
	//alert(tmpShortSrc);
	
	if(tmpShortSrc=='http://www.maryvilleartwalk.com/web/mac_search.php'){
	 //ajaxMacSearch();
	 //alert(document.getElementById('idResults').innerHTML);
	 document.getElementById('idResultsDisplay').innerHTML=document.getElementById('idResults').innerHTML;
	}
	
 }
 
function fnMenuSelection(selection, id, url){
	 if(url==0){
	  //alert('Regular page link.');
	  document.getElementById('idIframe').src='admin/cms/display/'+ selection;
		/*
		//TURN ON FORMS
		if(document.getElementById('idBrowserPage').value=='contact_us.php'){
		 arrSelection=selection.split('_');
		 //alert(arrSelection);
		 tmpSelection=arrSelection[1];
		 for(x=2;x<arrSelection.lenght;x++){
		  tmpSelection=tmpSelection+'_'+arrSelection[x];
		 }
		 //alert(tmpSelection);
		 if(tmpSelection=='home.html'){ //home.html
	 	  //alert('Form ON.');
		  document.getElementById('idOnOffForm').style.display='block';
		 } else {
	 	  //alert('Form OFF.');		 
		  document.getElementById('idOnOffForm').style.display='none';
		 }
		}
		//TURN ON FORMS END
		*/
	 } else {
	  tmpSelection=selection.search('http:');
	  if(tmpSelection>-1){
     window.open(selection, '')
	   //document.location=selection;
	  } else {
	   document.location=selection;
	  }
	 }
	 	 
   //ajaxBreadCrumbs(selection); 
} 

//-- AJAX FOR GET MENU --//
function ajaxGetMenu(tmpId)
{
//alert('ajaxShowPrompt');

var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {

			 //alert(xmlHttp.responseText);
			 document.getElementById('idMenu_'+tmpId).innerHTML=xmlHttp.responseText;
			 document.getElementById('idMenu_'+tmpId).style.display="block";			 
			 
      }
    }
	xmlHttp.open("GET","xml/xml_get_menu.php?id="+tmpId,true);
	
  xmlHttp.send(null);
  }
//-- AJAX FOR GET MENU END --//


//-- AJAX FOR GET MENU --//
function ajaxBreadCrumbs(tmpFilename)
{
//alert('ajaxShowPrompt');

var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
			 //alert(xmlHttp.responseText);
       document.getElementById('idBreadCrumbs').innerHTML=xmlHttp.responseText;

    	 if(document.getElementById('idBreadCrumbsOn').value==1){
          document.getElementById('idBreadCrumbsWrap').style.display="block";
    	 } else {
    	  document.getElementById('idBreadCrumbsWrap').style.display="none";			 
    	 }			 
			 
      }
    }
	xmlHttp.open("GET","xml/xml_bread_crumbs.php?id="+tmpFilename,true);
	
  xmlHttp.send(null);
  }
//-- AJAX FOR GET MENU END --//


//-- AJAX FOR SHOW PHOTO --//
function ajaxFunctionPhotos(tmpPic)
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {

			 document.getElementById('idViewDetails').innerHTML=xmlHttp.responseText;
			 var tmpStringTop="";
			 
			 if (window.pageYOffset){
        tmpStringTop=window.pageYOffset+15;
			 } else {
        tmpStringTop=(document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
				tmpStringTop=tmpStringTop+15;
			 }
				
			 tmpStingTop=tmpStringTop+"px";

			 var tmpContent=parseFloat(document.getElementById('content_2').clientHeight);
			 var tmpHeader=parseFloat(document.getElementById('idheader').clientHeight);
			 var tmpFooter=parseFloat(document.getElementById('idfooter').clientHeight);

			 var tmpString=tmpContent + tmpHeader + tmpFooter + 50 + 300; //document.getElementById('content_2').clientHeight;//document.body.clientHeight;			 
			 tmpString=tmpString+"px";
			 
			 //alert(tmpString);
			 
			 document.getElementById('idShade').style.height=tmpString;
			 document.getElementById('idShade').style.display='block';

      }
    }
	xmlHttp.open("GET","xml/xml_show_photos.php?pic="+tmpPic,true);
	
  xmlHttp.send(null);
  }	
//-- AJAX FOR SHOW PHOTO END --//

function fnShowTag(x,y,id){
 tmpXofPhoto=findPosX(document.getElementById('idPhotoWrapper'));
 tmpYofPhoto=findPosY(document.getElementById('idPhotoWrapper'));

 document.getElementById('idTagger').style.top=(y+tmpYofPhoto-15)+"px";
 document.getElementById('idTagger').style.left=(x+tmpXofPhoto-50)+"px"; //-50 & -15 for padding of display box...
 document.getElementById('idTagger').style.borderColor="white";
 document.getElementById('idTagger').style.display="block";
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }
	
function fnPhotoLoaded(){
 //document.getElementById('idCaption').style.width=document.getElementById('idPhoto').clientWidth;
}

/*
//-- AJAX FOR MAC SEARCH --//
function ajaxMacSearch()
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {

			 alert(xmlHttp.responseText);
			 
      }
    }
		
	//netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
	xmlHttp.open("GET","http://www.blountopia.com/xml/xml_mac_search.php",true);
	
  xmlHttp.send(null);
  }
//-- AJAX FOR CLEAR AUTO SAVE CACHE END --//
*/


function ajaxPopUp(tmpWindow, tmpBack, tmpId)
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {

			//alert(xmlHttp.responseText);
			
			if((document.getElementById('idViewDetails').style.display=='none')||(varBucky==1)){
			 varBucky=0;
			 document.getElementById('idViewDetails').innerHTML=xmlHttp.responseText;

			 var tmpStringTop="";

			 if (window.pageYOffset){
        tmpStringTop=window.pageYOffset+60;
			 } else {
        tmpStringTop=(document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
				tmpStringTop=tmpStringTop+60;
			 }

			 tmpStingTop=tmpStringTop+"px";
			 //alert(tmpStringTop);
			 
			 document.getElementById('idViewDetails').style.top=tmpStingTop;
			 document.getElementById('idViewDetails').style.display='block';
			 
			 //alert(document.body.scrollTop);
 			 //alert(window.pageYOffset);
			 
			 tmpVar1=document.getElementById('idViewDetails').style.top.replace(/px/, "");
			 
			 //-- LEFT PLACEMENT --//			 
			 tmpVar2=findPosX(document.getElementById('idfooter'));
			 tmpVar2=tmpVar2+200;
 			 document.getElementById('idViewDetails').style.left=tmpVar2+"px";
			 //-- LEFT PLACEMENT END --//

			 tmpVar3=findPosY(document.getElementById('idfooter'));			 
			 //tmpVar2=document.body.clientHeight;
			 //alert(tmpVar2);
			 tmpCalibration=1000; // This could be the height of the footer instead...
			 tmpSum=parseFloat(tmpVar1)+parseFloat(tmpVar3)+tmpCalibration;
			 //alert("VAR2: "+tmpVar2);
			 //alert("VAR3: "+tmpVar3);			 
			 
			 var tmpString=tmpSum+"px";//document.body.clientHeight+"px";

			 document.getElementById('idShade').style.height=tmpString;
			 document.getElementById('idShade').style.display='block';			 
			}
			
			else if(tmpBack!=1){
			 document.getElementById('idViewDetails').style.display='none';
			 document.getElementById('idShade').style.display='none';			 
			}
			if(tmpBack==1){
			 document.getElementById('idViewDetails').innerHTML=xmlHttp.responseText;			
			}
			
			varBucky=0;
			
      }
    }
		
	switch(tmpWindow){
	 case 'participate' : xmlHttp.open("GET","xml/xml_participate.php",true);
	  break;
	}
	
  xmlHttp.send(null);
}
