var LocationOf =
{
	staticMaps:	new Array(),
	cr:		new Boolean(false),
	c:		new Array(),
	addEvent:	function(o,ev,fn){if(o.addEventListener){o.addEventListener(ev,fn,false);return true;}else if(o.attachEvent)return o.attachEvent("on"+ev,fn);return false;},
	staticMap:	function()
			{
				var a=document.getElementsByTagName("a"),l=a.length,v=LocationOf.staticMaps.length;
				if(LocationOf.cr==false)
				{
					for(var i=0;i<l;i++)
					{
						if(a[i].href.indexOf('locationof.com')>=0)
						{
							if(a[i].innerHTML!='')
							{
								LocationOf.c.push(a[i].innerHTML);
							}
							else
							{
								a[i].innerHTML='<span style="font-size:9px">Mobile GPS Tracking by LocationOf.com</span>';
								LocationOf.c.push('empty');
							}
						}
					}
					LocationOf.cr=true;
				}
				for(var i=0;i<v;i++)
				{
					var o=document.getElementById(LocationOf.staticMaps[i][0]);
					o.style.position='relative';
					o.style.backgroundColor='#666';
					if(LocationOf.c.length>0)
					{
						o.style.padding='0px';
						o.style.width=LocationOf.staticMaps[i][2]+'px';
						o.style.height=LocationOf.staticMaps[i][3]+'px';
						var h='';
						for(var x in LocationOf.c){h+=((h!='')?',':'')+encodeURIComponent(LocationOf.c[x]);}
						o.innerHTML='<a href="http://www.locationof.com/'+LocationOf.staticMaps[i][1].toLowerCase()+'/map/" style="outline:medium none;"><img src="http://www.locationof.com/embeds/staticmap/'+LocationOf.staticMaps[i][1].toLowerCase()+'/'+LocationOf.staticMaps[i][2]+'/'+LocationOf.staticMaps[i][3]+'/'+LocationOf.staticMaps[i][4]+'/'+LocationOf.staticMaps[i][5]+'/'+h+'/" width="'+LocationOf.staticMaps[i][2]+'" height="'+LocationOf.staticMaps[i][3]+'" alt="Real-Time Static Map for user '+LocationOf.staticMaps[i][1]+'" style="position:absolute;border:0px none;"/></a><a href="http://www.locationof.com/" style="outline:medium none;" title="Real-Time GPS Tracking '+LocationOf.staticMaps[i][1]+' by LocationOf.com"><img src="http://www.locationof.com/images/locationof_logo_36x120.png" width="120" height="36" alt="LocationOf.com Logo" style="border:0px none;position:absolute;top:2px;left:2px;"/></a>';
					}
					else
					{
						o.style.padding='4px';
						o.style.fontFamily='Arial';
						o.style.width=(parseInt(LocationOf.staticMaps[i][2])-8)+'px';
						o.style.height=(parseInt(LocationOf.staticMaps[i][3])-8)+'px';
						o.innerHTML='<a href="http://www.locationof.com/" style="outline:medium none;" title="LocationOf.com - Real-Time Mobile GPS Tracking"><img src="http://www.locationof.com/images/locationof_logo_36x120.png" width="120" height="36" alt="LocationOf.com Logo" style="border:0px none;"/></a><br/><div style="cursor:default;text-align:justify;font-size:11px">Please add at least one link to http://www.locationof.com/ to your website in order to add a Location Of Static Map, and make this element work.</div>';
					}
				}
			},
	setMap:		function(o,u,w,h,z,t)
			{
				t=t||'hybrid';
				for(var i in LocationOf.staticMaps){if(LocationOf.staticMaps[i][0]==o){o='locofMap_'+Math.round(Math.random()*9999);break;}}
				if(!document.getElementById(o))document.write('<div id="'+o+'"></div>');
				LocationOf.staticMaps.push(new Array(o,u,w,h,z,t));
			}
};
LocationOf.addEvent(window,'load',LocationOf.staticMap);

