////////////////////////////////////////////////////////////////////////////////
function btnCalendar(prompt,cmd,type){ 
/*   var b;
   if(type="red")
  	   b=["gbr_l.gif","gbr_c.gif","gbr_r.gif"];
	if(!width) 
	   width="100%";*/
	s= '<table cellpadding="0" cellspacing="0" border="1" width="100%">'+
			'<tr>'+
				'<td class="btn_red_l"></td>'+
				'<td class="btn_red_c">'+
					'<a href="'+cmd+'">'+prompt+'</a>'+
				'</td>'+
				'<td class="btn_red_r"></td>'+
			'</tr>'+
		'</table>';
	return s;
 }

////////////////////////////////////////////////////////////////////////////////
function Calendar(date,_class){
   var dpm,offs,days,s,n,ss,c,c1,c2,f,dd,v,vv,CurDate = new Date(date);
	CurDate.setDate(1);
	dpm=CurDate.getDaysPerMonth();
	offs=CurDate.getDayOfWeek();
	days=offs+dpm-1;
	if(days<28)
		days=28
	else if(days<35)
		days=35
	else
		days=42;
	s="";
	n=-offs;
	for(i=0;i<days;i++){
		if(i%7==0)
			s=s+"<tr>";
		ss=(n>=0 && n<dpm)?
			"<td id='cal_"+(n+1).toString()+"' style='width:14%; min-width:14%; max-width:14%;'>"+
				 "<h1 id='cal_num_"+(n+1).toString()+"'>"+(n+1).toString()+"</h1>"+
				 "<h3 id='cal_data_"+(n+1).toString()+"'>&nbsp;</h3>"+
			"</td>":
			"<td>&nbsp;</td>";
		s=s+ss;
		if(i%7==6)
			s=s+"</tr>";
		n++;
	}
	months="";
/*   for(i=0;i<12;i++){
      months+="<td>"+ btnCalendar(CurDate.Months[i],"javascript:setMonth("+i.toString()+")")+"</td>";
   }
	months='<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>'+months+'</tr></table>';*/
	bc=(_class=="calendary_inner")?"#c1cb1f":"#d34c3c";
	_class=(_class)?"class='"+_class+"'":"";
	days="";
   for(i=0;i<7;i++){
      if(i==0) 
         b="border-top:none; border-left: solid thin "+bc+"; border-right: solid thin white";
	   else if(i==6)
         b="border-top:none; border-left: solid thin white; border-right: solid thin "+bc;
		else
         b="border-top:none; border-left: solid thin white; border-right: solid thin white";
      days+="<td width='14%' style='text-align:center; height:40px; padding-top: 20px; border-top:none;"+b+"' valign='bottom'>"+
			"<div style='min-width:150px'><h6>"+
			CurDate.DoW[i+1]+"</h6></div></td>";
	}
	
   days='<tr>'+days+'</tr>';

	return months+"<table "+_class+" width='100%' cellpadding='0' cellspacing='0' border='0' style='border-collapse:collapse;border-top:none'>"+
		days+s+"</table>";
}

////////////////////////////////////////////////////////////////////////////////
function CalendarLn(date){
	this.CurDate=new Date(date);
	this.getLnDoW = function () {
		var days="",b;
   	for(i=0;i<7;i++){
			if(i==0)
				b="border-top:none; border-left: solid thin #d34c3c; border-right: solid thin white";
			else if(i==6)
				b="border-top:none; border-left: solid thin white; border-right: solid thin #d34c3c";
			else
				b="border-top:none; border-left: solid thin white; border-right: solid thin white";
			days+="<td width='14%' style='text-align:center; height:40px; padding-top: 20px; border-top:none;"+b+"' valign='bottom'>"+
				"<div style='min-width:150px'><h6>"+
				this.CurDate.DoW[i+1]+"</h6></div></td>";
		}
		return days;
	}
	this.getWeekDays = function (n){
		for(i=0;i<days;i++){
			if(i%7==0)
				s=s+"<tr>";
			ss=(n>=0 && n<dpm)?
				"<td id='cal_"+(n+1).toString()+"' style='width:14%; min-width:14%; max-width:14%;'>"+
					 "<h1 id='cal_num_"+(n+1).toString()+"'>"+(n+1).toString()+"</h1>"+
					 "<h3 id='cal_data_"+(n+1).toString()+"'>&nbsp;</h3>"+
				"</td>":
				"<td>&nbsp;</td>";
			s=s+ss;
			if(i%7==6)
				s=s+"</tr>";
			n++;
		}
	}
}
