
// * 在新的窗口中打开页面
//   @param url
// * @param isFull 是否全屏{yes | no | 1 | 0}
// * @param scrollbars 滚动条 { yes | no | 1 | 0 }；
// * @return 新的页面

function openNewWindow(url,isFull,scrollbars)
{
	opener="";
	if( isFull=="yes" || isFull=="1" )
	{
		window.open(url,'','fullscreen,scrollbars');
		return false;
	}
	else if( scrollbars == "yes" || scrollbars == "1")
		window.open(url, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=0,left=0,width=screen.width,height=screen.height');
	else
		window.open(url, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=0,left=0,width=screen.width,height=screen.height');
		
	return false;
	
}
//**
// * 在新的窗口中打开页面，大小适中
// * @param url
// * @return 新的页面
//*/
function openHalfWindow(url)
{
	opener="";
	window.open(url, '','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=0,left=0,width=screen.width,height=600');	
	return false;
	
}
//**
// * 在当前窗口中打开页面
// * @param url 页面地址
// * @return 新的页面
// */
function openWindow(url)
{
	window.location=URL;
}
//**
// * 关闭当前的窗口
// */
function closeWindow()
{
  window.close();
  return false;
}
//**
// * 返回到前一个窗口
// */
function backWindow()
{
  history.back(-1);
  return false;
}

///**
// * 把pContainer中的所有类型为pType的“class”属性设为pClassName
// * @param pContainer
// * @param pType
// * @param pClassName
//* @return 新的页面
// */
function setClass(pContainer,pType,pClassName){
 	for( i=0; i<pContainer.length; i++)
 	{
 		if(pContainer.elements(i).type == pType)
 		pContainer.elements(i).className = pClassName;
 	}
}



//页面窗口禁止按F5键
function checkF5(){
if(event.keyCode==116)
{
   event.keyCode=13;
   return false;
}
}
document.onkeydown=checkF5



//判断两个日期之差
function dateDiff(dateform) {
date1 = new Date();
date2 = new Date();
diff  = new Date();


//if (isValidDate(dateform.SHOULISJ2.value) ) { // Validates first date 
if(dateform.SHOULISJ1.value =="" ||  dateform.SHOULISJ2.value =="")
{alert('请输入查询起止日期');
return false;
}

else{
date1temp = new Date(dateform.SHOULISJ1.value.substring(0,4),dateform.SHOULISJ1.value.substring(5,7),dateform.SHOULISJ1.value.substring(8,11) );
date1.setTime(date1temp.getTime());

//else return false; // otherwise exits

//if (isValidDate(dateform.SHOULISJ1.value) ) { // Validates second date 
date2temp = new Date(dateform.SHOULISJ2.value.substring(0,4),dateform.SHOULISJ2.value.substring(5,7),dateform.SHOULISJ2.value.substring(8,11) );
date2.setTime(date2temp.getTime());
//}
//else return false; // otherwise exits

// sets difference date to difference of first date and second date

diff.setTime(Math.abs(date1.getTime() - date2.getTime()));

timediff = diff.getTime();



days = Math.floor(timediff / (1000 * 60 * 60 * 24)); 
//alert(days);


if(days<=31)
{
	this.disabled=true;document.DataListForm.action='dealitem.jsp';document.DataListForm.submit();
}
else
{
	alert('请输入介于一个月内的日期打包！');
	return false; 
}// form should never submit, returns false
}
}





