/***********************************************
Copyright (C) 2008  Uğur HAMZADAYI
************************************************/
var ug_ucalendarpicker_popup = null;
function ug_ucalendarpicker_popup_load() {
   if( ug_ucalendarpicker_popup != null )
	  return;
	   
    ug_ucalendarpicker_popup = new UDatePickerCtrl();
	
	//Attach messages
	if( ug_ucalendarpicker_popup != null ) {
       AttachEventUDatePicker( window , "resize" , function(){ ug_ucalendarpicker_popup.RefreshPosition();} );
	   AttachEventUDatePicker( window , "scroll" , function(){ ug_ucalendarpicker_popup.RefreshPosition();} );
	   AttachEventUDatePicker( document.body , "click" , function(){ ug_ucalendarpicker_popup.OnClickWindow();} );	   
       AttachEventUDatePicker( ug_ucalendarpicker_popup.calendar , "mouseover" , function () {ug_ucalendarpicker_popup.OnOverCalendar();} );	   
       AttachEventUDatePicker( ug_ucalendarpicker_popup.calendar , "mouseout" , function () {ug_ucalendarpicker_popup.OnOutCalendar();} );	      
	}
    
}

//Bu Önemli
function AttachEventUDatePicker(obj, eventName, eventHandler) {
   
  if( obj ) {
	 
     if(eventName.substring(0, 2) == 'on') {
 	    eventName = eventName.substring(2,eventName.length);
	 }

     if(obj.attachEvent){
        obj.attachEvent('on'+ eventName, eventHandler);
     } 
     else 
     if( obj.addEventListener){
        obj.addEventListener(eventName, eventHandler, false);  
     }
	 
	 
  }
 
};

AttachEventUDatePicker( window , 'onload' , ug_ucalendarpicker_popup_load );




function UDatePickerCtrl() {
	
   this.CreatePopup();
   
};


UDatePickerCtrl.prototype.CreatePopup = function () {
   this.lang = "tr";  //Türkçe
   this.WeekStartDay = 0;
   this.timeid = null;
   this.ismouseover=false;
   this.bodyclickcount=0;
   this.curExternalDate = new Date();
   this.curDate = new Date();
   this.calendar = ug_ucalendarpicker_popup = document.createElement('div');
   this.calendar.setAttribute('id','global_ucalendarpopupid_1');
   this.calendar.style.position = 'absolute';
   this.calendar.style.display = 'none';
   this.calendar.style.backgroundImage = 'url(http://'+location.hostname+'/include/javascript/datetime/xfill.png)';
   
   innerText = '<iframe id="global_ucalendarpopupid_1frame" style="filter:alpha(opacity=0);-moz-opacity:0;opacity:0; position:absolute;display:none;" frameBorder="0" scrolling="no"></iframe>';
   innerText += '<div style="margin:6px;" onmousedown="return false;"  onconextmenu="return false;" onselectstart="return false;" onscroll="return false;">';
   innerText += '<div onmousedown="return false;"  onconextmenu="return false;" onselectstart="return false;" onscroll="return false;" id="' + this.calendar.id + 'header"> </div>';
   innerText += '<div onmousedown="return false;"  onconextmenu="return false;" onselectstart="return false;" onscroll="return false;" id="' + this.calendar.id + 'days"> </div>';
   innerText += '</div>';
   
   this.calendar.innerHTML = innerText;
   document.body.appendChild(this.calendar);
};



UDatePickerCtrl.prototype.GetLeftPosition = function ( obj ) {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
};

UDatePickerCtrl.prototype.GetTopPosition = function ( obj ) {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;	
   return curtop;
};

UDatePickerCtrl.prototype.OnMouseOverOutControl = function( element , type ) {
  if( type == 0 )	
     element.style.backgroundColor = '#808080';
  else
  if( type == 1 )	
     element.style.backgroundColor = '#606060'; 
}

UDatePickerCtrl.prototype.OnMouseOverOutDay = function( element , type) {
  if( type == 0 )	
     element.style.backgroundColor = '#BBDDDD';
  else
  if( type == 1 )	
     element.style.backgroundColor = '#DDFFFF'; 
  else
  if( type == 2 )	
     element.style.backgroundColor = '#600000'; 
  else
  if( type == 3 )	
     element.style.backgroundColor = '#800000'; 
	 
}



