﻿// JScript File

var CurObj ="";
var BlockObj="";
var BlockObj1="";
//var blockCurObj ="";

function ShowPopup(id)
{
oid = id.toString();
window.showModalDialog("GalleryPopup.aspx?ID="+oid,'',"dialogHeight:500px; dialogWidth: 650px; help: no; resizable: no; status: no;center");
}
function doUnload(str)
{
//alert(str);
ostr = str.toString();
if (window.event.clientX < 0 && window.event.clientY < 0)
{
window.showModalDialog("TrackPage.aspx?Page="+ostr,'',"dialogHeight:175px; dialogWidth: 240px; help: no; resizable: no; status: no");
//window.open('TrackPage.aspx?Page='+ostr,'','width=220,height=350,left=400,top=300,noresizable');
//window.open('TrackPage.aspx?Page='+ostr,'','width=220,height=350,left=400,top=300,noresizable');
//window.location="TrackPage.aspx?Page="+ostr;
//window.opener.location.href='TrackPage.aspx';
//?Page='+ostr;
}
}


/* Menu Change background */


function TabMenu_OnMouseOver(tdName)
{   
    document.getElementById(tdName).className = 'menuon';
//   if (window.XMLHttpRequest) { // Mozilla, Safari, ... button.setAttribute("style", "visibility:visible");  } else if (  window.ActiveXObject) { // IE button.className = "show"; }     
}
function TabMenu_OnMouseOut(tdName,tabName)
{
    if (document.getElementById(tabName).style.display == 'none')
        document.getElementById(tdName).className = 'menuoff';
}
function TabMenus(VisibleTabNumber,TotalTabNumber)
{

    for (i=0;i<TotalTabNumber;i++)
    {   
        tabName = 'tab' + i;
        tdName = 'td' + i;    
        tabVisible = 'tab' + VisibleTabNumber;       

             
        if (tabName == tabVisible)
        {     
            document.getElementById(tabName).style.display = 'block';
            document.getElementById(tabName).style.visibility = 'visible';
            document.getElementById(tdName).className = 'menuon';
        }
        else
        {
            document.getElementById(tabName).style.display = 'none';
            document.getElementById(tabName).style.visibility = 'hidden';
            document.getElementById(tdName).className = 'menuoff';
        }              
    }
}



function ShowCalender(TextBoxName)
{
    var windowArea = "dialogHeight:155px; dialogWidth: 240px; help: no; resizable: no; status: no";
    var date = window.showModalDialog("../Library/HTML/DatePicker.htm",'',windowArea);
    if (date != null)
    {
        oDate = new Date(date);
        month = oDate.getMonth()+1;
        day = oDate.getDate();
        year = oDate.getFullYear();
        switch (month)
        {
            case 1:
                month ='Jan';
                break;    
            case 2:
                month ='Feb';
                break; 
            case 3:
                month ='Mar';
                break; 
            case 4:
                month ='Apr';
                break; 
            case 5:
                month ='May';
                break; 
            case 6:
                month ='Jun';
                break;
            case 7:
                month ='Jul';
                break;
            case 8:
                month ='Aug';
                break;
            case 9:
                month ='Sep';
                break;
            case 10:
                month ='Oct';
                break;
            case 11:
                month ='Nov';
                break;
            case 12:
                month ='Dec';
                break;
        }
        TextBoxName.value= day + ' ' + month + ' ' + year;
    }
   return false;
}

function ReturnID(FormName,ID)
{   
    oFormName = FormName.toString();
    oID = ID.toString();
    window.location= oFormName + oID;
} 
function ShowWindow(srcScreen,KeyField,OperMode,sTitle,Width,Height)
{
    try
    {	
        var oWinObject = new Object();
        var oStatus;	
        var sOutLook;
        oWinObject.srcScreen = srcScreen;	
        oWinObject.KeyField = KeyField;
        oWinObject.OperMode = OperMode;
        oWinObject.sTitle = sTitle;
        sOutLook="dialogWidth:"+Width+"px;dialogHeight:"+Height+"px;status:no;scroll:no;help:no";
        oStatus = window.showModalDialog('Popup.htm',oWinObject,sOutLook);
        if(oStatus == true) 
        {
            var i;
            var oInput = document.getElementsByTagName("Input");
            for(i = 0;i<oInput.length;i++)
            {
                if(oInput[i].value == "0") oInput[i].value = oWinObject.retValue;
            }
            return true;
        }
        else
            return false;
    }
    catch(e){} 
}
function ReturnSelectedID(ID)
{
    var oWinObject = window.dialogArguments;   
    oWinObject.retValue = ID;
    window.returnValue = true;
    window.close();
}  


