nav = navigator.appName.indexOf("Microsoft")!= -1 ? 1 : 2;

function popup(url, name, width, height, scroll, modal, resizable) {
	width=Math.min(screen.availWidth,width);
	height=Math.min(screen.availHeight-40,height);
	var poz_x=(screen.availWidth-width)/2;
	var poz_y=(screen.availHeight-height-30)/2;
	newwin=window.open(url, name, 'scrollbars='+scroll+', menubar=no, width='+width+', height='+height+', resizable=no,toolbar=no, left='+poz_x+', top='+poz_y+', location=no, status=no');
	if(modal){
		popInt=setInterval(function(n){
			if(typeof(newwin.name)=="string"){
				if(newwin.document.body){
					openerfocus=function(){
						if(typeof(newwin.name)=="string"){
							newwin.focus();
						}else{
							document.body.onfocus=null;
						}
					}
					document.body.onfocus=openerfocus;
					newwin.window.document.body.onunload=function(){}
					newwin.focus();
					/*with(newwin){
						self.focus()
						opener.document.body.onfocus=function(){self.focus();opener.alert(4);}
						self.document.body.onunload=function(){opener.document.body.onfocus=null}
					}*/
					clearInterval(popInt);
				}
			}else{
				clearInterval(popInt)
			}
		},1)
	}
}

function rand( min, max ) {
	var argc = arguments.length;
	if (argc == 0) {
		min = 0;
		max = 2147483647;
	} else if (argc == 1) {
		throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');
	}
	return Math.floor(Math.random() * (max - min + 1)) + min;
}

function urlencode(str) {
	str = escape(str);
	str = str.replace('+', '%2B');
	str = str.replace('%20', '+');
	str = str.replace('*', '%2A');
	str = str.replace('/', '%2F');
	str = str.replace('@', '%40');
	return str;
}

function urldecode(str) {
	str = str.replace('+', ' ');
	str = unescape(str);
	return str;
}



	function getMapGlobal(map_container, adress, city_name, region_name, country_name, lat, lon){				
			getMicrosoftMap(map_container, adress, city_name, region_name, country_name, 44.419619, 26.109166);
	}
	
	
	function getMicrosoftMap(map_container, adress, city_name, region_name, country_name, lat, lon) {						
	       try {	   	       	
				var map = new VEMap(map_container);				
				var address = "";				
				if (adress){
					address = adress+",";
				}
				if (city_name){
					address = address + city_name+",";
				}
				if (region_name){
					address = address + region_name+",";
				}				
				address = address + country_name;
				
				map.LoadMap(new VELatLong(lat, lon), 14);
 
				//by paulus
				latlong = new VELatLong(lat,lon); 
				customerPushPin = new VEShape(VEShapeType.Pushpin,latlong);
				
            customerPushPin.SetFillColor(new VEColor(0,100,150,0.5));
				
				customerPushPin.SetDescription('<span style="color:#ff0000; font-weight:bold;">ANVELOPEIMPORT.RO</span><br>Strada Verzisori Nr. 19');
				map.AddShape(customerPushPin); 		
				customerPushPin.Show();
				map.SetMapStyle(VEMapStyle.BirdseyeHybrid);
				
				
				//map.SetCenterAndZoom(latlong,15);

        
 
				
				
 
				
				
				//map.Find(null, address, VEFindType.Businesses, null, null, null, null, null, null, true, onfound);
 
	       } catch(exception)  {	       	
		   		alert(exception);
		   }
	}