UDatePickerCtrl.prototype.OnClickDays = function ( strDate ) {
	
  if( this.targetControl != null )
     this.targetControl.value = strDate;
  
  this.HidePopup();
}

UDatePickerCtrl.prototype.OnClickControls = function ( ctrl , data ) {
  if( ctrl == 0 ) {
     this.curDate = new Date(this.curDate.getFullYear() - 1 , this.curDate.getMonth(),1);
	 this.FillCalendar();
  }
  else
  if( ctrl == 1 ) {
     this.curDate = new Date(this.curDate.getFullYear() + 1 , this.curDate.getMonth(),1);
	 this.FillCalendar();
  }
  else
  if( ctrl == 2 ) {
	  
	 year = this.curDate.getFullYear();
	 month = this.curDate.getMonth();
	 month -= 1;
	 if( month < 0 ) {
		month = 11; 
		year--;
	 }
     this.curDate = new Date(year , month,1);
	 this.FillCalendar();
  }
  else
  if( ctrl == 3 ) {
	 year = this.curDate.getFullYear();
	 month = this.curDate.getMonth();
	 month += 1;
	 if( month > 11 ) {
		month = 0; 
		year++;
	 }
     this.curDate = new Date(year , month,1);
	 this.FillCalendar();
  }
  else
  if( ctrl == 4 ) {
	 year = this.curDate.getFullYear();
     this.curDate = new Date(year , data,1);
	 this.FillCalendar();
  }
  else
  if( ctrl == 5 ) {
	 month = this.curDate.getMonth();
     this.curDate = new Date(data , month,1);
	 this.FillCalendar();
  }
  
}




UDatePickerCtrl.prototype.DrawHeader = function () {
   monthsArray = new Array("Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık");
   if( this.lang == "tr" ) //Türkçe
      monthsArray = new Array("Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık");
   else
   if( this.lang == "en" ) //İngilizce
	  monthsArray = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

   calHeader = document.getElementById(this.calendar.id + 'header');
   if( calHeader != null ) {
	  innerText = '<table width="224" cellpadding="1" cellspacing="0" ><tr>';
      innerText += '<td onclick="ug_ucalendarpicker_popup.OnClickControls( 0 );" ondblclick="ug_ucalendarpicker_popup.OnClickControls( 0 );" style="cursor:pointer;text-align:center;width:10px;height:10px;FONT-WEIGHT: bold;FONT-SIZE:9pt;COLOR:#EEEEEE;FONT-FAMILY:arial;background:#808080;border:#AAAAAA 1px solid;">&nbsp;&lt;&lt;&nbsp;</td>';
      innerText += '<td onclick="ug_ucalendarpicker_popup.OnClickControls( 2 );" ondblclick="ug_ucalendarpicker_popup.OnClickControls( 2 );" style="cursor:pointer;text-align:center;width:10px;height:10px;FONT-WEIGHT: bold;FONT-SIZE:9pt;COLOR:#EEEEEE;FONT-FAMILY:arial;background:#808080;border:#AAAAAA 1px solid;">&nbsp;&lt;&nbsp;</td>';	  

      //innerText += '<td style="width:70px;height:10px;FONT-WEIGHT: bold;FONT-SIZE:10px;COLOR:#EEEEEE;FONT-FAMILY:verdena,arial;BACKGROUND: #0000FF;BORDER: #0000AA 0px solid">';
	  //innerText += '</td>';
      
      innerText += '<td style="text-align:center;width:10px;height:10px;">';
      innerText += '<select style="cursor:pointer;width:80px;height:18px;FONT-WEIGHT: bold;FONT-SIZE:10px;COLOR:#202020;FONT-FAMILY:verdena,arial;" onChange="ug_ucalendarpicker_popup.OnClickControls( 4 , this.options[this.selectedIndex].value );" id="udatecalndarpickerselectmonth" size="1">'
	  for( i = 0; i < 12; i++ ) {
		  if( this.curDate.getMonth() == i )
             innerText += '<option value="'+i+'" selected>'+monthsArray[i]+'</option>';
		  else	
		     innerText += '<option value="'+i+'">'+monthsArray[i]+'</option>';
	  }
      innerText += '</select></td>';
	  
	  
      innerText += '<td style="text-align:center;width:10px;height:10px;">';
      innerText += '<select style="cursor:pointer;width:50px;height:18px;FONT-WEIGHT: bold;FONT-SIZE:10px;COLOR:#202020;FONT-FAMILY:verdena,arial;" onselect="ug_ucalendarpicker_popup.OnClickControls( 5 , this.options[this.selectedIndex].value );" onchange="ug_ucalendarpicker_popup.OnClickControls( 5 , this.options[this.selectedIndex].value );" id="udatecalndarpickerselectyear" size="1">'
	  todate = new Date();
	  yearList = todate.getFullYear() - 90;
	  for( i = 0; i < 150; i++ ) {
		  if( this.curDate.getFullYear() == yearList )
             innerText += '<option value="'+yearList+'" selected>'+yearList+'</option>';
		  else	
		     innerText += '<option value="'+yearList+'">'+yearList+'</option>';
			 
 		 yearList++;
	  }
      innerText += '</select></td>';
	  
      innerText += '<td onclick="ug_ucalendarpicker_popup.OnClickControls( 3 );" ondblclick="ug_ucalendarpicker_popup.OnClickControls( 3 );" style="cursor:pointer;text-align:center;width:10px;height:10px;FONT-WEIGHT: bold;FONT-SIZE:9pt;COLOR:#EEEEEE;FONT-FAMILY:arial;background:#808080;border:#AAAAAA 1px solid;" >&nbsp;&gt;&nbsp;</td>';	  
	  innerText += '<td onclick="ug_ucalendarpicker_popup.OnClickControls( 1 );" ondblclick="ug_ucalendarpicker_popup.OnClickControls( 1 );" style="cursor:pointer;text-align:center;width:10px;height:10px;FONT-WEIGHT: bold;FONT-SIZE:9pt;COLOR:#EEEEEE;FONT-FAMILY:arial;background:#808080;border:#AAAAAA 1px solid;" >&nbsp;&gt;&gt;&nbsp;</td>';
      innerText += '</tr>';
      innerText += '</table>';

	  calHeader.innerHTML = innerText;
   }
   
};



