iLoader = new Image(); iLoader.src=uds+'/tpl/pictures/ajax-loader.gif'; iLoader2 = new Image(); iLoader2.src=uds+'/tpl/pictures/bar-loader.gif';iLoader3 = new Image(); iLoader3.src=uds+'/tpl/pictures/ajax-loader_s.gif';

function SendVote(mid){
fixSizeW2('mvk_'+mid,'svk_'+mid);
document.getElementById('svk_'+mid).style.display='block';
var tlo=uds+'/at/mbr_tools.php?a=33&mid='+mid;
makeRequest(tlo, 'svk_'+mid, '0');
}

function RestHeight(id){ var ThisDiv=document.getElementById(id); ThisDiv.style.height=""; }

function SetFocus(id){ var ThisDiv=document.getElementById(id); ThisDiv.focus(); }

function tgv(id){ var ThisDiv=document.getElementById(id); if (ThisDiv.style.display=='block'){ ThisDiv.style.display='none'; } else{ ThisDiv.style.display='block'; } }

function DoReload(){document.location.reload();}

function getFlashMovieObject(movieName) {if (window.document[movieName]){ return window.document[movieName];}if (navigator.appName.indexOf("Microsoft Internet")==-1){  if (document.embeds && document.embeds[movieName]) return document.embeds[movieName];}else{  return document.getElementById(movieName);} }

