//Expand & Collapse
var RecordCount;
var Path;
//Path = "http://www.nationalrailmuseum.org/new_nrm/";
//**************************************************************
//Add
//Path = "http://10.0.0.243:86/new_nrm/";

var serverRootPath = location.host;
Path = 'http://' + serverRootPath + '/new_nrm/'
//**************************************************************
//Path = "http://172.16.9.99/web/rail/new_nrm/";
imgArrowLeft = "";
function funcNewOpen(text)
{
  window.open(text,"_blank","location=no,toolbar=no,status=no,scrollbars=yes,menubar=no,width=525,height=550,resizable=yes,dependent=yes").moveTo(0,0);
}
function funcExpandAll(totalRec)
{
window.status="";
var tblName;
var imgName;

     for(var incr=1;incr<=totalRec;incr++)
		{
			if (navigator.appName == "Microsoft Internet Explorer") 
                {
                  tblName=eval("document.all.tb" +incr);
                  imgName=eval("document.img"+incr);
	            }
	        else 
                { 
                   tblName=eval("document.getElementById('tb" +incr + "')");
                   imgName=eval("document.img"+incr);
                  
		        }
				//if ( incr == 2 || incr == 6 )
				//{
		            tblName.style.display ="block";
	    	      	imgName.src= Path + "images/arrowDown.gif";
				//}
	    }        
}

function funcCollapseAll(totalRec)
{
window.status="";
var tblName;
var imgName;

     for(var incr=1;incr<=totalRec;incr++)
 	    	{
		    
			if (navigator.appName == "Microsoft Internet Explorer") 
			{
			       tblName=eval("document.all.tb" +incr);
                   imgName=eval("document.img"+incr);
		          
		     }
	       else
            {
                 tblName=eval("document.getElementById('tb" +incr + "')");
				 imgName=eval("document.img"+incr);;
            }
            tblName.style.display ="none";
		     imgName.src= Path + "images/arrowright.gif";
        }    
}
function funcToggle(totalRec,currRec)
{
window.status="";
var tblName;
var imgName;

   if (navigator.appName == "Microsoft Internet Explorer") 
   {
	
   tblName=eval("document.all.tb" +currRec);
   imgName=eval("document.img"+currRec);

		if (tblName.style.display =="none")
		{    
		    funcCollapseAll(totalRec);
			tblName.style.display ="block";
			imgName.src=Path + "images/arrowDown.gif";
		} 
		else  
		{
			funcCollapseAll(totalRec);
			tblName.style.display="none";
			imgName.src=Path + "images/arrowright.gif";
         }
    }
    else
     {
          tblName=eval("document.getElementById('tb" +currRec + "')");
          imgName=eval("document.img"+currRec);

         if (tblName.style.display =="none")
		{
		funcCollapseAll(totalRec);
			tblName.style.display ="block";
			imgName.src=Path + "images/arrowDown.gif"
		} 
		else  
		{
		funcCollapseAll(totalRec);
			tblName.style.display="none";
			imgName.src=Path + "images/arrowright.gif"
         }

    }
    
}
function funcTopMenuClick(id)
{  
window.open('new_nrm/index.jsp?vtype=top&page='+id,'_self');
}
function funcLeftMenuClick(id)
{
window.open(Path + 'include/show_page.jsp?vtype=left&id='+id,'_self');
}
function funcBottomClick(id)
{
window.open('new_nrm/index.jsp?vtype=top&page='+id,'_self');
}
function funcOtherMenuClick(id)
{
window.open(Path + 'include/show_page.jsp?vtype=other&id='+id,'_self');
}
function fn_CheckNull(Control,ControlName)//to ensure that the mandatory values are entered/selected
{
	if(Control.value == "")
	{
		alert("Please enter value in " + ControlName + " field")
		Control.focus();
		return false;
	}	
	else
	return true;
}
function fn_CheckNumeric(Control,ControlName)//to ensure that the mandatory values are entered/selected
{
	if (!parseInt(Control.value))
	{
	alert("Please enter numeric value in " + ControlName + " field")
	Control.focus();
	return false;
	}
	else
	return true;
}

function Initialise()
{
		document.Forms[0].txtsourcepage.value = window.opener.window.location;
}
/*function funcoutdoorMenuClick(type,id)
{
if (type=="outdoor")
window.open(Path + 'include/show_page.jsp?vtype=outdoor&id='+id,'_self');
elseif (type=="indoor")
window.open(Path + 'include/show_page.jsp?vtype=indoor&id='+id,'_self');
}*/

function funcOutMenuClick(id)
{
window.open(Path + 'include/show_page.jsp?vtype=out&id='+id,'_self');
}
function funcInMenuClick(id)
{
window.open(Path + 'include/show_page.jsp?vtype=in&id='+id,'_self');
}
function funcgeosite(strgeo)
{
 if(strgeo != "Select")
    window.open(strgeo,'_blank');
}	