﻿// JavaScript Document

function divShow(tip,url,state){
//基础定义

var bgWidth,bgHeight;
var msgWidth=304;
var msgHeight=60;
//var titleHeight=20;
var titleHeight=0;
bgWidth=document.body.offsetWidth;
bgHeight=document.body.scrollHeight;
var titleBgColor="#99CCFF";

var bgDiv=document.createElement("div");
bgDiv.setAttribute("id","bgDiv");
bgDiv.style.position="absolute";
bgDiv.style.top="0";
bgDiv.style.left="0";
bgDiv.style.background="#777";
//bgDiv.style.backgroundImage="url(http://www.8312345.com/images/bgts.jpg)";
bgDiv.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
bgDiv.style.opacity="0.6";
bgDiv.style.width=bgWidth+"px";
bgDiv.style.height=bgHeight+"px";
bgDiv.style.zIndex="100";
document.body.appendChild(bgDiv);

var msgDiv=document.createElement("div");
msgDiv.setAttribute("id","msgDiv");
msgDiv.setAttribute("align","center");
msgDiv.style.background="white";
msgDiv.style.position="absolute";
msgDiv.style.left="35%";
msgDiv.style.top= document.documentElement.scrollTop+100+"px";
msgDiv.style.width=msgWidth+"px";
msgDiv.style.height=msgHeight+"px";
msgDiv.style.textAlign="center";
msgDiv.style.backgroundImage="url(http://www.8312345.com/images/bgts.jpg)";
msgDiv.style.zIndex="101";

var title=document.createElement("div");
title.setAttribute("id","title");
title.setAttribute("align","right");
title.style.background=titleBgColor;
title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
title.style.opacity="0.75";
title.style.height=titleHeight;
title.innerHTML="<span id='closeButton' onclick='clse()' style='cursor:pointer'>关闭</span>";

document.body.appendChild(msgDiv);
document.getElementById("msgDiv").appendChild(title);
var txt=document.createElement("p");
txt.style.margin="1em 0"
txt.setAttribute("id","msgTxt");
if(state==true){
txt.innerHTML="<a href='"+url+"'>如果没有跳转请点击这里</a><br/>"+tip;
}else{
txt.innerHTML=tip;
}
document.getElementById("msgDiv").appendChild(txt);
var closeAll= document.getElementById("closeButton");

if(state==true)
setTimeout("window.location.href='"+url+"'",3000)
}

  
  
  
  
  
  
  
  
  /*
  tip  传如要显示的内容
  url  要跳转的地址
  state 是否要跳转
  h 高度
  w 宽度
  */  
  
  
  
function divShow2(tip,url,state,h,w){
//基础定义

var bgWidth,bgHeight;
var msgWidth=w;
var msgHeight=h;
var titleHeight=15;
bgWidth=document.body.offsetWidth;
bgHeight=document.body.scrollHeight;
var titleBgColor="#fff";

var bgDiv=document.createElement("div");
bgDiv.setAttribute("id","bgDiv");
bgDiv.style.position="absolute";
bgDiv.style.top="0";
bgDiv.style.left="0";
document.body.appendChild(bgDiv);

var msgDiv=document.createElement("div");
msgDiv.setAttribute("id","msgDiv");
msgDiv.setAttribute("align","center");
msgDiv.style.background="#333";
msgDiv.style.position="absolute";
msgDiv.style.left="0px";


msgDiv.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=90";
//msgDiv.style.top= document.documentElement.scrollTop+100+"px";
msgDiv.style.width=msgWidth+"px";
msgDiv.style.height=msgHeight+"px";
msgDiv.style.textAlign="center";
msgDiv.style.zIndex="101";

var title=document.createElement("div");
title.setAttribute("id","title");
title.setAttribute("align","right");
title.style.background=titleBgColor;
title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
title.style.opacity="0.75";
title.style.height=titleHeight;
title.innerHTML="<span id='closeButton' onclick='clse2()' style='cursor:pointer'>关闭</span>";
document.body.appendChild(msgDiv);
document.getElementById("msgDiv").appendChild(title);
var txt=document.createElement("p");

//txt.style.margin="1em 0"
txt.setAttribute("id","msgTxt");
if(state==true){
txt.innerHTML="<a href='"+url+"'>如果没有跳转请点击这里</a><br/>"+tip;
}else{
txt.innerHTML=tip;
}
document.getElementById("msgDiv").appendChild(txt);
var closeAll= document.getElementById("closeButton");

if(state==true)
setTimeout("window.location.href='"+url+"'",3000)
movemsdiv();

}

  
  function movemsdiv()
  { 
   var tt=1000; 
  if (window.innerHeight) 
		  {
		    aa = window.pageYOffset;
		  }else if (document.documentElement && document.documentElement.scrollTop) {
			aa = document.documentElement.scrollTop  
		  }else if (document.body) {
		    aa = document.body.scrollTop; 
		  }		   
  document.getElementById("msgDiv").style.top= aa+"px";
  setTimeout(movemsdiv,tt);
  }
  
  
  
  
  
  
function clse(){
document.body.removeChild(bgDiv);
document.getElementById("msgDiv").removeChild(title);
document.body.removeChild(msgDiv);
  }
  
 function clse2(){

document.getElementById("msgDiv").style.display="none";
  }
