﻿

//Open a popup window
function openWindow(page,title,height,width)
{
  
   popupwin=window.open(page,title,"height="+ height +",width="+ width +",left="+ getLeft(width)+",top="+ getTop(height)+ ", toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
   popupwin.focus();
} 

// Returns popup window left position
function getLeft(width)
{
    var left = window.parent.screen.width/2;    
    left = left - width/2 ; 
    return left;

}

// Returns popup window top position
function getTop(height)
{
    var top = window.parent.screen.height/2;
    top = top - height/2  ;    
    return top;
}

// Used for show and hide error div
function showHideDiv(visibility)
{    
  
    if (visibility)
    {
        document.getElementById('ctl00_ContentHolderHmv_uxDivError').style.display='block';
    }
    else
    {
        document.getElementById('ctl00_ContentHolderHmv_uxDivError').style.display='none';                
    }
}

//call when click on calender image
// Open a calendar and assign the value in text box
function CalendarClick(button,Evnt,txt)
   {
  
     var textId=button.id;
     var index=textId.lastIndexOf('_')  ;
     
     index=index+1;
     textId=textId.substring(0,index);
     textId=textId+txt;

     var objText=document.getElementById(textId);
     var arrayVal= objText.value.split('/') ;
     if(arrayVal[0].indexOf('0')==0)
        {
         arrayVal[0]=arrayVal[0].charAt(1);
         
         }
         
     lcs(objText,button,arrayVal[0]);
     
     //For cancel the event
      if (Evnt.preventDefault) 
	  {
        Evnt.preventDefault(); // The W3C DOM way
       } 
     else
      {
         Evnt.returnValue=false;
     	}
    }
    
