﻿var alpha=0;
var xx;
var alphaTime;
var alphaStart;

//遮罩层
var docEle = function() 
{
    return document.getElementById(arguments[0]) || false;
}

//控制遮罩
function aa(){
    _scrollWidth = Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
    _scrollHeight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
    document.getElementById("mask").style.width = _scrollWidth + "px";
    document.getElementById("mask").style.height = _scrollHeight + "px";
}

function $(id){
    return document.getElementById ? document.getElementById(id) : null;
}


//对像素进行求整
function px(id)
{
   return id.toString().replace("px","")
}


//function BOX()
//{
//     if(px($('DivAffiche1').style.top) >px(document.body.clientHeight)-207)
//     {
//        $('DivAffiche1').style.top=(px(document.documentElement.clientHeight)-207)+"px";
//     }
//     $('DivAffiche1').style.top =px(document.documentElement.clientHeight)-207+parseInt(px(document.documentElement.scrollTop),10)+"px" 
//    if(alpha!=100)
//    {
//        alpha=alpha+5;
//        $("DivAffiche1").style.filter = "alpha(opacity="+alpha+")";
//        $("DivAffiche1").style.opacity = alpha*0.01;
//        $("DivAffiche").className="";
//    }else
//    {
//        
//    }
//}

function BOX()
{
    if(alpha!=100)
    {
        alpha=alpha+5;
        $("show_div").style.filter = "alpha(opacity="+alpha+")";
        $("show_div").style.opacity = alpha*0.01;

        //$("show_div").className="";
    }else
    {
        
    }
}


//显示层
function openNewDiv(DialogBox) 
{
    var newMask = document.getElementById("mask");
    newMask.style.position = "absolute";
    newMask.style.zIndex = "10";
    _scrollWidth = Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
    _scrollHeight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
    newMask.style.width = _scrollWidth + "px";
    newMask.style.height = _scrollHeight + "px";
    newMask.style.top = "0px";
    newMask.style.left = "0px";
    newMask.style.background = "#000000";
    newMask.style.filter = "alpha(opacity=50)";
    newMask.style.opacity = "0.50";
    newMask.style.visibility="visible";
    //新弹出层
	var newDiv=document.getElementById(DialogBox);
    newDiv.className="";
    document.getElementById('iframe1').style.visibility="visible";
    $("iframe1").style.width =_scrollWidth + "px";
    $("iframe1").style.height =_scrollHeight + "px";
    document.documentElement.scrollTop="0px"
    xx=setInterval("aa()",500)
}

//对话窗口
function alertbox(message)
{
    var newMask = document.getElementById("mask");
    newMask.style.position = "absolute";
    newMask.style.zIndex = "2";
    _scrollWidth = Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
    _scrollHeight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
    newMask.style.width = _scrollWidth + "px";
    newMask.style.height = _scrollHeight + "px";
    newMask.style.top = "0px";
    newMask.style.left = "0px";
    newMask.style.background = "#000000";
    newMask.style.filter = "alpha(opacity=50)";
    newMask.style.opacity = "0.50";
    newMask.style.visibility="visible";;
    document.getElementById("mask_5").className="";
    document.getElementById("message1").innerHTML=message;
    document.getElementById('iframe1').style.visibility="visible";
    $("iframe1").style.width =_scrollWidth + "px";
    $("iframe1").style.height =_scrollHeight + "px";
    
}



//显示公告
function Affiche()
{
    clearInterval(alphaStart)
    alphaTime=setInterval("BOX()",50)

}


//开始
function Start(){
   //alphaStart=setInterval("Affiche()",100) 
   setTimeout("document.getElementById('show_div').style.display='block';",1000)
}


//关闭公告
function CloseNewAffiche(DialogBox)
{
    document.getElementById('mask').className='none';
    document.getElementById(DialogBox).className='none';
    clearInterval(alphaTime);
}

//关闭遮罩层和对话框
function CloseNewDivs(DialogBox)
{    
    clearInterval(xx);
    document.getElementById('mask').style.visibility='hidden';
    document.getElementById(DialogBox).className='none';
    document.getElementById('iframe1').style.visibility='hidden';
}



