﻿// JScript 文件

/**********************脚本容错*******************/

function killErrors() {
return true;
}
window.onerror = killErrors;

/************************************************/

 function winopen(url,title,height,width)
{
 xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ))
{
xposition = (screen.width - width) / 2;
yposition = (screen.height - height) / 2;
}
theproperty= "width=" + width + "," 
+ "height=" + height + "," 
+ "location=0,"
+ "menubar=0,"
+ "resizable=0,"
+ "scrollbars=1,"
+ "status=1,"
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //for Netscape
+ "screeny=" + yposition + "," //for Netscape
+ "left=" + xposition + "," //for IE
+ "top=" + yposition; //for IE 



 var Withwolf=window.open( url,title,theproperty );
    if(Withwolf)
    {window.open( url,title,theproperty );
        
    }else{
       alert("Your browser intercept to window . please At the same time press< Ctrl > or site will be added to the confidence-building site");
    }

window.open( url,title,theproperty );
}

	
	
	
	
	
	
	
	
	  //<![CDATA[
	
	var previewBox = document.getElementById('PreviewBox');
	var previewImage = document.getElementById('PreviewImage');
	var previewUrl = document.getElementById('previewUrl');
	var previewFrom = null;
	var previewTimeoutId = null;
	var loadingImg = '../../images/loading.gif';
	var maxWidth = 400;
	var maxHeight = 400;
	
	/**
	 * 获取页面元素的坐标
	 */
	function getPosXY(a, offset) {
		var p=offset?offset.slice(0):[0,0],tn;
		while(a) {
			tn=a.tagName.toUpperCase();
			if (tn == 'IMG') {
				a = a.offsetParent;
				continue;
			}
			p[0]+=a.offsetLeft-(tn=="DIV"&&a.scrollLeft?a.scrollLeft:0);
			p[1]+=a.offsetTop-(tn=="DIV"&&a.scrollTop?a.scrollTop:0);
			if (tn=="BODY") break;
			a=a.offsetParent;
		}
		return p;
	}

	function checkComplete() {
		if (checkComplete.__img && checkComplete.__img.complete)
			checkComplete.__onload();
	}

	checkComplete.__onload = function() {
		clearInterval(checkComplete.__timeId);
		var w = checkComplete.__img.width;
		var h = checkComplete.__img.height;
		if (w >= h && w > maxWidth) {
			previewImage.style.width = maxWidth + 'px';
		} 
		else if (h >= w && h > maxHeight) {
			previewImage.style.height = maxHeight + 'px';
		}
		else {
			previewImage.style.width = previewImage.style.height = '';
		}
		previewImage.src = checkComplete.__img.src;
		previewUrl.href = checkComplete.href;
		checkComplete.__img = null;
		//previewImage.style.display = '';
	}

	/**
	 * 500毫秒后激发预览操作
	 */
	function showPreview(e) {
		hidePreview();
		previewFrom = e.target || e.srcElement;
		previewImage.src = loadingImg;
		previewImage.style.width = previewImage.style.height = '';
		previewTimeoutId = setTimeout('_showPreview()', 500);
		checkComplete.__img = null;
	}
	
	/**
	 * 取消预览
	 */
	function hidePreview(e) {
		if (e) {
			var toElement = e.relatedTarget || e.toElement;
			//alert(toElement.innerHTML);
			while (toElement) {
				if (toElement.id == 'PreviewBox')
					return;
				toElement = toElement.parentNode;
			}
		}
				try{
			clearInterval(checkComplete.__timeId);
			checkComplete.__img = null;
			previewImage.src = null;
		}
		catch (e){
		}
		clearTimeout(previewTimeoutId);
		previewBox.style.display = 'none';
	}

	/**
	 *  预览操作
	 */
	function _showPreview() {
		//previewImage.style.display = 'none';
		checkComplete.__img = new Image();
		if (previewFrom.tagName.toUpperCase() == 'A')
			previewFrom = previewFrom.getElementsByTagName('img')[0];
		//获取大图的URL
		var largeSrc = previewFrom.getAttribute("large-src");
		var picLink = previewFrom.getAttribute("pic-link");
		if (!largeSrc) return;
		else {
			checkComplete.__img.src = largeSrc;
			checkComplete.href = picLink;
			checkComplete.__timeId = setInterval("checkComplete()", 20);
			var pos = getPosXY(previewFrom, [0, -2]);
			previewBox.style.left = pos[0] + 'px';
			previewBox.style.top = pos[1] + 'px';
			previewBox.style.display = 'block';
		}
	}
	//]]>
	
	
	
	
/********************************GRIDVIEW  chekebox全部选中***************************************/
 
 function   allselect(name)
 {
        for(var i=0;i<document.forms[0].elements.length;i++)
        {
            var j=document.forms[0].elements[i];
            if(j.type=="checkbox")
            {
//                if(j.name.substring(0,2)=="gv")
//                {
                   j.checked=name.checked;
//                }
            }
        }
 }