function ajax(data){ function d(p,v){if(!data[p])data[p]=v;} d('type','POST'); d('error',function(){ajax(data);}); $.ajax(data); } var protocols=["http:","ftp:","gopher:","mailto:"]; $.manageAjax.create('queue0', { queue: false, preventDoubbleRequests: true, cacheResponse: true }); function setHref(){ //sets absolute paths (counting from root) for links on page as href1 using attribute href0 as original value // alert(path); $("a").each(function(){ var href=$(this).attr('href'); if ($(this).attr('href0')!=undefined){ href=$(this).attr('href0'); // $(this).removeAttr('href0'); } // alert(href); if (href==undefined)href=""; var fl=false; for (var i=0; i0) hash+=data[0].substring(i+1); if (data[1]!='') hash+=(hash=='')?data[1]:'-'+data[1]; // alert(hash); loadPageContent(data[2],data[1],hash); } } } }); } var titArr=[]; function loadPageContent(id,params,hash){ var vars=[]; // array of var names to load // alert(id); //var params_str='-'+params.join('-'); $('div[id^="var_"]').each( function () { // adding var names to array vars.push($(this).attr('id').substr(4)); } ) // if (vars.length){ // connecting to getvars.php $.manageAjax.abort('queue0'); $.manageAjax.add('queue0',{ success: function(data) { // alert(data.toSource()); pointer(false); document.title=data.title; titArr[id+'-'+params]=document.title; $('div[id^="var_"]').each(function(){ //alert(this.id) var n=this.id.substr(4); var v=data[n]; v=v.replace(/[Hh][Rr][Ee][Ff][^'"]+(['"][^'"]+['"])/g, 'href=$1 href0=$1'); // adding href0 attribute to save the original value form IE $(this).html(v.replace(/script/g, 'dontscript')+'
'); // fix against ie var th=this; this.style.visibility='hidden'; setTimeout(function(){ $(th).html(v); setHref(); swfSubst(); th.style.visibility='visible'; },200); }); setTimeout(function(){ eval(data.javascript); setHref(); try{markLink('menu');}catch(e){}; swfSubst(); $('body').show(); },250); if (aIsClicked){ aIsClicked=false; clickHashChange=true; window.location.hash='#'+hash; upd(hash); setTimeout(function (){clickHashChange=false;},210); // timeout for hash change not to be reacted } }, url: 'common/php/getvars.php', data : {id:id,vars:vars.join('&'),params:params,subdom:subDomainName}, type: 'POST', dataType : 'json' }); //} } // sets mouse pointer to 'load' or unsets ----------------- function pointer(par){ $("object").each(function(){ try{this['mWatch'](par);} catch(e){}}); if (par){ $("body").css("cursor","wait"); } else { $("body").css("cursor","default"); } } // ---------------------------------------------------- $(document).ready( function(){ document.body.style.visibility=""; $('body').hide(); function tryId(){ if (!reId) { return; // page was cached and shown before .js files were loaded } clearTimeout (timer1); if (reId==upper_id){ // no need to reload data _ini_JS_(); if(swfSubst!=undefined) swfSubst(); $('body').show(); } else { loadPageContent(reId,params); } } timer1=setTimeout(tryId,300); }); // reloads page content if reId was set in getpath.js function showDivs(id){ //for each div "var_.." hides all divs with ids different then id and shows only with id $('div[id^="var_"]').each( function () { $('div',$(this)).hide(); $('div[id=n'+id+']',this).show(); } ) }