function GregorianToSolar(gYear, gMonth, gDay) {
	  if (gDay == 0 && gMonth == 0 && gYear == 0)	{
				dDate = new Date();
	
				gDay = dDate.getDate();
				gMonth = dDate.getMonth() + 1;
				gYear = dDate.getFullYear();
	  }

	gYear = (gYear== 0) ? 2000 : gYear;
	(gYear<1000) ? (gYear += 2000) : true;
	gYear -= ( (gMonth < 3) || ((gMonth == 3) && (gDay < 21)) ) ? 622 : 621;
	switch (gMonth) { 
		case 1: (gDay<21)? (gMonth=10, gDay+=10):(gMonth=11, gDay-=20); break; 
		case 2: (gDay<20)? (gMonth=11, gDay+=11):(gMonth=12, gDay-=19); break; 
		case 3: (gDay<21)? (gMonth=12, gDay+=9):(gMonth=1, gDay-=20); break; 
		case 4: (gDay<21)? (gMonth=1, gDay+=11):(gMonth=2, gDay-=20); break; 
		case 5: 
		case 6: (gDay<22)? (gMonth-=3, gDay+=10):(gMonth-=2, gDay-=21); break; 
		case 7: 
		case 8: 
		case 9: (gDay<23)? (gMonth-=3, gDay+=9):(gMonth-=2, gDay-=22); break; 
		case 10:(gDay<23)? (gMonth=7, gDay+=8):(gMonth=8, gDay-=22); break; 
		case 11: 
		case 12:(gDay<22)? (gMonth-=3, gDay+=9):(gMonth-=2, gDay-=21); break; 
		default: break; 
	}

		this.gYear = gYear;
		this.gMonth = gMonth - 1;
		this.gDay = gDay;

		this.getDate  = function () { return this.gDay; };
		this.getMonth = function () { return this.gMonth; };
		this.getYear  = function () { return this.gYear; };
		this.getFullYear = function () { return this.gYear; };
}

function JDate()
{
	dayName = new Array ("يک شنبه "," دوشنبه"," سه شنبه "," چهار شنبه "," پنجشنبه "," جمعه "," شنبه" )
	monName = new Array ( "دي","بهمن","اسفند","فروردين","ارديبهشت","خرداد","تير","مرداد","شهريور","مهر","آبان","آذر")
	now = new Date 
	///-----------

nowgetDay = now.getDay();
//nowgetDate = now.getDate()+1;
nowgetDate = now.getDate();
nowgetMonth = now.getMonth();
nowgetFullYear = now.getFullYear();

	rr=dayName[nowgetDay]
	if (nowgetMonth <= 1 )
		ii=nowgetFullYear-622
	else
		if ( nowgetDate <= 21 && nowgetMonth == 2)
			ii=nowgetFullYear-622
		else
			ii=nowgetFullYear-621
	///----------------
	if ( nowgetMonth == 6 || nowgetMonth == 7 || nowgetMonth == 8 || nowgetMonth == 9)
		if ( nowgetDate <=22 )
			mm=monName[nowgetMonth]
		else
			mm=monName[nowgetMonth+1]
	if ( nowgetMonth == 4 || nowgetMonth == 5 || nowgetMonth == 10 )
		if ( nowgetDate <=21 )
			mm=monName[nowgetMonth]
		else
			mm=monName[nowgetMonth+1]
	if ( nowgetMonth == 0 || nowgetMonth == 2 || nowgetMonth == 3 )
		if ( nowgetDate <=20 )
			mm=monName[nowgetMonth]
		else
			mm=monName[nowgetMonth+1]
	if ( nowgetMonth == 1)
		if ( nowgetDate <=19 )
			mm=monName[nowgetMonth]
		else
			mm=monName[nowgetMonth+1]
	if ( nowgetMonth == 11)
		if ( nowgetDate <=21 )
			mm=monName[nowgetMonth]
		else
			mm=monName[nowgetMonth-11]
	///----------------
	if ( nowgetMonth == 2 || nowgetMonth == 3 || nowgetMonth == 0 )
		if ( nowgetDate <=20 )
//			mr=nowgetDate+10
			mr=nowgetDate+11
		else
			mr=nowgetDate+10-30
	if ( nowgetMonth == 4 || nowgetMonth == 5 )
		if ( nowgetDate <=21 )
			mr=nowgetDate+10
		else
			mr=nowgetDate+10-31
	if ( nowgetMonth == 6 || nowgetMonth == 7 || nowgetMonth == 8 )
		if ( nowgetDate <=21 )
			mr=nowgetDate+9
		else
			mr=nowgetDate+9-31
	if ( nowgetMonth == 10 || nowgetMonth == 11)
		if ( nowgetDate <=21 )
			mr=nowgetDate+9
		else
			mr=nowgetDate+9-30
	if ( nowgetMonth == 9)
		if ( nowgetDate <=22 )
			mr=nowgetDate+8
		else
			mr=nowgetDate+8-30
	if ( nowgetMonth == 1 )
		if ( nowgetDate <=20 )
			mr=nowgetDate+11
		else
			mr=nowgetDate+11-30 
	///----------------
	document.write(rr + ", " +mr+" "+ mm + " " + ii)
}
