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()
{

tmpId=document.getElementById('idIframe').value;
//alert(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);

			 document.getElementById('idMiddle').innerHTML=xmlHttp.responseText; //'test123';//iframeDocument.body.innerHTML +'<br/><br/>';
			 window.scroll(0,0);

//-- CUSTOM SECTION
 	//-- FOR RIGHT BAR --//
//	tmpSplitty=redirect_script_uri.replace("/dev/","");
	//alert("split: "+tmpSplitty);
//	arrIFrame=iframe.src.split('_');
//	tmpSize=arrIFrame.length;
//	tmpSize=tmpSize-1;
  //alert(tmpSize);
	//alert(arrIFrame[tmpSize]);
	//if((iframe.src!="http://cornerstoneintegrativehealth.com/dev/") && (arrIFrame[tmpSize]=="home.html")) {
  if(tmpId=="home.html"){
	 document.getElementById('idRightBar').style.display="block";
   document.getElementById('content_2').style.backgroundImage="url('images/upgrade/content_bg2.jpg')";
 	 
	 //alert('CHECK 2');
   document.getElementById('idBottomBorder').style.backgroundImage="url('images/upgrade/content_bg3.jpg')";	 
	 
	 document.getElementById('idMiddle').style.width="433px";	 
	//} else if ((iframe.src=="http://cornerstoneintegrativehealth.com/dev/") && ((tmpSplitty=="index.php")||(tmpSplitty=="")) ) {
	// document.getElementById('idRightBar').style.display="block";
  // document.getElementById('content_2').style.backgroundImage="url('images/upgrade/content_bg2.jpg')";
	// document.getElementById('idMiddle').style.width="433px";	
	} else {
	 document.getElementById('idRightBar').style.display="none";
   document.getElementById('content_2').style.backgroundImage="url('images/upgrade/content_bg.jpg')";
	 
	 //alert('CHECK 1');
   document.getElementById('idBottomBorder').style.backgroundImage="url('images/upgrade/content_bg4.jpg')";	 
	 
	 document.getElementById('idMiddle').style.width="650px";
	}
	//-- FOR RIGHT BAR END --//
//-- CUSTOM SECTION END
			 
      }
    }
	xmlHttp.open("GET","xml/xml_get_content2.php?id="+tmpId,true);
	
  xmlHttp.send(null);
 
 /*
  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='test123';//iframeDocument.body.innerHTML +'<br/><br/>';
//	window.scroll(0,0);
 }

//-- IFRAME

 function fnIframeLoaded(){
 }
 
function fnMenuSelection(selection, id, url){
	 if(url==0){
	  //alert('Regular page link.');
		//alert(selection);
	  //document.getElementById('idIframe').src='admin/cms/display/'+ selection;
		document.getElementById('idIframe').value=selection;
		fnIframeReload();
		/*
		//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 --//