/*popup window */

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}


//Toggle Display Function
function toggleDisplay(id,ImgID) 
{  
//    ImageFlip= new Image()
//    ImageFlip.src = "Library/Image/Td_up_but.jpg";    
//    
//    ImageFlipdown= new Image()
//    ImageFlipdown.src = "Library/Image/Td_down_but.jpg";    
    
    if (document.getElementById) 
    {
        var e = document.getElementById(id);
        if (e) 
        {
            if ( e.style.display !== "" ) 
            {
                e.style.display = ""
                if (ImgID!='')                
                    document.getElementById(ImgID).src="Library/Image/Td_up_but.jpg";
//                var strImageOn = document.getElementById(ImgID);
//                strImageOn.src = ImageFlip.src; return true;
            }  
            else
            {
                e.style.display = "none"
                if (ImgID!='')                
                document.getElementById(ImgID).src="Library/Image/Td_down_but.jpg";
            }
        }  
    }
}


//Plans Sub Menu Display Function
function PlanDisplay(id,objName) 
{  
    
  if (document.getElementById) 
  {
    var e = document.getElementById(id);
    if (e) 
    {		
      if ( e.style.display == "none" )
      {		
         e.style.display = "block";
         document.getElementById(objName).className="Blocksubmenuon";                                
                  if(BlockObj!=id && BlockObj!="")
         {  
            document.getElementById(BlockObj1).className="Blocksubmenuoff";
            document.getElementById(BlockObj).style.display = "none";                            
            
         }
         BlockObj = id;  
         BlockObj1 =objName;         
      }
      else     
      {        
         e.style.display = "none"      
         document.getElementById(objName).className="Blocksubmenuoff";
      }
    } 
  }
}  

//Block Menu Display Function
function BlockDisplay(blockid,blockobjName) 
{  

/*-----------------------------------------------------*/
//   if (blockCurObj != '')
//   {    
//    document.getElementById(blockCurObj).className="menuoff"; 
//    blockCurObj="";
//        
//   }
//   else   
//   {
//    document.getElementById(blockobjName).className="managementmenuon";
//    blockCurObj =blockobjName;
//   }

/*-----------------------------------------------------*/
   
  if (document.getElementById) 
  {
    var e = document.getElementById(blockid);
    if (e) 
    {
      if ( e.style.display !== "" )      
         {
         document.getElementById("Visible").style.display = "none"      
         document.getElementById("Visible1").style.display = "none"      
         document.getElementById("Visible2").style.display = "none"      
         document.getElementById("block").className="menuoff";
         document.getElementById("block1").className="menuoff";
         document.getElementById("block2").className="menuoff";
         document.getElementById("td").className="menuoff";
         document.getElementById("td1").className="menuoff";
         document.getElementById(blockobjName).className="managementmenuon";
         e.style.display = ""
         }
         
      else     
      {
         document.getElementById("td").className="menuoff";
         document.getElementById("td1").className="menuoff";
         document.getElementById("block").className="menuoff";
         document.getElementById("block1").className="menuoff";
         document.getElementById("block2").className="menuoff";
         e.style.display = "none"                       
      }
    } 
  }
}  


function UnDisplay(objName) 
{  
   if (CurObj == "")
   {    
    document.getElementById("td").className="menuoff"; 
    document.getElementById("td1").className="menuoff"; 
    document.getElementById(objName).className="menuon"; 
    document.getElementById("block").className="menuoff";
    document.getElementById("block1").className="menuoff";
    document.getElementById("block2").className="menuoff";
    document.getElementById("Visible").style.display = "none"      
    document.getElementById("Visible1").style.display = "none"      
    document.getElementById("Visible2").style.display = "none"      
         
    CurObj="";
   }
   else   
   {
    CurObj =objName;
   }
}


function PriceDisplay(id) 
{          
    if (document.getElementById) 
    {
        var e = document.getElementById(id);
        if (e) 
        {
            if ( e.style.display !== "" ) 
            {
                e.style.display = ""               
            }  
            else
            {
                e.style.display = "none"                
            }
        }  
    }
}
//dummy jaan
function PlanBlockMenus(obj1,obj2){	return true;}
function tdnames(obj1)
{
	return true;}
