function openNom(nid) {
	var imgp=document.getElementById('nomp');
	var cntnt=document.getElementById('n_'+nid);
	var el0=document.getElementById("x_"+nid);
	var newhtml=cntnt.innerHTML.replace('x_'+nid,'w_'+nid);
	newhtml=newhtml.replace('x_'+nid,'w_'+nid);
	if (el0) {
		if (el0.type=="radio") var fnc='radNom'; else var fnc='chkNom';
		newhtml=newhtml.replace('xrplcx','onClick="'+fnc+'('+nid+')"');
	}
	imgp.innerHTML='<div class="cltrack" onClick="IMPClose(\'nomp\')"></div>'+newhtml;
	if (el0) {
		var el1=document.getElementById("w_"+nid);
		el1.checked=el0.checked;
	}
	shIMP('nomp');
}
function chkNom(nid) {
	var el0=document.getElementById("x_"+nid);
	var el1=document.getElementById("w_"+nid);
	el0.checked=el1.checked;
	var s=document.getElementById("s_"+nid);
	if (el0.checked) s.className="a"; else s.className="";
}
function radNom(nid) {
	var ivote=document.forms.glasForm.vote;
	if(ivote[0].type=="radio")
	 for (var i=0;i<ivote.length;i++) 
		if (ivote[i].checked) document.getElementById(ivote[i].id.replace("x_","s_")).className="";
	chkNom(nid);
}
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)	{
		
	 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 = req.responseText;
			//alert(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';
    }
}