UDatePickerCtrl.prototype.DrawDays = function () {

   var daysArray = null;
   if( this.lang == "tr" ) //Türkçe
      daysArray = new Array( "Pt","Sa","Çr","Pr","Cu","Ct","Pz" );
   else
	  daysArray = new Array( "Mo","Tu","We","Th","Fr","Sa","Su" );



   var beginDate = new Date(this.curDate.getFullYear(),this.curDate.getMonth(),1);
   var aybaslangicgunu = beginDate.getDay() - 1;
   if( aybaslangicgunu < 0 ) 
      aybaslangicgunu = 6;
	  
   //aybaslangicgunu = this.WeekStartDay - aybaslangicgunu;	  
   startDay = this.WeekStartDay;
   for( k=0 ; k < 7;k++ ) {
	  if( startDay == aybaslangicgunu ) {
		 aybaslangicgunu = k;
		 break;
  	  }
      startDay++;
	  if( startDay > 6 )
		 startDay = 0; 
   } 
   
   beginDate.setDate(beginDate.getDate()-aybaslangicgunu); 
   todate = new Date();
   calDays = document.getElementById(this.calendar.id + 'days');
   if( calDays != null ) {
	  innerText = '<table width="224" cellpadding="0" cellspacing="1">';
	 
	  innerText += '<tr>';
	  startDay = this.WeekStartDay;
	  for( z=0 ; z < 7;z++ ) {
	 	  innerText += '<td style="width:28px;text-align:center;height:10px;FONT-WEIGHT: bold;FONT-SIZE:11px;COLOR:#EEEEEE;FONT-FAMILY:verdena,arial;BACKGROUND:#2D87DE;BORDER: #4D67AC 1px solid" >'+daysArray[startDay]+'</td>';
		  startDay++;
		  if( startDay > 6 )
		     startDay = 0;
	  }
	  innerText += '</tr>';
	  for( v = 0; v < 6; v++ ) {
	     innerText += '<tr>';
  	     for( i=0 ; i < 7;i++ ) {
			
			
			strOutput = "";
			if( beginDate.getDate() < 10 )
  			   strOutput += "0";
			strOutput += beginDate.getDate() + '.';
			if( ( beginDate.getMonth() + 1 ) < 10 )
  			   strOutput += "0";
			strOutput += ( beginDate.getMonth() + 1 ) + '.';
			strOutput += beginDate.getFullYear();
			
			if( this.curDate.getMonth() ==  beginDate.getMonth() ) {
			   //if( beginDate.getFullYear() == todate.getFullYear() && beginDate.getMonth() == todate.getMonth() && beginDate.getDate() == todate.getDate() )
			   if( beginDate.getFullYear() == this.curExternalDate.getFullYear() && beginDate.getMonth() == this.curExternalDate.getMonth() && beginDate.getDate() == this.curExternalDate.getDate() )
  	 	          innerText += '<td onclick="ug_ucalendarpicker_popup.OnClickDays( \''+ strOutput +'\');" onmouseover="ug_ucalendarpicker_popup.OnMouseOverOutDay( this , 2 );" onmouseout="ug_ucalendarpicker_popup.OnMouseOverOutDay( this , 3 );"  style="cursor:pointer;width:28px;text-align:center;height:10px;FONT-WEIGHT: bold;FONT-SIZE:11px;COLOR:#f0f0f0;FONT-FAMILY:verdena,arial;BACKGROUND:#800000;BORDER: #AA0000 1px solid" >'+ (beginDate.getDate()) +'</td>';
			   else 	  
			      innerText += '<td onclick="ug_ucalendarpicker_popup.OnClickDays( \''+ strOutput +'\');" onmouseover="ug_ucalendarpicker_popup.OnMouseOverOutDay( this , 0 );" onmouseout="ug_ucalendarpicker_popup.OnMouseOverOutDay( this , 1 );" style="cursor:pointer;width:28px;text-align:center;height:10px;FONT-WEIGHT: bold;FONT-SIZE:11px;COLOR:#303030;FONT-FAMILY:verdena,arial;BACKGROUND:#DDFFFF;BORDER: #4D67AC 1px solid" >'+ (beginDate.getDate()) +'</td>';
			}
			else
 	  		   innerText += '<td onclick="ug_ucalendarpicker_popup.OnClickDays( \''+ strOutput +'\');" onmouseover="ug_ucalendarpicker_popup.OnMouseOverOutDay( this , 0 );" onmouseout="ug_ucalendarpicker_popup.OnMouseOverOutDay( this , 1 );" style="cursor:pointer;width:28px;text-align:center;height:10px;FONT-WEIGHT: bold;FONT-SIZE:11px;COLOR:#AAAAAA;FONT-FAMILY:verdena,arial;BACKGROUND:#DDFFFF;BORDER: #4D67AC 1px solid" >'+ (beginDate.getDate()) +'</td>';
			beginDate.setDate(beginDate.getDate() + 1 );
		 }
		 innerText += '</tr>';
	  }
     
	 
	  //Close Button
	 
      innerText += '</table>';
	  innerText += '<table width="224" cellpadding="1" cellspacing="0">';
	  innerText += '<tr>';
	  innerText += '<td></td>';
	  
      if( this.lang == "tr" ) //Türkçe
	     innerText += '<td onmouseover="ug_ucalendarpicker_popup.OnMouseOverOutControl( this , 0 );" onmouseout="ug_ucalendarpicker_popup.OnMouseOverOutControl( this , 1 );" onclick="ug_ucalendarpicker_popup.HidePopup();" style="cursor:pointer;width:28px;text-align:center;height:10px;FONT-WEIGHT: bold;FONT-SIZE:11px;COLOR:#EEEEEE;FONT-FAMILY:verdena,arial;BACKGROUND:#606060;BORDER: #EEEEEE 1px solid" >&nbsp;Kapat&nbsp;</td>';
      else		 
         innerText += '<td onmouseover="ug_ucalendarpicker_popup.OnMouseOverOutControl( this , 0 );" onmouseout="ug_ucalendarpicker_popup.OnMouseOverOutControl( this , 1 );" onclick="ug_ucalendarpicker_popup.HidePopup();" style="cursor:pointer;width:28px;text-align:center;height:10px;FONT-WEIGHT: bold;FONT-SIZE:11px;COLOR:#EEEEEE;FONT-FAMILY:verdena,arial;BACKGROUND:#606060;BORDER: #EEEEEE 1px solid" >&nbsp;Close&nbsp;</td>';	  
      innerText += '</tr>';
      innerText += '</table>';

	  calDays.innerHTML = innerText;
   }
   
};

