function MM_findObj(n, d) { 
	var p,i,x;  
	if(!d)d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length){
		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all)x=d.all[n]; 
	for(i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);
  	if(!x && document.getElementById)x=document.getElementById(n); 
	return x;
}

function turnDiv(d){
	tmpObject=MM_findObj(d);
	if(tmpObject.style.display=='none'){
		tmpObject.style.display='';
	} else {
		tmpObject.style.display='none';
	}
}

function turnDivOn(d){
	tmpObject=MM_findObj(d);
	tmpObject.style.display='block';
}

function turnDivOff(d){
	tmpObject=MM_findObj(d);
	tmpObject.style.display='none';
}

function bigpicview(piclink, width, height){
	x=(screen.width-width)/2;
	y=(screen.height-height)/2;
	window.open('/picview.php?pic='+piclink, 'bpv', 'width='+width+', height='+height+', left='+x+', top='+y+', resizeable=0, scrollbars=0');
}

function changeClass(ele,cls){
	row.className=cls;
}

function changeRowClass(ele,cls){
	row=document.getElementById(ele);
	row.className=cls;
}

function js_in_array(a,v){
	for(js_in_i=0;js_in_i<a.length;js_in_i++){
		if(a[js_in_i]==v)return true;
	}
	return false;
}


//cross frame spoofing
//if(parent!=self)top.location.href=location.href;

//fotoalbum
var albumpopUp='/photoalbum_popup.php';
var albumpopW=600;
var albumpopH=565;
//var albumpopUp='<? echo $cfg['site']['fotoalbum_popup']; ?>';
//var albumpopW=<? echo $cfg['site']['fotoalbum_popup_width']; ?>;
//var albumpopH=<? echo $cfg['site']['fotoalbum_popup_height']; ?>;

function fotoAlbum(albumid){
	winleft=(screen.width-albumpopW)/2;
	winUp=(screen.height-albumpopH)/2;
	winProp='width='+albumpopW+',height='+albumpopH+',left='+winleft+',top='+winUp+',scrollbars=0,resizable';
	Win=window.open(albumpopUp+'?id='+albumid, 'fotoAlbum', winProp);
}

function is_email(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	    return false
	 }
	
	 if (str.indexOf(" ")!=-1){
	    return false
	 }

	 return true					
}

var newsAlbumPopUp='/news_photoalbum_popup.php';
var newsAlbumPopW=900;
var newsalbumPopH=700;

function newsFotoAlbum(albumid,lan,pid){
	winleft=(screen.width-newsAlbumPopW)/2;
	winUp=(screen.height-newsalbumPopH)/2;
	winProp='width='+newsAlbumPopW+',height='+newsalbumPopH+',left='+winleft+',top='+winUp+',scrollbars=0,resizable';
	Win=window.open((lan==''?'':'/'+lan)+newsAlbumPopUp+'?id='+albumid+'&pid='+pid, 'newsFotoAlbum', winProp);
}


//sportversenyek

var svCurrHeadinf='headinfo';
function turnHeadInfo(w){
    document.getElementById('kiemeltbuttonheadsportag').className='rounded hand nounder me_arrow_white_off';
    document.getElementById('kiemeltbuttonheadtipus').className='rounded hand nounder me_arrow_white_off';

	if(svCurrHeadinf!=w){
		turnDivOff('headinfo');
		turnDivOff('headsportag');
		turnDivOff('headtipus');
		turnDivOn(w);
	    document.getElementById('kiemeltbutton'+w).className='rounded hand nounder me_arrow_white_on';
		svCurrHeadinf=w;
	} else {
		turnDivOff('headsportag');
		turnDivOff('headtipus');
		turnDivOn('headinfo');
		svCurrHeadinf='headinfo';
		if(headinfoactivesportag!=0)document.getElementById('kiemeltbuttonheadsportag').className='rounded hand nounder me_arrow_white_on';
		if(headinfoactivetipus!=0)document.getElementById('kiemeltbuttonheadtipus').className='rounded hand nounder me_arrow_white_on';
	}
	
}

function setHome(){
if (document.all){
	document.body.style.behavior='url(#default#homepage)';
	document.body.setHomePage('http://www.sportversenyek.hu');
} else if(window.sidebar){
	if(window.netscape){
		try{  
        	netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
     	}  
     	catch(e){  
			alert("this action was aviod by your browser, if you want to enable, please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");  
     	}
	} 
	var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
	prefs.setCharPref('browser.startup.homepage','http://www.sportversenyek.hu');
	}
}

function addtoFavorites(){
	window.external.AddFavorite('http://www.sportversenyek.hu','Sportversenyek.hu');
}

