//document.onkeydown = fnKeyCheck;
//document.onkeyup = fnKeyCheckUp;
document.onmousedown = fnMouseDown;
document.onmousemove = fnMouseMove;

function fnMouseDown(){
// alert(document.getElementById('idOn').value);
}

function fnMouseMove(){
 if(document.getElementById('idOn').value!=1){
  document.getElementById('idOn').value=9;
  document.getElementById('idDropMenu_12').style.display="none";
  //document.getElementById('idDropMenu_13').style.display="none";
  document.getElementById('idDropMenu_14').style.display="none";
  document.getElementById('idDropMenu_21').style.display="none";	
  //-- TURN OFF FLASH	
  if(document.getElementById('idVideo1')){
   document.getElementById('idVideo1').style.display="block";
   document.getElementById('idVideo2').style.display="none";	
  }
  //-- TURN OFF FLASH END
 }
 	//else{ alert('dev'); }
}

//-- overall menu close
//document.onmousemove = fnCloseAll;
//document.onclick = alert('test');
/*
function fnCloseAll(){
 if(document.getElementById('idOn').value!=1){
  document.getElementById('idDropMenu_12').style.display="none";
  //document.getElementById('idDropMenu_13').style.display="none";
  document.getElementById('idDropMenu_14').style.display="none";
  document.getElementById('idDropMenu_21').style.display="none";	
  //-- TURN OFF FLASH	
  if(document.getElementById('idVideo1')){
   document.getElementById('idVideo1').style.display="block";
   document.getElementById('idVideo2').style.display="none";	
  }
  //-- TURN OFF FLASH END
 }
 	//else{ alert('dev'); }
}
*/

function fnCloseAllCertain(){
  document.getElementById('idDropMenu_12').style.display="none";
  //document.getElementById('idDropMenu_13').style.display="none";
  document.getElementById('idDropMenu_14').style.display="none";
  document.getElementById('idDropMenu_21').style.display="none";	
  //-- TURN OFF FLASH
  if(document.getElementById('idVideo1')){
   document.getElementById('idVideo1').style.display="block";
   document.getElementById('idVideo2').style.display="none";	
  }
  //-- TURN OFF FLASH END 	
}

function fnOpen(tmpId){
 if (document.getElementById('idDropMenu_'+tmpId).innerHTML!="empty.") {
  document.getElementById('idDropMenu_'+tmpId).style.display="block";
 }
 //-- TURN OFF FLASH 
 if(document.getElementById('idVideo1')){
  document.getElementById('idVideo1').style.display="none";
  document.getElementById('idVideo2').style.display="block";	
 }
 //-- TURN OFF FLASH 
}

function fnClose(tmpId){
 if ((document.getElementById('idDropMenu_'+tmpId).innerHTML!="empty.")) {
 //&&(document.getElementById('idOn').value=1)
  document.getElementById('idDropMenu_'+tmpId).style.display="none";
 }
 //-- TURN ON FLASH 
 if(document.getElementById('idVideo1')){
  document.getElementById('idVideo1').style.display="block";
  document.getElementById('idVideo2').style.display="none";	
 }
 //-- TURN ON FLASH  
}

function fnMenuLightUp(tmpId){
 //document.getElementById(tmpId).style.backgroundImage="url('../images/dropdown1.png')";
 //alert('on');
 document.getElementById(tmpId).style.color="white"; 
}

function fnMenuLightOut(tmpId){
 //document.getElementById(tmpId).style.backgroundImage="url('')";
 document.getElementById(tmpId).style.color="#fea100";
 //alert('out');
}

//-- ROLL IN/OUT
 function fnRollIn(button, tmpId){
  //alert(tmpId);
  if((tmpId==21)||(tmpId==12)||(tmpId==14)){
	 document.getElementById('idOn').value=1;
	}
  document.getElementById(button).src="http://www.artatworkforyou.com/mobileteamchallenge/public_html/images/2_"+ button +".gif";
  ajaxGetMenu(tmpId);
 }

 function fnRollOut(button){
  document.getElementById(button).src="http://www.artatworkforyou.com/mobileteamchallenge/public_html/images/"+ button +".gif";
  document.getElementById('idOn').value=9;
 }
//-- ROLL IN/OUT END
 
 
 function fnArrow(button, tmpId){
  if(document.getElementById(button).src=="http://bookthecapitol.com/images/arrow_down.gif"){
   document.getElementById(button).src="http://bookthecapitol.com/images/arrow_side.gif";
   document.getElementById('idMenu_'+tmpId).style.display="none";
	} else {
   document.getElementById(button).src="http://bookthecapitol.com/images/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");
  }
  if(iframeDocument.body.innerHTML){
   document.getElementById('idMiddle').innerHTML=iframeDocument.body.innerHTML +'<br/><br/>';
	}
	//alert(iframeDocument.body.innerHTML);
 }
 