UDatePickerCtrl.prototype.FillCalendar = function () {
  	this.DrawHeader();
	this.DrawDays();
   
};


UDatePickerCtrl.prototype.OnOverCalendar = function () {
   this.ismouseover=true;	
   if( this.timeid ) {
	  clearTimeout(this.timeid);
	  this.timeid = null;
   }
}

UDatePickerCtrl.prototype.OnOutCalendar = function () {
   this.ismouseover=false;		
   this.timeid = setTimeout( "ug_ucalendarpicker_popup.HidePopup()" , 10000 );
}


UDatePickerCtrl.prototype.OnClickWindow = function () {
	
  if( window.event ) {
	 if( window.event.srcElement ) {
   	    controlyear	= window.event.srcElement;
		while( controlyear != null ) {
			if( controlyear.id == 'udatecalndarpickerselectyear' || controlyear.id == 'udatecalndarpickerselectmonth' ) {
				return false;
			}
			controlyear = controlyear.parentNode;
		}
	 }
	  
  }
	
  if( !this.ismouseover && this.bodyclickcount >= 1 ) {
	 if( this.calendar.style.display == 'block' ) {
		 this.HidePopup();
	 }
  }

  this.bodyclickcount++;
  if( this.bodyclickcount > 2 )
	 this.bodyclickcount == 2; 
	 
  return false;
}


