function openMap(nid,t) {
	var imgp=document.getElementById('nomp');
	var cntnt=document.getElementById(nid);
	if (cntnt.innerHTML) {
		imgp.innerHTML='<div class="cltrack" onClick="IMPClose(\'nomp\')">'+t+'</div>'+cntnt.innerHTML;
	
		shIMP('nomp');
	}
}

function openWinIndex2(lnk,w,h,wn,m) {
	var vin=window.open(lnk+'&margin_window='+m,wn,'resizable: yes; ');
	vin.resizeTo(w, h);
	vin.resizable='yes';
}
function IMP(im) { 
	var imgp=document.getElementById('imgp');
	imgp.innerHTML='<img src="/files/Image/'+im+'" alt="Click to Close" onLoad="shIMP();"/>';
}
function showYouTube(vid) { 
	var imgp=document.getElementById('videop');
	imgp.innerHTML='<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/'+vid+'&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+vid+'&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>';
	
	
	
	shIMP('videop');
}

function shIMP(w) {
	if (!w) w='imgp';
	var imgp=document.getElementById(w);
	
	imgp.style.visibility = 'visible'; 
	imgp.style.display='block';
		
	 if (!document.all&&document.getElementById) {
		var ol = self.pageXOffset+(window.innerWidth/2-Number(imgp.offsetWidth)/2);  
		var ot = self.pageYOffset + (window.innerHeight/2-Number(imgp.offsetHeight)/2);	
	  } else {
		var ol = 0 - imgp.offsetWidth/2 + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth )/2 + ( ignoreMe = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft )   ;	
		var ot= 0 - imgp.offsetHeight/2 + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight )/2 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )   ;
	  }
  	if (ol<0) ol=0;
	if (ot<0) ot=0;
	imgp.style.left=ol+"px"
	imgp.style.top=ot+"px"
	
	imgp.style.zIndex=10000001;
}
function IMPClose(w) {
		if (!w) w='imgp';
		var imgp=document.getElementById(w);
		imgp.style.visibility = 'visible'; 
		imgp.style.display='none';
		imgp.innerHTML='';
}

function g_SendSimple(url)	{

	var reo=new RegExp("&amp;","g");
	url=url.replace(reo,"&");
	 if (window.XMLHttpRequest) req = new XMLHttpRequest();
	 else if (window.ActiveXObject) 
        req = new ActiveXObject("Microsoft.XMLHTTP");
	
	if (req) {
		  req.onreadystatechange = function() {
			g_SimpleDone();
			}
          req.open("POST", '/rplc.php?simple=1&'+url, true);
		if (window.XMLHttpRequest) req.send(null);
		else if (window.ActiveXObject) req.send();

	} else alert('Request not defined');
}

function g_SimpleDone() {
	 if (req.readyState == 4) {
        if (req.status == 200) {
			var resText = TrimS(req.responseText);
			//showDebugger(resText);;
				
			var resArr=resText.split('+#+');
			var target=document.getElementById(resArr[0]);
			if (target) target.innerHTML=resArr[1];
        } else {
            alert("jah error:\n" +
                req.statusText);
        }
		//document.body.style.cursor = 'default';
    }
}
function php_urlencode (str) {
str = escape(str);
return str.replace(/[*+\/@]|%20/g,
function (s) {
switch (s) {
case "*": s = "%2A"; break;
case "+": s = "%2B"; break;
case "/": s = "%2F"; break;
case "@": s = "%40"; break;
case "%20": s = "+"; break;
}
return s;
}
);
}
function TrimS(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}


