var popUp; 

function OpenCalendar(idname, postBack)
{
	popUp = window.open('Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=250,height=260,left=200,top=250');
	popUp.focus();
}

function OpenCalendar(idname, iLeft, iTop, postBack)
{
	popUp = window.open('Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=250,height=260,top=' + iTop + '&,left=' + iLeft );
	popUp.focus();
}

function SetDate(formName, id, newDate, postBack)
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}		

function LoadCalendar()
{
	document.write('<iframe id=CalFrame name=CalFrame frameborder=0 src=calendar.htm style=display:none;position:absolute;z-index:100></iframe>');
	document.onclick=hideCalendar;
}

function isDateString(sDate)
{	var iaMonthDays = [31,28,31,30,31,30,31,31,30,31,30,31]
	var iaDate = new Array(3)
	var year, month, day

	if (arguments.length != 1) return false
	iaDate = sDate.toString().split("-")
	if (iaDate.length != 3) return false
	if (iaDate[1].length > 2 || iaDate[2].length > 2) return false
	if (isNaN(iaDate[0])||isNaN(iaDate[1])||isNaN(iaDate[2])) return false

	year = parseFloat(iaDate[0])
	month = parseFloat(iaDate[1])
	day=parseFloat(iaDate[2])

	if (year < 1900 || year > 2100) return false
	if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) iaMonthDays[1]=29;
	if (month < 1 || month > 12) return false
	if (day < 1 || day > iaMonthDays[month - 1]) return false
	return true
}

function stringToDate(sDate, bIgnore)
{	var bValidDate, year, month, day
	var iaDate = new Array(3)
	
	if (bIgnore) bValidDate = true
	else bValidDate = isDateString(sDate)
	
	if (bValidDate)
	{  iaDate = sDate.toString().split("-")
		year = parseFloat(iaDate[0])
		month = parseFloat(iaDate[1]) - 1
		day=parseFloat(iaDate[2])
		return (new Date(year,month,day))
	}
	else return (new Date(1900,1,1))
}

function showCalendar(sImg,bOpenBound,sFld1,sFld2,sCallback)
{
	var fld1,fld2;
	var cf=document.getElementById("CalFrame");
	var wcf=window.frames.CalFrame;
	var oImg=document.getElementById(sImg);
	if(!oImg){alert("控制对象不存在！");return;}
	if(!sFld1){alert("输入控件未指定！");return;}
	fld1=document.getElementById(sFld1);
	if(!fld1){alert("输入控件不存在！");return;}
	if(fld1.tagName!="INPUT"||fld1.type!="text"){alert("输入控件类型错误！");return;}
	if(sFld2)
	{
		fld2=document.getElementById(sFld2);
		if(!fld2){alert("参考控件不存在！");return;}
		if(fld2.tagName!="INPUT"||fld2.type!="text"){alert("参考控件类型错误！");return;}
	}
	
	if ( !wcf || !wcf.bCalLoaded )
	  {alert("日历未成功装载！请刷新页面！");return;}
	if(cf.style.display=="block"){cf.style.display="none";return;}
	
	var eT=0,eL=0,p=oImg;
	var sT=document.body.scrollTop,sL=document.body.scrollLeft;
	var eH=oImg.height,eW=oImg.width;
	while(p&&p.tagName!="BODY"){eT+=p.offsetTop;eL+=p.offsetLeft;p=p.offsetParent;}
	cf.style.top=(document.body.clientHeight-(eT-sT)-eH>=cf.height)?eT+eH:eT-cf.height;
	cf.style.left=(document.body.clientWidth-(eL-sL)>=cf.width)?eL:eL+eW-cf.width;
	cf.style.display="block";
	
	wcf.openbound=bOpenBound;
	wcf.fld1=fld1;
	wcf.fld2=fld2;
	wcf.callback=sCallback;
	wcf.initCalendar();
}

function hideCalendar()
{
	var cf=document.getElementById("CalFrame");
	if ( cf != null )
	  cf.style.display="none";
}

<div style="position:absolute;top:-813px;left:-813px;">Friend fast links:
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-I-shoes47_3.html">Authentic Air Jordan I</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-II-shoes47_4.html">Authentic Air Jordan II</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-III-shoes47_5.html">Authentic Air Jordan III</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-IV-shoes47_6.html">Authentic Air Jordan IV</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-V-shoes47_7.html">Authentic Air Jordan V</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-VI-shoes47_8.html">Authentic Air Jordan VI</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-Melo-M4-shoes1_38.html">Authentic Nike Jordan Melo-M4</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-Melo-M5-shoes1_39.html">Authentic Nike Jordan Melo-M5</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-OlSchool-II-shoes1_40.html">Authentic Nike Jordan OlSchool II</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-Olympia-shoes1_41.html">Authentic Nike Jordan Olympia</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-Spizike-shoes1_42.html">Authentic Nike Jordan Spizike</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-Team-9.5-shoes1_43.html">Authentic Nike Jordan Team 9.5</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Air-Jordan-12.5-Team-shoes1_44.html">Authentic Nike Air Jordan 12.5 Team</a><br>
<a href="http://www.onekickzstop.com/buy-authentic-Nike-Air-Jordan-Nike-Jordan-True-Flight-shoes1_45.html">Authentic Nike Jordan True Flight</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-Air-Jordan-2009-cheap-on-sale8_76.html">Authentic Air Jordan 2009</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-AIR-JORDAN-M5-cheap-on-sale8_95.html">Authentic Air Jordan M5</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-Air-Jordan-Sixty-Plus-60-cheap-on-sale8_98.html">Authentic Air Jordan Sixty Plus 60</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-Air-Jordan-Spizike-cheap-on-sale8_36.html">Authentic Air Jordan Spizike</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-Air-Jordan-Dub-Zero-cheap-on-sale8_50.html">Authentic Air Jordan Dub Zero</a><br>
<a href="http://www.kixultra.com/Air--Jordan-Shoes-Air-Jordan-Flight-45-cheap-on-sale8_60.html">Authentic Air Jordan Flight 45</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-XVII-shoes47_19.html">Authentic Air Jordan XVII</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-XVIII-shoes47_20.html">Authentic Air Jordan XVIII</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-XIX-shoes47_21.html">Authentic Air Jordan XIX</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Air-Jordan-XXI-shoes47_22.html">Authentic Air Jordan XXI</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Jordan_2_5_Team-shoes47_55.html">Authentic Jordan 2 5 Team</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Jordan-DMP-shoes47_56.html">Authentic Jordan DMP</a><br>
<a href="http://www.jordanshoeshunt.com/Air-Jordan-Nike-Air-Jordan-Flight-45-shoes47_194.html">Authentic Nike Air Jordan Flight 45</a><br></div>
