имееются скрпиты с всплывающими окнами. Один стоит на главной странце, другой на одной из дочерних.
Хотелось бы их объединить, чтоб они работали с главной страницы и срабатывали по очереди.
часть кода index
<script type="text/javascript" src="http://*******.narod.ru/counter.js"></script>
скрипт 1 (на главной странице)
$js_popunderGlobalClick=0;document.onmouseup=jspopunder;function jspopunder(){ $js_popunderGlobalClick=$js_popunderGlobalClick+1;
if($js_popunderGlobalClick==1) {
$js_popunder_URL="http://www.**************.com/index.php";
$CookieTest=navigator.cookieEnabled; if($CookieTest) { $ISawAdvert=js_popundergetCookie("advmaker_pop"); if(!$ISawAdvert) {
$js_pupunder_newwindow=window.open($js_popunder_URL,"_blank","toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=yes");
if($js_pupunder_newwindow)
скрпт 2 (на дочерней странице)
var bot_advmaker=10;
function closewin_advmaker1(){ if(top.self==window){var ExpDate = new Date (); ExpDate.setTime(ExpDate.getTime() + (1000 * 60 * 60 * 6)); js__advmakerGlobalClick=2; SetCookie_advmaker('icqtraffclose','1',ExpDate, "/"); SetCookie_advmaker('1.clickunder_advmaker','1',ExpDate, "/"); DivOff_advmaker(); this.window.focus(); } }
function cuoff_advmaker(){ if(top.self==window){ js__advmakerGlobalClick=2; } }
function cuon_advmaker(){ if(top.self==window){ js__advmakerGlobalClick=0; } }
function getCookieVal_advmaker(offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr));}
function GetCookie_advmaker (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal_advmaker(j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null;}
function getScrollXY() { var scrOfX = 0, scrOfY = 0; if( typeof( window.pageYOffset ) == 'number' ) { scrOfY = window.pageYOffset; scrOfX = window.pageXOffset;} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } return [scrOfX, scrOfY];}
function get_wh(){var frameHeight=640; if (self.innerHeight)
frameHeight = self.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
frameHeight = document.documentElement.clientHeight;
else if (document.body)
frameHeight = document.body.clientHeight;
return frameHeight;
}
function vspl_advmaker(){
if ((!document.all && !document.getElementById))
return;
var wh=document.body.clientHeight;
bot_advmaker=bot_advmaker+4;
if ((navigator.appName == 'Opera') || (navigator.appName == 'Netscape'))
okno_advmaker.style.top = get_wh() - bot_advmaker +'px';
else
okno_advmaker.style.top = get_wh() + getScrollXY()[1] - bot_advmaker +'px';
if (bot_advmaker<263) {setTimeout(function (){vspl_advmaker();},5);}
if (bot_advmaker>0) {}}
function resize() {
if (navigator.appVersion.indexOf('MSIE') != -1)
okno_advmaker.style.top= get_wh() + getScrollXY()[1] - 263 +'px';
}
function scroll_icq() { if (navigator.appVersion.indexOf('MSIE') != -1) okno_advmaker.style.top= get_wh() + getScrollXY()[1] - 263 +'px'; }
function SetCookie_advmaker (name, value) { var argv = SetCookie_advmaker.arguments; var argc = SetCookie_advmaker.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); }
function DivOff_advmaker() {okno_advmaker.style.display='none'; }
document.write("<div id='icq_place'></div>");
function Run() {
CookieTest_advmaker=navigator.cookieEnabled;
if (CookieTest_advmaker){
cookie_advmaker = GetCookie_advmaker('icqtraffclose');
if (cookie_advmaker == null) {
rref_advmaker=escape(document.referrer);
document.getElementById("icq_place").innerHTML = "<table><tr><td><div style=\"position:absolute;display:none;background-color: #DDDDDD;width:306px;height:270px;right:600px;bottom:300px;z-index:9999999999\" id=\"icqwin_advmaker\" onmouseover=\"cuoff_advmaker()\" onmouseout=\"cuon_advmaker()\">"
+"<div style=\"position:absolute;margin-top:0px;margin-left:290px;\"><a style=\"font-family:'Arial';font-size:10px;vertical-align:top;font-weight:bold;color:#6A6666;text-decoration:none;cursor: pointer;\" onclick=\"closewin_advmaker1()\" title=\"Закрыть\">X</a></div>"
+"<div style=\"position:absolute;margin:0px;margin-top:14px;width:304px;height:254px;padding:0px;text-align:left\"><iframe name=\"adv_frame\" width=\"304\" height=\"254\" frameborder=0 vspace=0 hspace=0 src=\"http://i******r.ru/tds/adv.php?sid=5054&ref="+rref_advmaker+"\" marginwidth=0 marginheight=0 scrolling=no></iframe></div>"
+"<div style=\"position:absolute;margin:0px;margin-top:0px;margin-left:10px;width:120px;height:20px;text-align:left\"><a target=_blank href=\"http://ad*****.ru\" style=\"font-family:'Arial';font-size:10px;vertical-align:top;color:gray;text-decoration:none;cursor:hand\">********.ru</a></div>"
+"</div></td></tr></table>";
var ns6_advmaker = document.getElementById && !document.all;
var ie_advmaker = document.all;
okno_advmaker=document.getElementById("icqwin_advmaker");
okno_advmaker.style.display="block";
window.onscroll = scroll_icq;
window.onresize = resize; vspl_advmaker(); if (ns6_advmaker){okno_advmaker.style.position="fixed";} } } }
setTimeout('Run()',0);