UDatePickerCtrl.prototype.RefreshPosition = function () {

    if( this.alignControl == null )
	   return;
	 
	   
	cxWin = window.innerWidth;
	scrollX = window.pageXOffset;
	if (navigator.appName == "Microsoft Internet Explorer") {
		if( document.documentElement.clientWidth ) {
    	   cxWin = document.documentElement.clientWidth;
		   scrollX = document.documentElement.scrollLeft;
		}
		else {
    	   cxWin = document.body.clientWidth;
		   scrollX = document.body.scrollLeft;
		}
		
	}
	

	cyWin = window.innerHeight;
	scrollY = window.pageYOffset;
	if (navigator.appName == "Microsoft Internet Explorer") {
		if( document.documentElement.clientWidth ) {		
    	   cyWin = document.documentElement.clientHeight;
		   scrollY = document.documentElement.scrollTop;
		}
		else {
    	   cyWin = document.body.clientHeight;
		   scrollY = document.body.scrollTop;
		}
		
	}


    //Range Belirleniyor...
	rx1 = scrollX;
	ry1 = scrollY;
	rx2 = rx1 + cxWin;
	ry2 = ry1 + cyWin;

    if( this.iframeWin == null ) { //iframe içinde degil ise
       hCtrl = this.alignControl.offsetHeight;	
	   wCtrl = this.alignControl.offsetWidth;	

   	   x1Pos = this.GetLeftPosition(this.alignControl);
 	   y1Pos = this.GetTopPosition(this.alignControl) + hCtrl;
 	   x2Pos = x1Pos + this.calendar.offsetWidth;
	   y2Pos = y1Pos + this.calendar.offsetHeight;

       if( y2Pos > ry2 ) {
		  y1Pos = this.GetTopPosition(this.alignControl) - this.calendar.offsetHeight;
	   }

	   this.calendar.style.left = x1Pos +'px'; 
       this.calendar.style.top = y1Pos +'px'; 
	
	
       inlineframe = document.getElementById('global_ucalendarpopupid_1frame');
	   if( inlineframe ) {
	      inlineframe.style.left = 0 + 'px';
	      inlineframe.style.top = 0 + 'px';
	      inlineframe.style.width =  this.calendar.offsetWidth + 'px';
	      inlineframe.style.height = this.calendar.offsetHeight +'px';
	      this.calendar.style.zIndex = 1000;
	      inlineframe.style.zIndex = -1; //this.calendar.style.zIndex - 1;
	   }
	}
	else { //iframe içinde ise
		
       hCtrl = this.calendar.offsetHeight;	
  	   wCtrl = this.calendar.offsetWidth;	
	   x1Pos = (cxWin - wCtrl ) / 2;
	   y1Pos = (cyWin - hCtrl ) / 2;
	   x1Pos += scrollX;
 	   y1Pos += scrollY;

	   this.calendar.style.left = x1Pos +'px'; 
       this.calendar.style.top = y1Pos +'px'; 
       inlineframe = document.getElementById('global_ucalendarpopupid_1frame');
	   if( inlineframe ) {
	      inlineframe.style.left = 0 + 'px';
	      inlineframe.style.top = 0 + 'px';
	      inlineframe.style.width =  this.calendar.offsetWidth + 'px';
	      inlineframe.style.height = this.calendar.offsetHeight +'px';
	      this.calendar.style.zIndex = 1000;
	      inlineframe.style.zIndex = -1; //this.calendar.style.zIndex - 1;
	   }
	}
};