function readCookie(name) {var nameEQ = name + "=";var ca = document.cookie.split(';');for(var i=0;i < ca.length;i++) {var c = ca[i];	while (c.charAt(0)==' ') c = c.substring(1,c.length);	if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}return null; } function createCookie(name,value,days) {if (days) {	var date = new Date();	date.setTime(date.getTime()+(days*24*60*60*1000));	var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/"; } function eraseCookie(name) {createCookie(name,"",-1); }

function checkEnter(e){ var characterCode; if(e && e.which){ e = e; characterCode = e.which; } else{ e = event; characterCode = e.keyCode; } if(characterCode == 13){ return true; } else{ return false; } }

function stresc(encodedHtml){encodedHtml = encodedHtml.replace(/\"/g,"''"); encodedHtml = encodedHtml.replace(/\//g,"%2F"); encodedHtml = encodedHtml.replace(/\?/g,"%3F"); encodedHtml = encodedHtml.replace(/=/g,"%3D"); encodedHtml = encodedHtml.replace(/&/g,"%26"); encodedHtml.replace(/\n/g,"%0A");encodedHtml = encodedHtml.replace(/@/g,"%40");return encodedHtml; }

var screenW = 640, screenH = 480; function 
GWS() { 
	if (parseInt(navigator.appVersion)>3) {  screenW = screen.width;  screenH = screen.height; 
	} else if (navigator.appName == "Netscape"     && parseInt(navigator.appVersion)==3     && navigator.javaEnabled()    ) {  var jToolkit = java.awt.Toolkit.getDefaultToolkit();  var jScreenSize = jToolkit.getScreenSize();  screenW = jScreenSize.width;  screenH = jScreenSize.height; } }

function SetDwnScroll(id){
var objDiv = document.getElementById(id);
objDiv.scrollTop = objDiv.scrollHeight;
}

function nl2br(text){ var re_nlchar; text = escape(text); if(text.indexOf('%0D%0A') > -1){ }else if(text.indexOf('%0A') > -1){ re_nlchar = /%0A/g ; }else if(text.indexOf('%0D') > -1){ re_nlchar = /%0D/g ; } return unescape( text.replace(re_nlchar,'<br/>') ); }

function GetSelBoxes(name){
var str="";
var nbox=document.getElementsByName(name);
for (i=0;i<nbox.length;i++){
if (nbox[i].checked==true){
str=str+nbox[i].value+'|';
}
}
return str;
}

function getPageHeight() {
return document.height || document.body.offsetHeight;
}

function getPageWidth() {
return document.width || document.body.offsetWidth;
}

function GetScrollHeight(){var Hs=document.body.scrollTop; return Hs;}	

function fixSizeW2(parid,childid){
var btnw=150;
if ( browser == "Microsoft Internet Explorer" ){
document.getElementById(childid).style.width=btnw+'px';
}
else{
var nwd=btnw-13;
document.getElementById(childid).style.width=nwd+'px';
}
}

function fixSizeW(parid,childid){
var btnw=parseInt(document.getElementById(parid).offsetWidth);
if ( browser == "Microsoft Internet Explorer" ){
document.getElementById(childid).style.width=btnw+'px';
}
else{
var nwd=btnw-13;
document.getElementById(childid).style.width=nwd+'px';
}
}

//setInterval ( "UpdateOnline()", 180000 );

function UpdateOnline(){
var tlo=uds+'/at/mbr_tools.php?a=15';
makeSimpleRequest(tlo);
}

  function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function ContHelp(el,txt,fw){ if (UseHelp==1){ return; } var ThisDiv=document.getElementById('contest_help'); ThisDiv.style.display="block"; 
var CtDiv=document.getElementById('contest_help_content');
if (fw>0){
ThisDiv.style.width=fw+'px';
}
else{
ThisDiv.style.width='180px';
}
CtDiv.innerHTML=txt; var Ppdos=findPosX(el); var Pptop=findPosY(el); var ObW=el.offsetWidth; var ObH=el.offsetHeight; var pw=getPageWidth(); var divw=ThisDiv.offsetWidth; var lpos=Ppdos+20; if ((lpos+divw)>pw){ var dff=(lpos+divw)-pw; lpos=lpos-dff-20; } ThisDiv.style.left=lpos; ThisDiv.style.top=Pptop+ObH+2;
document.getElementById('pptpic').style.marginLeft='7px';
if ( browser == "Microsoft Internet Explorer" ){
document.getElementById('pptpic').style.marginBottom=-3;
}
else{
document.getElementById('pptpic').style.marginBottom=-1;
}

}

function ContHelpL(el,txt,fw){ if (UseHelp==1){ return; } var ThisDiv=document.getElementById('contest_help'); ThisDiv.style.display="block"; 
var CtDiv=document.getElementById('contest_help_content');CtDiv.innerHTML=txt; var Ppdos=findPosX(el); var Pptop=findPosY(el); var ObW=el.offsetWidth; var ObH=el.offsetHeight; var divw=ThisDiv.offsetWidth; var lpos=Ppdos-divw+(ObW-20); ThisDiv.style.left=lpos; ThisDiv.style.top=Pptop+ObH+2;
document.getElementById('pptpic').style.marginLeft=175;
if ( browser == "Microsoft Internet Explorer" ){
document.getElementById('pptpic').style.marginBottom=-3;
}
else{
document.getElementById('pptpic').style.marginBottom=-1;
}
if (fw>0){
ThisDiv.style.width=fw+'px';
}
else{
ThisDiv.style.width='180px';
}
}

function ContHelpBtn(el,txt,fw){ if (UseHelp==1){ return; } var ThisDiv=document.getElementById('contest_help'); tgv('contest_help'); ThisDiv.innerHTML=txt; var Ppdos=findPosX(el); var Pptop=findPosY(el); var ObW=el.offsetWidth; ThisDiv.style.left=Ppdos+ObW; ThisDiv.style.top=Pptop; 
if (fw>0){
ThisDiv.style.width=fw+'px';
}
else{
ThisDiv.style.width='150px';
}
}

function ContHelpBlur(){ var ThisDiv=document.getElementById('contest_help'); ThisDiv.style.display="none"; }

function SetHelp(val){
UseHelp=val;
createCookie('help',val,365);
var on=document.getElementById('ctshpOn');
var off=document.getElementById('ctshpOff');

if (val=='1'){
on.style.display='block';
off.style.display='none';
}
else{
on.style.display='none';
off.style.display='block';
}
}

function trim(s){
return s.replace(/^\s+|\s+$/, '');
} 


var r={
  'special':/[\W_]/g,
  'quotes':/['\''&'\"']/g,
  'notnumbers':/[^\d]/g
}

function vdp(o,w){
  o.value = o.value.replace(r[w],'');
}

//onkeyup="vdp(this,'special')" onblur="vdp(this,'special')"

function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57)){
return false;
}
return true;
}

function OpnMdl(caption,url){
document.getElementById('xbtn').style.display="block";
DoOpenMdl(caption,url);
}

function OpnMdl1(caption,url){
document.getElementById('xbtn').style.display="none";
DoOpenMdl(caption,url);
}

function DoOpenMdl(caption,url){
var modal=document.getElementById('mdl');
modal.style.display="block";
var Hs = GetScrollHeight();
modal.style.top=Hs+20;
var pw=getPageWidth();
modal.style.left=(pw-800)/2;
modal.style.zIndex='150';
var mask=document.getElementById('mask');
mask.style.display="block";
mask.style.height=TotPgH();
var capt=document.getElementById('mdlcpt');
capt.innerHTML=caption;
var mdliframe=document.getElementById('mdliframe');
mdliframe.src=url;
}


function ClsMdl(){
var mdlbody=document.getElementById('pfmdlbody');
var defurl=uds+"/t/shownotice.php?a=1";
mdlbody.innerHTML='<center><iframe  id="mdliframe" src ="'+defurl+'" width="780px" height="490px" frameborder="0"></iframe></center>';
var modal=document.getElementById('mdl');
modal.style.display="none";
var mask=document.getElementById('mask');
mask.style.display="none";

}

function TotPgH(){
var pageHeight;
if( window.innerHeight && window.scrollMaxY ) {
pageHeight = window.innerHeight + window.scrollMaxY;
}
else if(document.body.scrollHeight > document.body.offsetHeight )
{
pageHeight = document.body.scrollHeight;
}
else
{pageHeight = document.body.offsetHeight + document.body.offsetTop; }
return pageHeight;
}
