﻿/*防止被人frame*/
if(top.location != self.location)top.location=self.location;

/*全屏显示*/
//self.moveTo(0,0)
//self.resizeTo(screen.availWidth,screen.availHeight)

/*双击鼠标滚动屏幕的代码*/
var currentpos,timer;
function initialize()
{
    timer=setInterval ("scrollwindow ()",30);
}
function sc()
{
    clearInterval(timer);
}
function scrollwindow()
{
    currentpos=document.body.scrollTop;
    window.scroll(0,++currentpos);
    if (currentpos !=document.body.scrollTop)
    sc();
}
document.onmousedown=sc
document.ondblclick=initialize

/*防注入*/
var url = location.search;
var re=/^\?(.*)(select%20|insert%20|delete%20from%20|count\(|drop%20table|update%20truncate%20|asc\(|mid\(|char\(|xp_cmdshell|exec%20master|net%20localgroup%20administrators|\"|:|net%20user|\'|%20or%20)(.*)$/gi;
var e = re.test(url);
if(e)
{
    alert("很抱歉，由于您提交的内容中含有危险的SQL注入代码，致使本次操作无效！");
    history.go(-1);
}

/*脚本永不出错*/
function killErrors()
{
   return true;
}
window.onerror = killErrors;


document.body.oncopy = function () { 
	setTimeout( function () { 
		var text = clipboardData.getData("text");
		if (text) { 
			text = text + "\r\n本文来自网络，详细请参考："+location.href; clipboardData.setData("text", text);
		} 
				}, 100 ) 
}

function formSubmit()
{
	if(!GetInfo('1'))
	{
	    return false;
	}
	if(!GetInfo('2'))
	{
	    return false;
	}
	if(!GetInfo('3'))
	{
	    return false;
	}
	if(!GetInfo('4'))
	{
	    return false;
	}
	if(!GetInfo('5'))
	{
	    return false;
	}
	return true;
}

function GetInfo(str)
{
    //document.getElementById('lblsave').innerHTML = '<img src="/images/Loading2.gif" />';        
    WebService.GetAll(document.getElementById('username').value+","+document.getElementById('userpwd').value+","+document.getElementById('checkcode').value+","+document.getElementById('select1').options[document.getElementById('select1').selectedIndex].value, OnRequestComplete);
    //alert(document.getElementById('username').value+","+document.getElementById('password').value+","+document.getElementById('checkcode').value+","+document.getElementById('select1').options[document.getElementById('select1').selectedIndex].value);
    return true;
}

function OnRequestComplete(result)
{
    if(result == 'true')
    {
        document.getElementById('lblall').innerHTML = '<img src="/images/check_error.gif" /><span style="font-size:12px;color:gray;"> 登陆出错！</span>';
        return false;
    }
    else
    {
        document.getElementById('lblall').innerHTML = '<img src="/images/check_right.gif" />';
        closeLayer();
        
        window.location.reload();
    }
}




//function initEcAd() {
//    document.all.AdLayer1.style.posTop = -10;
//    document.all.AdLayer1.style.visibility = 'visible'
//    MoveLeftLayer('AdLayer1');
//    
//    document.all.AdLayer2.style.posTop = -10;
//    document.all.AdLayer2.style.visibility = 'visible'
//    MoveRightLayer('AdLayer2');
//}
//function MoveLeftLayer(layerName) {
//    var x = 5;//左侧广告距离
//    var y = 10;// 左侧广告距离页首高度
//    var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;
//    var y = document.body.scrollTop + y - diff;
//    eval("document.all." + layerName + ".style.posTop = parseInt(y)");
//    eval("document.all." + layerName + ".style.posLeft = x");
//    setTimeout("MoveLeftLayer('AdLayer1');", 20);
//}
//function MoveRightLayer(layerName) {
//    var x = 5;//左侧广告距离
//    var y = 10;// 左侧广告距离页首高度
//    var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;
//    var y = document.body.scrollTop + y - diff;
//    eval("document.all." + layerName + ".style.posTop = parseInt(y)");
//    eval("document.all." + layerName + ".style.posRight = x");
//    setTimeout("MoveRightLayer('AdLayer2');", 20);
//}

//document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><img src='/Skin/Default/Images/ad_l.jpg' border='0' /></div>");
//document.write("<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><img src='/Skin/Default/Images/ad_r.jpg' border='0' /></div>");
//initEcAd();
