String.prototype.trim = function() {  
  var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/);  
  return (m == null) ? "" : m[1];  
} 

String.prototype.isMobile = function() {  
  return (/^(?:13\d|15[0123456789])-?\d{5}(\d{3}|\*{3})$/.test(this.trim()));  
} 

function isNum(value){
	var numtype="0123456789";
	for(i=0;i<value.length;i++){
		if(numtype.indexOf(value.substring(i,i+1))<0)
			return false; 
	}
	return true;
} 

function frameFitSelfHeight(frameId,countNum){
	myFrameId=frameId;
	myCountNum=countNum;
	
	if(myCountNum==null || myCountNum==undefined || myCountNum<0){
		myCountNum=0;
	}
	
	myCountNum++;
	
	if(myCountNum<=20){
		document.getElementById(myFrameId).height = document.getElementById(myFrameId).contentWindow.document.body.scrollHeight;
		setTimeout('frameFitSelfHeight(myFrameId,myCountNum)',500);
	}
}


function frameFitSelfHeight2(frameId2,countNum2){
	myFrameId2=frameId2;
	myCountNum2=countNum2;
	
	if(myCountNum2==null || myCountNum2==undefined || myCountNum2<0){
		myCountNum2=0;
	}
	
	myCountNum2++;
	
	if(myCountNum2<=20){
		document.getElementById(myFrameId2).height = document.getElementById(myFrameId2).contentWindow.document.body.scrollHeight;
		setTimeout('frameFitSelfHeight2(myFrameId2,myCountNum2)',500);
	}
}

function frameFitSelfHeight3(frameId3,countNum3){
	myFrameId3=frameId3;
	myCountNum3=countNum3;
	
	if(myCountNum3==null || myCountNum3==undefined || myCountNum3<0){
		myCountNum3=0;
	}
	
	myCountNum3++;
	
	if(myCountNum3<=20){
		document.getElementById(myFrameId3).height = document.getElementById(myFrameId3).contentWindow.document.body.scrollHeight;
		setTimeout('frameFitSelfHeight3(myFrameId3,myCountNum3)',500);
	}
}

function frameFitSelfHeight4(frameId4,countNum4){
	myFrameId4=frameId4;
	myCountNum4=countNum4;
	
	if(myCountNum4==null || myCountNum4==undefined || myCountNum4<0){
		myCountNum4=0;
	}
	
	myCountNum4++;
	
	if(myCountNum4<=20){
		document.getElementById(myFrameId4).height = document.getElementById(myFrameId4).contentWindow.document.body.scrollHeight;
		setTimeout('frameFitSelfHeight4(myFrameId4,myCountNum4)',500);
	}
}

function trim(s) {
  var count = s.length;
  var st    = 0;       // start
  var end   = count-1; // end

  if (s == "") return s;
  while (st < count) {
    if (s.charAt(st) == " ")
      st ++;
    else
      break;
  }
  while (end > st) {
    if (s.charAt(end) == " ")
      end --;
    else
      break;
  }
  return s.substring(st,end + 1);
}

Date.prototype.addDay = function(day){
	return new Date(this.valueOf() + (day * 24*60*60*1000));
}

/**
 * 获取当前日期
 * @return {}
 */
function getNowDate(){

	var now = new Date();
	var year = now.getYear();
	var month = now.getMonth()+1;
	var day = now.getDate();
	
	var nowDate = year+"-"+month+"-"+day;
	
	return nowDate ;
}

