function useLoading(message, type) {
	try {
		var msg = message ? message : "Loading...";
		DWREngine.setPreHook(function() {
			var disZone = $('disabledZone');
			if (!disZone) {
				disZone = document.body.appendChild(document
						.createElement('div'));
				disZone.setAttribute('id', 'disabledZone');
				disZone.innerHTML += '<iframe src="#" style="position:relative;visibility:inherit;left:0px;top:0px;width:'
						+ Math.max(parseInt(document.body.clientWidth),
								parseInt(document.body.scrollWidth))
						+ 'px; height:'
						+ Math.max(parseInt(document.body.clientHeight),
								parseInt(document.body.scrollHeight))
						+ 'px;z-index:-1;filter:Alpha(opacity=20);"></iframe>';
				with (disZone.style) {
					position = "absolute";
					zIndex = "998";
					left = "0px";
					top = "0px";
					width = Math.max(parseInt(document.body.clientWidth),
								parseInt(document.body.scrollWidth)) + "px";
					height =Math.max(parseInt(document.body.clientHeight),
								parseInt(document.body.scrollHeight)) + "px";
					// show load msg color
					backgroundColor = "#777";
					filter = "Alpha(opacity=20)";
					opacity = "0.6";
				}

				var msgZone;
				if (type == 'img') {
					msgZone = document.createElement('img');
					msgZone.setAttribute('id', 'msgZone');
					msgZone.setAttribute('src', msg);
				} else {
					msgZone = document.createElement('div');
					msgZone.setAttribute('id', 'msgZone');
					msgZone.appendChild(document.createTextNode(msg));
				}
				disZone.appendChild(msgZone);
				with (msgZone.style) {
					position = "absolute";
					zIndex = "997";
					color = "#00BB00";
					top = ((parseInt(document.body.clientHeight) - msgZone.clientHeight) / 2)
							+ 'px';
					left = ((parseInt(document.body.clientWidth) - msgZone.clientWidth) / 2)
							+ 'px';
					filter = "Alpha(opacity=100)";
				};

			} else {
				if ($('msgZone')) {
				$('msgZone').style.top = ((parseInt(document.body.clientHeight) - $('msgZone').clientHeight) / 2)
						+ 'px';
				$('msgZone').style.left = ((parseInt(document.body.clientWidth) - $('msgZone').clientWidth) / 2)
						+ 'px';
			}
				if (type == 'img') {
					// $('msgZone').src = msg;
				} else {
					$('msgZone').innerHTML = msg;
				}
				disZone.style.visibility = 'visible';
			}
		});
		DWREngine.setPostHook(function() {
					$('disabledZone').style.visibility = 'hidden';
				});
	} catch (e) {
	}
}
//use js get paramete
var URLParams = new Object();
var aParams = document.location.search.substr(1).split('&');
for (i = 0; i < aParams.length; i++) {
	var aParam = aParams[i].split('=');
	URLParams[aParam[0]] = aParam[1];
}
URLParams['basePath'] = '/pop';
URLParams['popBasePath'] = URLParams['basePath']+'/simplification/popedom';
URLParams['popImagePath'] =URLParams['basePath']+'/simplification/js/imgs';
function initDWR() {
	try {
		DWREngine.setErrorHandler(function() {
					alert("\u53d1\u751f\u9519\u8bef\uff01");
				});
		DWREngine.setWarningHandler(function() {
					alert("\u8b66\u544a");
				});
		DWREngine.setTimeout(60000);
	} catch (e) {
		//timeout
		alert("\u6ca1\u6709\u6743\u9650\u6216\u767b\u9646\u8d85\u65f6\uff0c\u8bf7\u91cd\u65b0\u767b\u9646\uff01");
		top.window.location=URLParams['basePath']+"/";
	}
}

function initOnload() {
	initDWR();
	useLoading(URLParams['popImagePath']+'/blue-loading.gif', 'img');
}
window.onload=initOnload;