var login1;
//var login_i=0;
//var login_j=0;
function login()
{
    var login_z='...'
    _scrollWidth =document.body.scrollWidth
    _scrollHeight =document.body.scrollHeight
     document.getElementById("mask_7").style.width = _scrollWidth + "px";
     document.getElementById("mask_7").style.height = _scrollHeight + "px"; 
     document.getElementById("login").style.height=document.body.clientHeight/2+"px"
    if(document.readyState=='complete')
    {
    
        document.getElementById("mask_7").className="none";
        clearInterval(login1);
    }
    try{
        if(document.readyState.toString()=="undefined")
         {
         }
    }
    catch(e)
    {
        document.getElementById("mask_7").className="none";
        clearInterval(login1);
    }
   document.getElementById("iframe2").style.width =_scrollWidth
   document.getElementById("iframe2").style.height =_scrollHeight
    login1=setTimeout('login()',100)
}

//积分达人
function openwin() { 
    window.open ("Value-Top50.aspx", "newwindow", "height=500, width=400, toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") //写成一行 
} 

    
var message_down=0;
var scroll=0;
var info= "·帅哥/美女，终于等到您出现了，您一定是位古道热肠的人，千里跋涉，不辞辛苦地来找我们。\n·感谢您给我们提出建议。\n·我们会根据您的建议来优化我们的产品和服务。";
function mefocus(){
	if (message_down == 0) {
		$("TextBoxMessage").innerHTML = "";
		$("TextBoxMessage").style.color="#000"
	}
}
function meblur(){
	if (message_down == 0) {
		$("TextBoxMessage").value =info;
		$("TextBoxMessage").style.color="DimGray"
	}
}

function mtext()
{
    if($("TextBoxMessage").value.length>=1 && $("TextBoxMessage").value.length<=300)
    {
        $("ImageButtonMessage1").style.display="none";
        $("ImageButtonMessage").style.display="";

    }else
    {
        $("ImageButtonMessage1").style.display="";
        $("ImageButtonMessage").style.display="none";
    }
     $("TextBoxMessage").value=$("TextBoxMessage").value.replace(/(`)/g,'\'')
}
function mchange()
{
    if($("TextBoxMessage").value!=info && $("TextBoxMessage").value!="")
    {
        message_down+=1;
        mtext()
	}
}
function mup()
{
	message_down+=1;
    mtext()
}

//领奖地址
function addressmove()
{  
    document.getElementById("address").className="";
}
//领奖地址
function addressout()
{
    document.getElementById("address").className="none";
}


var flashTime;

function SetFlashXun()
{
    flashTime=setInterval("OpenFlashXun()",50)
}

//圣诞FLASH
function OpenFlashXun()
{
    $('FlashXue').style.top=px(document.documentElement.clientHeight)-230+parseInt(px(document.documentElement.scrollTop),10)+"px" 
}

//关闭圣诞FLASH
function ClosFlashXun()
{
    clearInterval(flashTime);
    $('FlashXue').className='none';
}


 function addCookie(objName,objValue,objHours){//添加cookie
	 var str = objName + "=" + escape(objValue);
	 if(objHours > 0){//为0时不设定过期时间，浏览器关闭时cookie自动消失
		 var date = new Date();
		 var ms = objHours*3600*1000;
		 date.setTime(date.getTime() + ms);
		 str += "; expires=" + date.toGMTString();
 	}
 	document.cookie = str;
 }
 
 function getCookie(objName){//获取指定名称的cookie的值
	 var arrStr = document.cookie.split("; ");
	 for(var i = 0;i < arrStr.length;i ++){
		 var temp = arrStr[i].split("=");
		 if(temp[0] == objName) return unescape(temp[1]);
	 }
 }
 
function delCookie(name){//为了删除指定名称的cookie，可以将其过期时间设定为一个过去的时间
    var date = new Date();
    date.setTime(date.getTime() - 10000);
    document.cookie = name + "=a; expires=" + date.toGMTString();
    }
    //读取出来所有的cookie字筗串了
    function allCookie(){//读取所有保存的cookie字符串
    var str = document.cookie;
    if(str == ""){
    str = "没有保存任何cookie";
    }
 //   alert(str);
}
 