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.jpg"){
   document.getElementById(button).src=document.getElementById('idCONST_IMAGES').value+"arrow_side.jpg";
   document.getElementById('idMenu_'+tmpId).style.display="none";
	} else {
   document.getElementById(button).src=document.getElementById('idCONST_IMAGES').value+"arrow_down.jpg";
   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;
	redirect_script_uri='http://cornerstoneintegrativehealth.com' + redirect_script_uri +'';

	if((iframe.src!="")&&(iframe.src!=redirect_script_uri)){
   document.getElementById('idMiddle').innerHTML=iframeDocument.body.innerHTML +'<br/><br/>';	
	}	//alert(iframeDocument.body.innerHTML);
 }
 
function fnMenuSelection(selection, id, url){
	 if(url==0){
	  //alert('Regular page link.');
	  document.getElementById('idIframe').src='admin/cms/display/'+ selection;
		//alert('http://cornerstoneintegrativehealth.com/dev/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 --//