﻿// JScript 文件

function KeyVaildata()
{
    if(document.frmSearch.txtKey.value == "")
    {
        alert("请输入查询条件！");
        return false;
    }
    return true;
}

function KeyVaildata1()
{
    if(document.frmlogin.txtUsername.value == "")
    {
        alert("请输入用户名！");
        return false;
    }
    if(document.frmlogin.txtPassword.value == "")
    {
        alert("请输入密码！");
        return false;
    }
    return true;
}

var ie6 = navigator.appVersion.match(/MSIE (5.5|6)/) && document.uniqueID;

function email(text, dom) {
	dom = dom || 'com';
	document.write(text + "@suponix." + dom);
}

function mailto(text) {
	window.location.href = "mailto:" + text + "@suponix.com";
}

var display = function (image, width, height) {
	var left       = screen.width / 2 - width / 2;
	var top        = screen.height / 2 - height / 2;
	window.open('/display.php?' + image, '_blank', 'status=no,dependent=yes,modal=yes,height=' + height + ',width=' + width + ',left=' + left + ',top=' + top);
	return false;
};

var showPreview = function (link, id, img) {
	var div = document.getElementById(id);
	if (!div) {
		div = document.createElement('DIV');
		div.style.position = 'absolute';
		div.style.width = '200px';
		div.id = id;
		div.style.height = '157px';
		div.style.background = '#FFFFFF url(/images/loading.gif) no-repeat center';
		div.style.border = '1px solid #999';
		div.style.display = 'none';
		div.innerHTML = '<img src="' + img + '" width="200" height="157" alt="" />';
		if (ie6) {
			link.parentNode.appendChild(div);
		} else {
			document.body.appendChild(div);
		}
	}
	link.onmousemove = function (e) {
		e = e || event;
		link = this;
		var byTop, div = document.getElementById(id);
		if (div) {
			var byTop = 0;
			if (document.body.scrollTop) {
				byTop = document.body.scrollTop;
			} else if (window.pageYOffset != undefined) {
				byTop = window.pageYOffset;
			}

			var inner = window.innerHeight ? window.innerHeight : document.body.clientHeight;
			byTop = e.clientY < inner - 157 ? e.clientY + byTop + 20 : e.clientY + byTop - 157 - 5;

			div.style.display = 'block';
			div.style.top = byTop + 'px';
			div.style.left = e.clientX + 'px';
		}
	};
};

var clearPreview = function (link, id) {
	var div = document.getElementById(id);
	if (div) {
		div.parentNode.removeChild(div);
	}
};

