var flag = false;
var startX;
var startY;
function creatreView(callback,option){
	var timer = "";
	if(plus.nativeObj.View.getViewById('test')==null){
		view = new plus.nativeObj.View('test', {
			bottom: 0.1 * nowwidth + "px",
			left: 3.21 * nowwidth + "px",
			height: 0.44 * nowwidth + "px",
			width: 0.44 * nowwidth + "px"
		}, [{
				tag: "rect",
				id: "rect",

				position: {
					top: "0px",
					left: "0px"
				},
				rectStyles: {
					color: "#48C6FF",
					radius: "100%",
					borderColor: "#ffffff"
				}
			},
			{
				tag: 'font',
				id: 'icon',
				text: '\ue6c7', //此为字体图标Unicode码'\e600'转换为'\ue600'
				position: {
					top: '0px',
					left: '0px'
				},
				textStyles: {
					fontSrc: '_www/fonts/iconfont.ttf',
					align: 'center',
					color: '#fff',
					size: 0.2 * nowwidth + "px"
				}
			}

		]);
		plus.webview.currentWebview().append(view);
	}else{
		view=plus.nativeObj.View.getViewById('test');
	}
		view.show();
		
		view.addEventListener("touchstart", function(e) {
			startX = e.pageX;
			startY = e.pageY;
		})
		view.addEventListener("touchmove", function(e) {
//				alert(e.pageX);
//				alert(e.pageY)
				if(e.pageX==startX&&e.pageY == startY){
					return;
				}
				flag = true;
				clearTimeout(timer);
				
				var setX = e.pageX;
				var setY = e.pageY;
				if(e.pageX<=0){
					setX = 0;
				}
				if(e.pageY<=0){
					setY = 0;
				}
				
				if(e.pageX>bodyWidth - option.sideX){
					setX = bodyWidth - option.sideX
				}
				if(e.pageY>bodyHeight - option.sideY){
					setY = bodyHeight - option.sideY
				}
				
				view.setStyle({
					left: setX-0.22*nowwidth + "px",
					top: setY-0.22*nowwidth + "px"
					
				})
			})
		view.addEventListener("touchend", function(e) {
			timer = setTimeout(function() {
				if(flag) {
					flag = false;
				} else {
					callback();
					setTimeout(function() {
						plus.nativeUI.closeWaiting();
					}, 2000);
				}
			}, 200)
		})
}