function fnMenuSelection(selection){
   document.getElementById('idIframe').src='admin/cms/display/'+ 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);
			 if(document.getElementById('idDropMenu_'+tmpId)){
			  document.getElementById('idDropMenu_'+tmpId).innerHTML=xmlHttp.responseText;
				if(document.getElementById('idDropMenu_'+tmpId).innerHTML!='empty.'){ //if no items in drop menu
				 fnCloseAllCertain();
			   document.getElementById('idDropMenu_'+tmpId).style.display="block";
			   //-- TURN OFF FLASH
         if(document.getElementById('idVideo1')){
          document.getElementById('idVideo1').style.display="none";
          document.getElementById('idVideo2').style.display="block";	
         }
				 //-- TURN OFF FLASH END				 
				}
			 }			 	

      }
    }
	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);
			 if(xmlHttp.responseText==''){
	      document.getElementById('idBreadCrumbs').style.display="none";
			 } else {
			  document.getElementById('idBreadCrumbs').innerHTML=xmlHttp.responseText;
	      document.getElementById('idBreadCrumbs').style.display="block";				
       }
			}
    }
	xmlHttp.open("GET","xml/xml_bread_crumbs.php?id="+tmpFilename,true);
	
  xmlHttp.send(null);
  }
//-- AJAX FOR GET MENU END --//
	

function ajaxVideo(tmpVideo)
{
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)
      {
			
			if(document.getElementById('idViewDetails').style.display=='none'){
			 document.getElementById('idViewDetails').innerHTML=xmlHttp.responseText;

       //document.getElementById('idAnimated').style.display='none';
       //document.getElementById('idStill').style.display='block';
			 
			 var tmpStringTop="";
			 
			 if (window.pageYOffset){
        tmpStringTop=window.pageYOffset+70;
			 } else {
        tmpStringTop=(document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
				tmpStringTop=tmpStringTop+70;
			 }
				
			 tmpStingTop=tmpStringTop+"px";
			 //alert(tmpStringTop);
			 
			 document.getElementById('idViewDetails').style.top=tmpStingTop;
			 document.getElementById('idViewDetails').style.display='block';
			 
			 //alert(document.body.scrollTop);
 			 //alert(window.pageYOffset);
			 
			 //var tmpString=document.body.clientHeight+"px";
			 var tmpString=(document.body.clientHeight*2)+"px";
			 
			 document.getElementById('idShade').style.height=tmpString;			 
			 document.getElementById('idShade').style.display='block';	
			} else {
			 document.getElementById('idViewDetails').style.display='none';
			 document.getElementById('idShade').style.display='none';
			 	
       //document.getElementById('idAnimated').style.display='block';
       //document.getElementById('idStill').style.display='none';			 		 
			}

      }
    }
	xmlHttp.open("GET","xml/xml_video.php?vid="+tmpVideo);
	
  xmlHttp.send(null);
  }
	
//-- SHOP FUNCTIONS --//
function ajaxFunction(tmpId, tmpCat, tmpBack)
{
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)
      {
			
			if(document.getElementById('idViewDetails').style.display=='none'){
			 document.getElementById('idViewDetails').innerHTML=xmlHttp.responseText;

       //document.getElementById('idAnimated').style.display='none';
       //document.getElementById('idStill').style.display='block';
			 
			 var tmpStringTop="";
			 
			 if (window.pageYOffset){
        tmpStringTop=window.pageYOffset+25;
			 } else {
        tmpStringTop=(document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
				tmpStringTop=tmpStringTop+25;
			 }
				
			 tmpStingTop=tmpStringTop+"px";
			 //alert(tmpStringTop);
			 
			 document.getElementById('idViewDetails').style.top=tmpStingTop;
			 document.getElementById('idViewDetails').style.display='block';
			 
			 //alert(document.body.scrollTop);
 			 //alert(window.pageYOffset);
			 
			 //var tmpString=document.body.clientHeight+"px";
			 var tmpString=(document.body.clientHeight*2)+"px";
			 
			 document.getElementById('idShade').style.height=tmpString;			 
			 document.getElementById('idShade').style.display='block';	
 			 document.getElementById('idQty').select();		 
			}else if(tmpBack!=1){
			 document.getElementById('idViewDetails').style.display='none';
			 document.getElementById('idShade').style.display='none';
			 	
       //document.getElementById('idAnimated').style.display='block';
       //document.getElementById('idStill').style.display='none';			 		 
			}
									
			if(tmpBack==1){
			 document.getElementById('idViewDetails').innerHTML=xmlHttp.responseText;			
			}
			

      }
    }
	xmlHttp.open("GET","xml/xml_details.php?id="+tmpId+"&cat="+tmpCat,true);
	
  xmlHttp.send(null);
  }
	



function ajaxFunctionPhotos(tmpId, tmpCat, 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;
									
      }
    }
	xmlHttp.open("GET","xml/xml_photos.php?id="+tmpId+"&cat="+tmpCat+"&pic="+tmpPic,true);
	
  xmlHttp.send(null);
  }		