list = G('cc-list'); var list_open = false; function show(){ wrap.className = wrap.className + ' cc-active '; list_open = true; } function hide(){ wrap.className = wrap.className.replace('cc-active', ''); list_open = false; } function reset(){ hide(); } function scrollTop(){ window.scroll(0,0); } v9.event.on(label, 'click', function(e){ if(list_open) hide(); else show(); if(e.stopPropagation){ e.stopPropagation(); }else{ e.cancelBubble = true; } if(e.preventDefault) e.preventDefault(); }); v9.event.on(list, 'click', function(e){ var item = e.target || e.srcElement; _gaq && _gaq.push(['_trackEvent','click_index_top', 'country', item.getAttribute('href')]); setTimeout(function(){ window.location.href = item.getAttribute('href'); }, 50); if(e.stopPropagation){ e.stopPropagation(); }else{ e.cancelBubble = true; } if(e.preventDefault) e.preventDefault(); return false; }); v9.event.on(document.body, 'click', function(e){ reset(); });})();(function(){ var sel = G('location'); var crs = G('l-cross'); var city = G('cityname'); var list = G('location-list'); var list_open = false; crs.style.display = ''; function show(){ crs.innerHTML = "-"; list.style.display = "block"; list.style.zIndex = 1000; list_open = true; } function hide(){ crs.innerHTML = "+"; list.style.display = ""; list_open = false; } function reset(){ hide(); sel.style.textAlign = "center"; crs.style.visibility = "hidden"; sel.className = ""; } function scrollTop(){ window.scroll(0,0); } v9.event.on(sel, 'mouseover', function(){ sel.className = "location-hover"; crs.style.visibility = "visible"; }); v9.event.on(sel, 'mouseout', function(){ if(list_open) return; crs.style.visibility = "hidden"; sel.className = ""; }); v9.event.on(sel, 'click', function(e){ if(list_open) hide(); else show(); if(e.stopPropagation){ e.stopPropagation(); }else{ e.cancelBubble = true; } if(e.preventDefault) e.preventDefault(); }); v9.event.on(list, 'click', function(e){ var item = e.target || e.srcElement; var wid = item.getAttribute('wid'); var cityname = item.innerHTML; if(!wid){ return false; } city.innerHTML = cityname; city.setAttribute('wid', wid); setTimeout(function(){ reset(); scrollTop(); if(window.v9 && window.v9.saveCity){ window.v9.saveCity(); } }, 300); if(e.stopPropagation){ e.stopPropagation(); }else{ e.cancelBubble = true; } if(e.preventDefault) e.preventDefault(); return false; }); v9.event.on(document.body, 'click', function(e){ reset(); }); v9.weo2city={ "455827":"Sao Paulo", "455825":"Rio de Janeiro", "455821":"Belo Horizonte", "455826":"Salvador", "455831":"Goiania", "455822":"Curitiba", "455824":"Recife", "455922":"Vitoria", "455828":"Campinas", "455819":"Brasilia", "455829":"Cuiaba", "455883":"Maringa", "455991":"Santos", "455903":"Ribeirao Preto", "455830":"Fortaleza", "455901":"Porto Velho", "455894":"Osasco", "449139":"Santo Andre", "455917":"Uberlandia", "455849":"Campo Grande", "455880":"Maceio", "455834":"Sao Luis", "455872":"Joao Pessoa", "455835":"Teresina", "455888":"Natal", "455839":"Aracaju", "455904":"Rio Branco", "455970":"Macapa", "455833":"Manaus", "455820":"Belem", "455936":"Boa Vista", "457721":"Palmas", "455823":"Porto Alegre", "455861":"Florianopolis" }; v9.log = function(ele){ _gaq.push([ '_trackEvent', (ele.getAttribute('p') || null), (ele.getAttribute('d') || null), (ele.getAttribute('l') || null), (parseInt(ele.getAttribute('v')) || 0) ]); }; v9.reqWeather=function(weo){ G("winfo").innerHTML = 'loading...'; v9.utils.request('/',{ "ctr":"index", "op":"forcast", "weo":weo },function(ret){ try{ var o = eval("("+ret+")"); if(o){ G("winfo").className=""; var html = []; if(o['link']){ if( v9.isIE ){ html.push(''); }else{ html.push(''); } } html.push(''); html.push(''); html.push(''); html.push('' + o['today']['high'] + '| ' + o['today']['low'] + ''); html.push('Hoje'); html.push(''); html.push(''); html.push('' + o['tomorrow']['high'] + '| ' + o['tomorrow']['low'] + ''); html.push('Amanha'); html.push(''); html.push(''); if(o['link']){ html.push(''); } setTimeout(function(){ G("winfo").innerHTML = html.join(""); }, 500); } }catch(e){}; }); }; v9.loadWeather = function(){ var weo=v9.utils.readCookie("weo"); if(weo&&v9.weo2city[weo]){ v9.reqWeather(weo); G("cityname").innerHTML=v9.weo2city[weo]; }else{ v9.reqWeather("455827"); } }; v9.saveCity = function(){ var cityid = city.getAttribute('wid'); if(cityid){ v9.utils.writeCookie("weo", cityid); v9.reqWeather(cityid); } };})();v9.event.on(window,"load",function(){ /*load ga*/var ga = document.createElement('script');ga.type = 'text/javascript';ga.async = true;ga.src = 'http://www.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);setTimeout(function(){ var __utmz = v9.utils.readCookie("__utmz"); var medium = null; if(__utmz){ var res = /utmcmd=([^\|]+)/.exec(__utmz); if(res){ medium = res[1]; } } if(!medium){ medium = 'direct'; }window.imglog= document.createElement('img');window.imglog.src='http://analytic.xingcloud.com/' + new Date().getTime() + '/index.gif?appid=v9-' + medium +'&uid=v9_1337078467_417170&event=user.visit'; },10); /*load lazy images*/ if(window.v9 && window.v9.loadLazyImages){ window.v9.loadLazyImages(); } /*load weather*/ setTimeout(function(){ if(window.v9 && window.v9.loadWeather ){ window.v9.loadWeather(); } },10); /*load top-adv*/ setTimeout(function(){ if(G("top-adv-wrapper")){ var adv_iframe = document.createElement('iframe'); adv_iframe.src = "/static/adv/index/top-adv.html?a=135"; adv_iframe.scrolling = "no"; adv_iframe.border = "0"; adv_iframe.frameBorder = "0"; G("top-adv-wrapper").appendChild(adv_iframe); } },10); /*focus on search input*/ if(G("q")){ G("q").focus(); } /*