UDatePickerCtrl.prototype.ShowPopup = function ( ctrl , alignctrl , language , iframeWin ) {
    this.iframeWin = iframeWin;
	if( ctrl == null || alignctrl == null )
	   return false;
	   
    this.lang = language;
    if( language == "tr" )	{ //Türkçe
       this.WeekStartDay = 0;
	}
	else 
	{
       this.WeekStartDay = 6;
	}


	this.curExternalDate = null;
	sonuc = ctrl.value.split( "/" );
	if( sonuc.length == 3 ) {
	   iDay = parseInt( sonuc[0] , 10 );
	   iMonth = parseInt( sonuc[1] , 10 );
	   iYear  = parseInt( sonuc[2] , 10 );	   
	   
	   if( iDay >=1 && iDay <=31 && iMonth >=1 && iMonth <=12 && iYear >=1900 && iYear <=9999 ) {

		  if( iMonth == 2 ) {
			 iMaxSubat = 28; 
			 if( ( iYear % 4 ) == 0 ) 
			    iMaxSubat = 29;
				
			 if( iDay > iMaxSubat )	 
			    iDay = iMaxSubat;
				 
			 
		  }
		  this.curExternalDate = new Date(iYear , iMonth - 1 ,iDay );
	   }
	}
    if( this.curExternalDate == null )
	   this.curExternalDate = new Date();
	
	this.curDate = this.curExternalDate;



    if( this.timeid ) {
	   clearTimeout(this.timeid);
	   this.timeid = null;
    }
	
	
	this.bodyclickcount=0;
	this.alignControl = alignctrl;
	this.targetControl = ctrl;
	this.FillCalendar(); //Takvim çiziliyor....
	this.calendar.style.display = 'block';


    inlineframe = document.getElementById('global_ucalendarpopupid_1frame');
	if( inlineframe )
	   inlineframe.style.display = 'block';
	
	
	this.RefreshPosition();
	this.timeid = setTimeout( "ug_ucalendarpicker_popup.HidePopup()" , 10000 );
        
};

UDatePickerCtrl.prototype.HidePopup = function () {
	this.calendar.style.display = 'none';
    inlineframe = document.getElementById('global_ucalendarpopupid_1frame');
	if( inlineframe )
	   inlineframe.style.display = 'none';
	
    this.bodyclickcount = 0; 
	this.ismouseover = false;
    if( this.timeid ) {
	   clearTimeout(this.timeid);
	   this.timeid = null;
    }
};

function ShowUDatePicker( idControl , idAlign , language , iframeWin ) {
	//Dil Ayarları 
	if( iframeWin != null ) {
	   control = iframeWin.document.getElementById(idControl);
   	   if( idAlign == null || idAlign == "" )
	      aligncontrol = control;
       else
          aligncontrol = iframeWin.document.getElementById(idAlign);
	}
	else {
       control = document.getElementById(idControl);
   	   if( idAlign == null || idAlign == "" )
	      aligncontrol = control;
       else
          aligncontrol = document.getElementById(idAlign);
	}
	
    if( ug_ucalendarpicker_popup != null && control.disabled != true && control.readOnly != true ) {
		if( iframeWin != null )
		   ug_ucalendarpicker_popup.ShowPopup( control , aligncontrol , language , iframeWin );
		else
		   ug_ucalendarpicker_popup.ShowPopup( control , aligncontrol , language , iframeWin );
	}
}

	



/*****************************************************************************/
