Вызываетсо оно как я понял этой строкой:
document.body.onload = window.setTimeout("fireMyPopup()", 1500);
Но оно появляется постоянно при перезагрузке окна, а надо, чтобы всего один раз.
Сам скрипт:
CODE:
<script type='text/javascript'>
// Browser safe opacity handling function
function setOpacity( value ) {
document.getElementById("styled_popup").style.opacity = value / 10;
document.getElementById("styled_popup").style.filter = 'alpha(opacity=' + value * 10 + ')';
}
function fadeInMyPopup() {
for( var i = 0 ; i <= 100 ; i++ )
setTimeout( 'setOpacity(' + (i / 10) + ')' , 8 * i );
}
function myPopupRelocate() {
var scrolledX, scrolledY;
if( self.pageYOffset ) {
scrolledX = self.pageXOffset;
scrolledY = self.pageYOffset;
} else if( document.documentElement && document.documentElement.scrollTop ) {
scrolledX = document.documentElement.scrollLeft;
scrolledY = document.documentElement.scrollTop;
} else if( document.body ) {
scrolledX = document.body.scrollLeft;
scrolledY = document.body.scrollTop;
}
var centerX, centerY;
if( self.innerHeight ) {
centerX = self.innerWidth;
centerY = self.innerHeight;
} else if( document.documentElement && document.documentElement.clientHeight ) {
centerX = document.documentElement.clientWidth;
centerY = document.documentElement.clientHeight;
} else if( document.body ) {
centerX = document.body.clientWidth;
centerY = document.body.clientHeight;
}
var leftOffset = scrolledX + (centerX - 250) / 2;
var topOffset = scrolledY + (centerY - 200) / 2;
document.getElementById("styled_popup").style.top = topOffset + "px";
document.getElementById("styled_popup").style.left = leftOffset + "px";
}
function fadeOutMyPopup() {
for( var i = 0 ; i <= 100 ; i++ ) {
setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 8 * i );
}
setTimeout('closeMyPopup()', 800 );
}
function closeMyPopup() {
document.getElementById("styled_popup").style.display = "none"
}
function fireMyPopup() {
setOpacity( 0 );
myPopupRelocate();
document.getElementById("styled_popup").style.display = "block";
document.body.onscroll = myPopupRelocate;
window.onscroll = myPopupRelocate;
document.getElementById("styled_popup").style.display = "block";
fadeInMyPopup();
}
document.body.onload = window.setTimeout("fireMyPopup()", 1500);
</script>
<script type='text/javascript'>
// Browser safe opacity handling function
function setOpacity( value ) {
document.getElementById("styled_popup").style.opacity = value / 10;
document.getElementById("styled_popup").style.filter = 'alpha(opacity=' + value * 10 + ')';
}
function fadeInMyPopup() {
for( var i = 0 ; i <= 100 ; i++ )
setTimeout( 'setOpacity(' + (i / 10) + ')' , 8 * i );
}
function myPopupRelocate() {
var scrolledX, scrolledY;
if( self.pageYOffset ) {
scrolledX = self.pageXOffset;
scrolledY = self.pageYOffset;
} else if( document.documentElement && document.documentElement.scrollTop ) {
scrolledX = document.documentElement.scrollLeft;
scrolledY = document.documentElement.scrollTop;
} else if( document.body ) {
scrolledX = document.body.scrollLeft;
scrolledY = document.body.scrollTop;
}
var centerX, centerY;
if( self.innerHeight ) {
centerX = self.innerWidth;
centerY = self.innerHeight;
} else if( document.documentElement && document.documentElement.clientHeight ) {
centerX = document.documentElement.clientWidth;
centerY = document.documentElement.clientHeight;
} else if( document.body ) {
centerX = document.body.clientWidth;
centerY = document.body.clientHeight;
}
var leftOffset = scrolledX + (centerX - 250) / 2;
var topOffset = scrolledY + (centerY - 200) / 2;
document.getElementById("styled_popup").style.top = topOffset + "px";
document.getElementById("styled_popup").style.left = leftOffset + "px";
}
function fadeOutMyPopup() {
for( var i = 0 ; i <= 100 ; i++ ) {
setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 8 * i );
}
setTimeout('closeMyPopup()', 800 );
}
function closeMyPopup() {
document.getElementById("styled_popup").style.display = "none"
}
function fireMyPopup() {
setOpacity( 0 );
myPopupRelocate();
document.getElementById("styled_popup").style.display = "block";
document.body.onscroll = myPopupRelocate;
window.onscroll = myPopupRelocate;
document.getElementById("styled_popup").style.display = "block";
fadeInMyPopup();
}
document.body.onload = window.setTimeout("fireMyPopup()", 1500);
</script>
И условие для гостей в движке:
CODE:
if (iGUEST) {
echo".............(кусок верски)
<a href='javascript:fadeOutMyPopup();'>
.(кусок верски)
";
}
if (iGUEST) {
echo".............(кусок верски)
<a href='javascript:fadeOutMyPopup();'>
.(кусок верски)
";
}