var itemstodisplay=10;
var displayoffset=0;
var commentsearch='';
var movedid=0;
var tagsearch='';
var groupsearch='';
var drawnewmap=0;
var	contextinfoevents;
var uid=0;
var updatemaptimer=[ ];
updatemaptimer['newmapcheck']=window.setTimeout('checknewmap()', 250);
updatemaptimer['logincheck']=window.setTimeout('checknewlogin()', 250);

function getuid(passeduid) {
	if(passeduid>0) {
		selectedname=document.getElementById("uid"+passeduid).innerHTML;
	} else {
		selectedname='';
	}
	document.getElementById('updateinfo').value=selectedname;
	
	document.getElementById('bodyframe').setAttribute('src', '/frames/interface/userframe.php?uid='+passeduid);

	hide('updatedropdown');
	namechange()
	uid=passeduid;
	displayoffset=0
	commentsearch='';
	tagsearch='';
	groupsearch='';
	movedid=parseInt(document.variablepassing.movemarker.value);
	document.variablepassing.commentsearch.value='';
	document.variablepassing.getextrarid.value='';
	document.variablepassing.tagsearch.value='';
	document.variablepassing.groupsearch.value='';
	document.variablepassing.usersearch.value='';
	document.variablepassing.searchlat.value='';
	document.variablepassing.searchlong.value='';
	document.variablepassing.movemarker.value='';
	document.variablepassing.drawnewmap.value=0;

	querymap(map);
};
function querymap (parentmap) {
	var maptoshow="mapcache/caching.php?";
	if (document.variablepassing.groupsearch.value != 0) {
		maptoshow+='lastxgroup='+document.variablepassing.groupsearch.value+'&';
	};
	try {
		if (document.variablepassing.getextrarid.value.length > 1) {
			maptoshow+='rid='+document.variablepassing.getextrarid.value.substr(document.variablepassing.getextrarid.value.length, 1, document.variablepassing.getextrarid.value.length);
			maptoshow+='&'
		};
	} catch(e) { };
	if (commentsearch.length > 0) {
		maptoshow+='commentsearch='+encodeURI(commentsearch)+'&';
		try {
					maptoshow+='lat='+document.variablepassing.searchlat.value;
					maptoshow+='&long='+document.variablepassing.searchlong.value;
					maptoshow+='&latsize='+document.variablepassing.searchlatsize.value;
					maptoshow+='&longsize='+document.variablepassing.searchlongsize.value+'&';
		} catch(e) { };
	};
	if (tagsearch.length >0 ) {
		maptoshow+='tagsearch='+encodeURI(tagsearch)+'&';
		try {
			if (document.variablepassing.searchlat.value!=0) {
					maptoshow+='lat='+document.variablepassing.searchlat.value;
					maptoshow+='&long='+document.variablepassing.searchlong.value;
					maptoshow+='&latsize='+document.variablepassing.searchlatsize.value;
					maptoshow+='&longsize='+document.variablepassing.searchlongsize.value+'&';
			};
		} catch(e) { };
	};
	if (movedid>0) {
		maptoshow+=maptoshow+'move=1&DID='+movedid+'&';
		movedid=0;
	};
	if (uid > 0) {
		maptoshow+='lastxuser='+uid+'&';
	};


	maptoshow=maptoshow+"lastx="+itemstodisplay+"&lastxoff="+displayoffset;
	genericmap( maptoshow, parentmap );
}			

	function checknewmap() {
		updatemaptimer['newmapcheck']=window.setTimeout('checknewmap()', 250);						

		var drawnewmap=false;
		try {
			if (document.variablepassing.drawnewmap.value==1) { drawnewmap=true }
		} catch (e) {	};

		if (drawnewmap) {
			itemstodisplay=parseInt(document.variablepassing.todisplay.value);
			displayoffset=parseInt(document.variablepassing.offset.value);
			commentsearch=document.variablepassing.commentsearch.value;
			document.variablepassing.getextrarid.value='';
			tagsearch=document.variablepassing.tagsearch.value;
			groupsearch=parseInt(document.variablepassing.groupsearch.value);
			searchlat=parseFloat(document.variablepassing.searchlat.value);
			searchlong=parseFloat(document.variablepassing.searchlong.value);
			movedid=parseInt(document.variablepassing.movemarker.value);
			uid=parseInt(document.variablepassing.usersearch.value);
			document.variablepassing.commentsearch.value='';
			document.variablepassing.tagsearch.value='';
			document.variablepassing.usersearch.value='';
			document.variablepassing.movemarker.value='';
			document.variablepassing.drawnewmap.value=0;
			querymap(map);
			navigate();
		};
//	} catch (e) { }

};
function checknewlogin() {
	try {
		if (document.variablepassing.newlogin.value==1) {
			document.variablepassing.newlogin.value=0;
			navigate();
		};
	} catch (e) { }
	updatemaptimer['logincheck']=window.setTimeout('checknewlogin()', 250);
};

window.onresize=function () {
	if (window.opera) {
		var ml=(((document.documentElement.clientWidth-document.getElementById('bodyframe').getAttribute('width'))/2)-70)
		if (ml <= 0) { ml=0; };
		document.getElementById('bodyframe').style.marginLeft = ml+'px';		
	} else {
		var ml=(((document.body.clientWidth-document.getElementById('bodyframe').getAttribute('width'))/2)-70)
		if (ml <= 0) { ml=0; };
		document.getElementById('bodyframe').style.marginLeft = ml+'px';
	};
};