﻿/*************miss_season 2009-11-20*********************/

function DiaryTypeShow(isshow)  //01޸
{
var dtdiv = document.getElementById("adddtypediv");
if( dtdiv != null || dtdiv != "undefined" )
{
if( isshow )
{
var pageSize = getPageXY();
dtdiv.style.margin = "";
dtdiv.style.position = "absolute";
dtdiv.style.left = (parseInt(pageSize[2])-parseInt(300))-300 + "px";  
var scrollPos; 
if (typeof window.pageYOffset != 'undefined') { 
scrollPos = window.pageYOffset; 
} 
else if (typeof document.compatMode != 'undefined' && 
document.compatMode != 'BackCompat') { 
scrollPos = document.documentElement.scrollTop; 
} 
else if (typeof document.body != 'undefined') { 
scrollPos = document.body.scrollTop; 
} 
dtdiv.style.top = (parseInt(pageSize[3])-parseInt(250)-190)+ scrollPos + "px";
dtdiv.style.display = "";
}
else
{
dtdiv.style.display = "none";
}
}
}

/****************************************************
ȡ
*******************************************************/
function getPageXY() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {	
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
}else if (document.body.scrollHeight > document.body.offsetHeight){
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
}else {
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}

var windowWidth, windowHeight;
if (self.innerHeight) {
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
}else if (document.documentElement && document.documentElement.clientHeight) {
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
}else if (document.body) {
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}

if(yScroll < windowHeight){
pageHeight = windowHeight;
}else { 
pageHeight = yScroll;
}

if(xScroll < windowWidth){	
pageWidth = windowWidth;
}else {
pageWidth = xScroll;
}

var arrayPageXY = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
return arrayPageXY;
}

function addHTML(oParentNode, sHTML) {
if(window.addEventListener) {
var oRange = oParentNode.ownerDocument.createRange();
oRange.setStartBefore(oParentNode);
var oFrag = oRange.createContextualFragment(sHTML);
oParentNode.appendChild(oFrag);
}else {
oParentNode.insertAdjacentHTML("BeforeEnd", sHTML);
}
}

var popLayerObj={};
popLayerObj.show = function (sHTML,nWidth,nHeight) {
popLayerObj.create();
var pageSize = getPageXY();
document.getElementById("popLayer").innerHTML = sHTML;
if(!nWidth)	nWidth=document.getElementById("popLayer").firstChild.clientWidth;
if(!nHeight) nHeight=document.getElementById("popLayer").firstChild.clientHeight;

document.getElementById("bcPopLayer").style.width = pageSize[0]+'px';
document.getElementById("bcPopLayer").style.height = pageSize[1]+'px';
document.getElementById("popLayer").style.left	= (pageSize[0] - nWidth)/2+'px';
document.getElementById("popLayer").style.top	= document.documentElement.scrollTop-4 + (pageSize[3] - nHeight) / 2+'px';
document.getElementById("popLayer").style.width = nWidth;
document.getElementById("popLayer").style.height = nHeight;
}
popLayerObj.close = function () {
var bcEle=document.getElementById("bcPopLayer");
var ele=document.getElementById("popLayer");
bcEle.style.display='none';
ele.style.display='none';

ele.innerHTML='';
var ele=document.getElementsByTagName("select");
for(var i=0;i<ele.length;i++){
if(ele[i]!=null) ele[i].style.display='inline';
}
popLayerObj.closeEnd();
}

popLayerObj.ofush=function(){//дpopLayerObj.createBefore popLayerObj.closeEnd Ե
popLayerObj.createBefore=function(){};
popLayerObj.closeEnd=function(){};
}

popLayerObj.createBefore=function(){};//д


popLayerObj.closeEnd=function(){};//д



popLayerObj.create = function () {
popLayerObj.createBefore();	
var bcEle=document.getElementById("bcPopLayer");
var ele=document.getElementById("popLayer");	
if(bcEle==null){
var str = '\
<div style="position:absolute;background:#000; top: 0px; left: 0px; filter:alpha(opacity=40);-moz-opacity:0.2;opacity: 0.2;" id="bcPopLayer"></div>\
<div id="popLayer"  style="background:white;position:absolute;"></div>\
';
addHTML(document.body, str);
}else{
bcEle.style.display='';
ele.style.display='';
}
var ele=document.getElementsByTagName("select");
for(var i=0;i<ele.length;i++){
if(ele[i]!=null) ele[i].style.display='none';
}
}

popLayerObj.create1 = function () {
popLayerObj.createBefore();	
var bcEle=document.getElementById("bcPopLayer");
var ele=document.getElementById("popLayer");	
if(bcEle==null){
var str = '\
<div style="position:absolute;background:#6699FF; top: 0px; left: 0px; filter:alpha(opacity=20);-moz-opacity:0.2;opacity: 0.2;" id="bcPopLayer"></div>\
<div id="popLayer"  style="background:white;position:absolute;"></div>\
';
addHTML(document.body, str);
}else{
bcEle.style.display='';
ele.style.display='';
}
}

var arr = [];



arr.push("<link href=/shangwutong/images/css.css rel=stylesheet type=text/css /><div id='adddtypediv' style='z-index:1000;display:none; width:450px; height:250px;text-align:left;'><br /><br /><div class=swt_top>您好，欢迎访问新时代医院植发中心</div><div class=set_middle><font class=style1>新时代医院植发达人征集令</font><br /><font class=style2>爱生活，爱自信，我是植发达人<br />新时代植发邀你体验完美蜕变<br />活动期间预约立减<font class=style1>2000</font>元!<br/>全国统一预约热线：<font class=style1>020-85585530</font><br /><ul><li><a href='http://testserver.shifind.com/LR/Chatpre.aspx?id=LTX79308962&lng=cn&e=%e6%97%a7%e7%ab%99'><img src=/shangwutong/images/swt_04.gif width=87 height=24 /></a></li><li><a onclick=\"DiaryTypeShow(false);\" style=\"cursor:pointer;\"><img src=/shangwutong/images/swt02_06.gif width=86 height=24 /></a></li></ul></div></div>");
document.write(arr);
var sh;
function showswt(){ 
DiaryTypeShow(true);
clearInterval(sh); 
setInterval(showswt1,90000);//20ָһ
} 

function showswt1(){ 
DiaryTypeShow(true);
} 

sh=setInterval(showswt,10000); //ҳ4󵯳

function scall() 
{
var pageSize = getPageXY();
var dtdiv = document.getElementById("adddtypediv");

var scrollPos; 
if (typeof window.pageYOffset != 'undefined') { 
   scrollPos = window.pageYOffset; 
} 
else if (typeof document.compatMode != 'undefined' && 
     document.compatMode != 'BackCompat') { 
   scrollPos = document.documentElement.scrollTop; 
} 
else if (typeof document.body != 'undefined') { 
   scrollPos = document.body.scrollTop; 
} 

if( (dtdiv != null || dtdiv != "undefined") && dtdiv.style.display != "none")
{
dtdiv.style.top = (parseInt(pageSize[3])-parseInt(250)-190)+ scrollPos + "px";
}
}

window.onscroll=scall;
window.onresize=scall;
window.onload=scall;
