/*
  This file is part of iNews.hu
  Author: http://konet.hu
  Copyright (c) 2006-2009 All rights reserved.
*/
if((self!=top)&&(top.location.href.subst(0,33)!="https://www.google.com/analytics/")){top.location.href=self.location.href;}
function kkError(a,b,c){return true;}
window.onerror=kkError;function debu(s){if(navigator.userAgent.substr(0,4)=='Lynx'){alert(s);}}
function validEmail(obj){var c=eval(obj);var ok="0123456789qwertzuiopasdfghjklyxcvbnm@_-.";var r="";for(var i=0;i<c.length;i++){r+=(ok.indexOf(c.substr(i,1))==-1)?"":c.substr(i,1);}
eval(obj+"='"+r+"'");}
function emailDecode(x){x.href=x.href.replace(/qkac/g,"@");return true;}
function emailDisplay(x){window.status=x.href.replace(/qkac/g,"@");}
function clearStatus(){window.status="";return true;}
function setStatus(s){window.status=s;setTimeout('clearStatus()',5000);return true;}
function go(frm,f,v){var c=0;eval('c=document.forms['+frm+'].'+f+'.value;');if(c!=v){eval('document.forms['+frm+'].'+f+'.value=v;');}else{eval('document.forms['+frm+'].'+f+'.value=0;');}
document.forms[frm].submit();return false;}
function normalizeUrl(url){if(url.substr(0,7)=="http://"){url=url.substr(url.indexOf('/',8),url.length);}
return url;}
function isIE(){var B=navigator.userAgent.toLowerCase();return(B.indexOf('msie')>=0);}
function getUrl(){var url='';if((window.location.pathname=="/")||(window.location.pathname=='')){e=document.getElementById('lang_cont');if(e!=null){var field=((isIE())?'className':'class');var links=e.getElementsByTagName('A');var i=0;while(i<links.length){if(links[i].getAttribute(field)=='lang_curr'){url=links[i].getAttribute('href');i=links.length;}else{i++;}}}}else{url=window.location.pathname;}
return normalizeUrl(url);}
function trimString(inString){inString=inString.replace(/^\s+/g,"");return inString.replace(/\s+$/g,"");}
function createCookie(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}
document.cookie=name+"="+value+expires+"; path=/"+"; domain=.inews.hu";}
function getCookie(c){var myCookieParts=new Array();myCookieParts=document.cookie.split(';');for(var i in myCookieParts){var actCookie=myCookieParts[i].split('=');if(trimString(actCookie[0])==c){return trimString(actCookie[1]);}}
return'';}
function setLang(lang){createCookie("iNews_Lang",lang,30);}
function setCat(cat){createCookie("iNews_Cat",cat,0);}
function setPath(){var path=getCookie("iNews_Path");if(path==''){var now=new Date();path=navigator.appName.substr(0,1)+Date.parse(now.toGMTString());while(path.length<32){path+=Math.floor(Math.random()*10);}
createCookie("iNews_Path",path,30);whoAmI();}else{createCookie("iNews_Path",path,30);}}
function newsDirector(){var e=document.getElementById('news_cont');if(e!=null){var width=e.clientWidth;var IE=isIE();if(width==0){width=document.body.clientWidth-(168*2);}
var q=parseInt(width/330,10);var o=0;if(q<=1){q=1;}else{var m=width%330;o=parseInt(m/(q+1),10);}
var newWidth=(q*330)+(o*(q-1));var news=e.getElementsByTagName('DIV');if((news!=null)&&(news.length>0)&&(newWidth<(width-10))){if(IE){e.style.pixelWidth=newWidth;}else{e.style.width=newWidth+'px';}
if(o>10){var firstCol=news[0].offsetLeft+100;var field=((IE)?'className':'class');for(var i=0;i<news.length;i++){if(((news[i].getAttribute(field)=='news')||(news[i].getAttribute(field)=='inews'))&&(news[i].offsetLeft>firstCol)){news[i].style.marginLeft=o+'px';}}}}}}
function newsInit(){var e=document.getElementById('news_cont');if(e!=null){var news=e.getElementsByTagName('A');if((news!=null)&&(news.length>0)){var nbsp=document.getElementById('nbsp');var url='';for(var i=0;i<news.length;i++){news[i].setAttribute('target','_blank');if((news[i].title)&&(nbsp!=null)){news[i].setAttribute('title',news[i].title.replace(/ /g,nbsp.value));}
url=normalizeUrl(news[i].href);if(url.substr(0,11)=='/prg/rd.kk?'){news[i].setAttribute('href','http://inews.hu'+url);}}}}}
function dateInit(){var e=document.getElementById('date');if(e!=null){var la=e.title.split('|');if(la.length>1){e.setAttribute('title',la[0]);e.innerHTML=la[1];e=document.getElementById('name_day');if(e!=null){e.innerHTML=" - "+la[2];}}else{getDate();}}}
function iInit(n){if(n){newsDirector();newsInit();}
dateInit();getUserInfo();}
function newsResize(o){var e=document.getElementById('news_cont');if(e!=null){var news=e.getElementsByTagName('DIV');if((news!=null)&&(news.length>0)){setTimeout('newsRefresh()',500);}}
return true;}
function newsRefresh(){if(!getCookie("iNews_last_refresh")){createCookie("iNews_last_refresh",1,1/8640);window.history.go(0);}}
window.onresize=newsResize;