var content_div, screen_div, move_body, pages, arrows, menu_items; var doc_height, doc_width, coords, current_position; var lastOpenUrl; var g_submenuUrl, g_id, g_subSub, g_move, mov; var URL = "http://gen/tels/"; var frame; oyy_context_id = '2889'; // //var console; current_position = 4; var ie = !window.getComputedStyle; var ie6 = ie && navigator.appVersion.indexOf("MSIE 7") == -1; var doc_min_height = 581; var doc_min_width = 940; function init_menu_hover(){ menu_items.each( function(item){ if(item.className.indexOf('ff-bugfix') == -1){ var lnk = $T('A', item)[0]; item.link = lnk; item.plashka = $C('plashka', item)[0]; if(ie6){ var right_corner; var corners = $C("corner", item.plashka, "DIV"); corners.each(function(c){ if(c.parentNode.className.indexOf('p-bottom') != -1){ right_corner = c; throw $break; } }); item.plashka.right_corner = right_corner; } item.onmouseover = function(){ if(this.className.indexOf('here') != -1) return; this.plashka.style.width = this.offsetWidth + "px"; this.plashka.style.display = "block"; if(this.plashka.right_corner && !this.plashka.right_corner.READY){ this.plashka.right_corner.style.left = this.plashka.offsetWidth - this.plashka.right_corner.offsetWidth + "px"; this.plashka.right_corner.READY = 1; } this.link.style.color = "#000"; if(!window.getComputedStyle){ this.style.filter = "none"; } } item.onmouseout = function(){ if(this.className.indexOf('here') != -1) return; this.plashka.style.display = "none"; this.link.style.color = "#6b6b6b"; if(this.filter){ this.style.filter = this.filter; } } } } ); } function init_nav_hover(){ arrows.each( function(item){ if(!$C('appear', item)){ throw $continue; } item.appear = $C('appear', item)[0]; item.appear.onclick = item.onclick; item.img = $T('IMG', item)[0]; item.onmouseover = function(){ if(this.className.indexOf('active') != -1){ return; } this.appear.style.display = "block"; this.style.zIndex = 3; } item.onmouseout = function(){ if(this.className.indexOf('active') != -1){ return; } this.appear.style.display = "none"; this.style.zIndex = 4; } } ); } function _make_args(ajaxDiv){ if(!ajaxDiv) return; var str = ajaxDiv.onclick.toString(); var _args; if(window.getComputedStyle){ _args = str.match(/".*"/); _args = _args.toString(); while(_args.indexOf("\"") != -1){ _args = _args.replace("\"", ""); } }else{ _args = str.match(/'.*'/); _args = _args.toString(); while(_args.indexOf("\'") != -1){ _args = _args.replace("\'", ""); } } _args = _args.split(','); mov.onstop.args = [_args[0], _args[1], false]; } function init_arrow_click(){ arrows.each( function(item, index){ item.index = index; item.page = pages[index]; if($C('text-text', item.page)){ item.page.content = $C('text-text', item.page)[0]; } item.ajaxDiv = $C('ajaxdiv', item)[0]; item.onclick = function(){ if(this.className.indexOf('arrow') == -1){ return; } if(this.className.indexOf('active') != -1){ if(this.ajaxDiv){ this.ajaxDiv.onclick.call(this.ajaxDiv); } return; } refreshMenus.call(this); //mov.onstop.func = this.ajaxDiv.onclick; //alert(this.ajaxDiv.onclick.toString().indexOf('GetSubmenu')); _make_args(this.ajaxDiv); //alert(mov.onstop.args); restartMove(); ReloadBanner( ); usingHistory = false; } } ); } function restartMove(){ if(mov.isMoving){ mov.bool_correctPosition = false; mov.stop(true); mov.bool_correctPosition = true; } mov.moveTo(coords[current_position][0], coords[current_position][1]); } function init_movement(){ /**********************************/ //Cоздаем объект движения с обнуленными параметрами stepX, stepY, interval, time, distance, //т.к. будем использовать метод moveTo //{X: 0, Y: 0} - указывает начальные координаты элемента $('main-body') //$ = document.getElementById mov = new Movement2( move_body, 0, 0, 0, 0, 0, {X: -doc_width, Y: -doc_height} ); /*********************************/ /********************************/ //метод moveTo допускает погрешность в 1 пиксель, данная опция позволяет исправить погрешность mov.bool_correctPosition = true; // mov.onstop = { func: GetSubmenuContentAjax, oThis: null, args: [] } mov.onstart = { func: function(){ }, oThis: pages[4], args: [] } } function refreshMenus(){ if(this.className.indexOf('active') != -1){ return; } var arrow = arrows[current_position]; arrow.className = arrow.className.replace('active', ''); arrow.onmouseout.call(arrow); if(arrow.menu_item){ arrow.menu_item.className = arrow.menu_item.className.replace('here', ''); arrow.menu_item.onmouseout.call(arrow.menu_item); } if(this.menu_item){ if(this.menu_item.className.indexOf('here') == -1){ this.menu_item.className += " here"; } } if(this.className.indexOf('active') == -1){ this.className += " active"; this.style.zIndex = 2; } current_position = this.index; } function createMenuPad(){ var pad = document.createElement('DIV'); pad.className = "secondary-menu-pad"; return pad; } function createMenuClone(div){ var clone = div.cloneNode(true); clone.className += " secondary-menu-clone"; return clone; } function center_content(){ var bodyHeight = document.body.clientHeight; if(bodyHeight > content_height){ content_div.style.marginTop = Math.floor((bodyHeight - content_height) / 2) + "px"; }else{ content_div.style.marginTop = 0; } } function init_vars(){ //console = $('console'); content_div = $('content'); screen_div = $('screen'); move_body = $('move-body'); pages = $C('move-item', screen_div); pages.each(function(page){ page.text_content = $C('text-content', page, 'DIV')[0]; }) /*********** REMOVE !!!!!!! *************/ while(pages.length > 9){ pages.pop(); } frame = $('frame'); if(window.getComputedStyle){ frame.parentNode.removeChild(frame); frame = false; } /****************************************/ arrows = $C('arrow', $('navigation-div')); menu_items = $C('menu-item', $('main-menu')); } function set_dimensions(){ var docHeight = document.body.clientHeight; var docWidth = document.body.clientWidth; doc_height = docHeight > doc_min_height ? docHeight : doc_min_height; doc_width = docWidth > doc_min_width ? docWidth : doc_min_width; pages.each( function(page){ page.style.height = doc_height + "px"; page.style.width = doc_width + "px"; } ) screen_div.style.width = doc_width + "px"; screen_div.style.height = doc_height + "px"; move_body.style.width = doc_width * 3 + "px"; move_body.style.height = doc_height * 3 + "px"; coords = [ [0, 0], [-doc_width, 0], [-doc_width * 2, 0], [0, -doc_height], [-doc_width, -doc_height], [-doc_width * 2, -doc_height], [0, -doc_height * 2], [-doc_width, -doc_height * 2], [-doc_width * 2, -doc_height * 2] ]; pages.each( function(page, index){ page.style.left = -coords[index][0] + "px"; page.style.top = -coords[index][1] + "px"; } );//each } function set_position(){ move_body.style.left = coords[current_position][0] + "px"; move_body.style.top = coords[current_position][1] + "px"; } function linkMenus(){ var plus = 1; arrows.each( function(arrow, index){ if(index == 4){ plus = 0; throw $continue; } var menu_item = menu_items[index + plus]; arrow.menu_item = menu_item; menu_item.arrow = arrow; var arr_over = arrow.onmouseover; var arr_out = arrow.onmouseout; var menu_over = menu_item.onmouseover; var menu_out = menu_item.onmouseout; arrow.onmouseover = function(){ arr_over.call(this); menu_over.call(this.menu_item); } arrow.onmouseout = function(){ arr_out.call(this); menu_out.call(this.menu_item); } menu_item.onmouseover = function(){ arr_over.call(this.arrow); menu_over.call(this); } menu_item.onmouseout = function(){ arr_out.call(this.arrow); menu_out.call(this); } menu_item.onclick = arrow.onclick.bind(arrow); } ); } function show(){ pages.each( function(page){ page.style.visibility = "visible"; } ) } function init_scroll(){ pages.each(init_page_scroll) } function init_page_scroll(page){ if(!$C('scroll-holder', page)){ return; } page.SCR = new Scrollbar( $C("scroll-holder", page)[0], $C("scroll-holder2", page)[0], $C("scroll-content", page)[0], { scrollY: { bMinus: { src: Root+"i/scroll-up.gif", alt: "Вверх", width: 15, height: 8 }, bPlus: { src: Root+"i/scroll-down.gif", alt: "Вниз", width: 15, height: 8 }, barBgColor: "transparent", thumbColor: "#ffffff" } } ); } function init_sec_menu(){ pages.each(init_page_sec_menu) } function init_page_sec_menu(page){ if(!$C('secondary-menu', page)){ return; } if(page.className == "text-text"){ page = page.page; } page.secMenu = $C('secondary-menu', page)[0]; page.menuPad = createMenuPad(); page.menuClone = createMenuClone(page.secMenu); page.menuRoot = $C('text-text', page)[0]; page.menuRoot.page = page; page.menuPad.style.height = page.secMenu.offsetHeight + "px"; page.secMenu.parentNode.insertBefore(page.menuPad, page.secMenu); page.secMenu.style.display = "none"; page.menuRoot.appendChild(page.menuClone); page.secMenu.parentNode.removeChild(page.secMenu); } function GetHTTPObject( ) { var xmlHttp; if ( window.XMLHttpRequest ) { try { xmlHttp = new XMLHttpRequest(); } catch (e) { xmlHttp = false; } } else if ( window.ActiveXObject ) { try { xmlHttp = new ActiveXObject( 'Msxml2.XMLHTTP' ); } catch (e) { try { xmlHttp = new ActiveXObject( 'Microsoft.XMLHTTP' ); } catch(e) { xmlHttp = false; } } } return xmlHttp; } function GetSubmenuContentAjax( submenuUrl, id, subSub ) { var xmlObj = GetHTTPObject( ); var cat_div = arrows[current_position].page.content//document.getElementById( 'itemcontent_' + id ); var news_div = document.getElementById( 'news-div' ); var ajaxSrceen = document.getElementById( 'ajaxScreen' ); if ( cat_div ) { news_div.style.visibility = 'hidden'; } else { news_div.style.visibility = 'visible'; } change_location(submenuUrl.replace(URL, ""), current_position); if ( cat_div ) { if ( submenuUrl != lastOpenUrl ) { if ( id != 5 ) { xmlObj.onreadystatechange = function( ) { if ( 4 == xmlObj.readyState ) { if ( 200 == xmlObj.status ) { //ajaxSrceen.style.visibility = "hidden"; //ajaxSrceen.style.display = "none"; lastOpenUrl = submenuUrl; cat_div.innerHTML = xmlObj.responseText; // alert(xmlObj.responseText); init_page_sec_menu(cat_div, true, true); init_page_scroll(cat_div); RebiuldInnerLinks( id ); SetHtmlTitle( id ); } } else if ( 3 == xmlObj.readyState || 1 == xmlObj.readyState ) { //alert(xmlObj.responseText); //ajaxSrceen.style.visibility = "visible"; //ajaxSrceen.style.display = "block"; } } /*if ( subSub == 'true' ) {*/ id = id.toString().replace(/(^[\s\xA0]+|[\s\xA0]+$)/g, ''); xmlObj.open( 'GET', submenuUrl+'?item_id='+parseInt(id), true ); /*} else { //alert(submenuUrl+'&rnd='+Math.random()); xmlObj.open( 'GET', submenuUrl+'&rnd='+Math.random(), true ); }*/ xmlObj.send( null ); } } } } function GetSubmenuContent( submenuUrl, id) { //,subSub usingHistory = false; mov.onstop.args = [submenuUrl, id]; //,subSub arrows[id-1].onmouseover.call(arrows[id-1]); refreshMenus.call(arrows[id-1]); restartMove(); } function RebiuldInnerLinks( itemId ) { var contentDiv = arrows[current_position].page; var lnks = $T('A', contentDiv.text_content); lnks.each( function(item){ var sec_menu_link = false; each_parent(item, function(parent, index){ if(parent.className && parent.className.indexOf('secondary-menu') != -1){ sec_menu_link = true; } }) if(sec_menu_link){ item.onclick = function() { GetSubmenuContent( this.href, itemId, 'false' ); return false; } }else{ if(item.href.indexOf("item_id") != -1){ item.onclick = function(){ var id = this.href.split("=")[1]; GetSubmenuContent( this.href, id, 'false' ); return false; } } } } ); } function SetHtmlTitle( itemId ) { var contentDiv = arrows[current_position].page;; var lnks = $T('H1', contentDiv); var navDiv = document.getElementById( 'main-menu' ); var navLinks = $T('A', navDiv); if ( current_position < 5 ) { newCurrentPosition = current_position + 1; } else { newCurrentPosition = current_position; } if ( !lnks[0] ) { document.title = 'Главная - TELS'; } else { if ( lnks[0].innerHTML ) { if ( lnks[0].innerHTML == navLinks[newCurrentPosition].innerHTML ) { document.title = navLinks[newCurrentPosition].innerHTML + ' - TELS'; } else { document.title = lnks[0].innerHTML + ' - ' + navLinks[newCurrentPosition].innerHTML + ' - TELS'; } } else { document.title = navLinks[newCurrentPosition].innerHTML + ' - TELS'; } } } /* Перезагрузка баннерного места под левым меню */ function ReloadBanner( ) { var bannerXmlObj = GetHTTPObject( ); var banner_div = document.getElementById( 'banner-div' ); var bannerAjaxSrceen = document.getElementById( 'bannerAjaxScreen' ); bannerXmlObj.onreadystatechange = function( ) { if ( 4 == bannerXmlObj.readyState ) { if ( 200 == bannerXmlObj.status ) { bannerAjaxSrceen.style.visibility = "hidden"; banner_div.innerHTML = '
' + bannerXmlObj.responseText; } } else if ( 3 == bannerXmlObj.readyState || 1 == bannerXmlObj.readyState ) { bannerAjaxSrceen.style.visibility = "visible"; } } bannerXmlObj.open( 'GET', Root + 'include/reload_banner.php4?rnd=' + Math.random(), true ); bannerXmlObj.send( null ); } function sw(url,w,h){ window.open(url, "w", "height="+h+",width="+w+",toolbar=0,scrollbars=0,resizable=0"); } function check(last){ var first=0; var error=false; for (i=0;i<=last;i++){ if(document.reg_form.elements[i].value==''){ if(!error)flag=i; error=true; } } if(error){ document.reg_form.elements[flag].focus(); alert('Пожалуйста, заполните все обязательные поля!'); return false; } if(document.reg_form.elements[4].value!=document.reg_form.elements[6].value&&last>6){ alert('Значения паролей не совпадают'); document.reg_form.elements[6].focus(); return false; } } function check1(last){ var first=0; var error=false; for (i=first;i<=last;i++){ if(document.form1.elements[i].value==''){ if(!error)flag=i; error=true; } } if(error){ document.form1.elements[flag].focus(); alert('Пожалуйста, заполните все обязательные поля!'); return false; } } function fcheck(obj){ mask=0; if(obj.author.value=='') {mask=1; obj.author.focus();} //if(obj.title.value==''&&mask!=1){mask=1; obj.title.focus();} if(obj.post.value==''&&mask!=1){mask=1; obj.post.focus();} if(mask==1){ alert('Пожалуйста, заполните все обязательные поля!'); return false; } } function wo(link,ww,hh,title) { w=window.open(link,'',(ww ? 'width='+ww+',' : '')+(hh ? 'height='+hh+',' : '')+'toolbar=0,scrollbars=1,resizable'); if ( link.indexOf('.html') == -1 ) { if (document.layers) title=''; w.document.open(); w.document.write('| '+text+' |