function OnChageSelect(obj){

   var langdf =obj.options[obj.selectedIndex].value;
	regexp= /go(\/|\?)?.*$/
	if (regexp.test(location.href)){
	regexp= /(\&|\?)intL\=([^(\&|\#| )]{2})/
	if (regexp.test(location.href)){
	location.href=location.href.replace(/intL\=([^(\&|\#| )]{2})/,'intL='+langdf);
	}else{
	regexp= /\?/
	if(regexp.test(location.href))location.href=location.href+'&intL='+langdf;
	else location.href=location.href+'?intL='+langdf;
	}
	return;
	}
		
if (langdf!=LANG){
Set_Cookie('lang_enabled',langdf.toLowerCase(),24*365);
eval("parts=location.href.replace('"+document.getElementsByTagName('base')[0].href.replace(/\/$/,'')+"','');");
parts=parts.replace(/(\/[a-z]{2}\/|^\/)/,'');
location.href=document.getElementsByTagName('base')[0].href+langdf+'/'+parts;}}
function gtoi(id){ return document.getElementById(id);}
function Get_cookie(name){var cookieValue = "";var search = name + "=";if(document.cookie.length > 0){ offset = document.cookie.indexOf(search);if (offset != -1){ offset += search.length;end = document.cookie.indexOf(";", offset);if (end == -1) end = document.cookie.length;cookieValue = unescape(document.cookie.substring(offset, end))}}return cookieValue;}
function Set_Cookie(name, value, hours){var expire = "";if(hours != null){ expire=(new Date()).getTime();expire+= hours * 3600000;expire = new Date(expire);expire = "; path=/; expires=" + expire.toGMTString();}document.cookie = name + "=" + escape(value) + expire;}
function CnnData(){var C=null;try{C=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{C=new ActiveXObject("Microsoft.XMLHTTP");}catch(sc){C=null;}}if(!C&&typeof XMLHttpRequest!="undefined"){C=new XMLHttpRequest();}return C;}

function DetectedTimeZone(){
	obj=document.getElementById('timezone');
	if (obj==null) return;
	dateUser=new Date();
	dateUser=(dateUser.getTimezoneOffset()/60)*-1;

	for(i=0; i<=obj.options.length-1; i++){
		if (obj.options[i].value==dateUser){
		obj.selectedIndex=i;
		break;
		return;
		}
	}
}  

  function PlaySecureCode(){
	if(!document.all){
		  alert();
		  return;
	  }

	  var obj=document.getElementById('scode');
	  obj.open(document.getElementById('lkcdblk').href);
	  document.getElementById('securecode').focus();
  }

  function CookieEnabled(name){
	name=Get_cookie(name);
	if((!name || name=='') && location.href.search('cookiedisabled.html')==-1){
    location.href=UrlRquets+LANG+'/cookiedisabled.html'
	}
  }

  function getParamUrl(){
	urlP=location.href.split(/(\?|\&)/);
	for(i=1; i<=urlP.length-1; i++){
		part2=urlP[i].split('=');
		if(part2.length==1)continue;
		
		eval('this.'+part2[0]+'="'+part2[1]+'";');
	}
  }
 
 function navlk(obj){
	if(obj.href.search('javascript:')==-1)return;
	if(activeModule!=-1)document.getElementById('navLk_'+activeModule).className='';
	 id=obj.parentNode.parentNode.id.split('_');
	 id=id[1]; 
	 obj.parentNode.parentNode.className='on';
	 obj.parentNode.parentNode.innerHTML=obj.parentNode.parentNode.innerHTML.replace(/<(FONT|font)([^>]*)>/g,'');

	 document.getElementById('subnav').innerHTML=(document.getElementById('subnav_'+id).innerHTML=='')?'<div class=navHdNlk></div>':'<div class=subnavLT><div class=subnavRT><div class=subnavRB><div class=subnavLB>'+document.getElementById('subnav_'+id).innerHTML+'</div></div></div></div>';

	activeModule=id;
 }
 
  function encodeTxt(s,encN){
  s=escape(s);
  var ta=new Array();
  for(i=0;i<s.length;i++)ta[i]=s.charCodeAt(i)+encN;
  return ""+escape(eval("String.fromCharCode("+ta+")"))+encN;
  }
function returnM(s){
var s1=unescape(s.substr(0,s.length-1));
var t='';for(i=0;i<s1.length;i++)t+=String.fromCharCode(s1.charCodeAt(i)-s.substr(s.length-1,1));
s=unescape(t);
document.write('<a href="mailto:'+s+'">'+s+'</a>');
}
	function PosElement(obj){var returns = { x: obj.offsetLeft, y: obj.offsetTop };if (obj.offsetParent) {var tmp = PosElement(obj.offsetParent);returns.x += tmp.x;returns.y += tmp.y;}return returns;}
	function addEvent(__in,ev,fcNmEv){if (document.all) {__in.attachEvent('on'+ev,fcNmEv);}else{__in.addEventListener(ev,fcNmEv,1);}}
function moneyChage(obj){
	objx=document.getElementById('moneyChange');
	if(objx!=null){
		if(objx.style.display==''){
			objx.style.display='none';
			obj.style.fontWeight='normal';
		}else {objx.style.display='';obj.style.fontWeight='bold';}
		return;
	}
	
	obj.style.fontWeight='bold';
	newobjt=document.createElement('div');
	
	if(newobjt.style.opacity!=null){
    newobjt.style.opacity='.9';
	}else{newobjt.style.filter='Alpha(Opacity=90);';}
	
	newobjt.id='moneyChange';
	newobjt.style.position='absolute';
	newobjt.style.border='1px solid #6692B3';
	pos=PosElement(obj);
	newobjt.style.left=pos.x+'px';newobjt.style.top=pos.y+obj.offsetHeight+'px';
	hiddenChg=false;
	
	newobjt.onmouseout=function(){hiddenChg=true;}
	newobjt.onmouseover=function(){hiddenChg=false; }
	newobjt.onmousedown=function(){hiddenChg=false;}
	newobjt.onmouseup=function(){hiddenChg=false;}
	
	addEvent(document.body,'click',function(){ if(hiddenChg){newobjt.style.display='none';hiddenChg=false; }});
	//document.body.onclick=function(){ if(hiddenChg){newobjt.style.display='none';hiddenChg=false; } }
	newobjt.style.backgroundColor='#F1F5F8';
	newobjt.style.padding='0px 10px 5px 10px;';
	newobjt.innerHTML+='<p><a class=txt_p href="go?intL='+LANG+'&action=sign&m=stats">'+str__detail_ing+'</a></p>';
	newobjt.innerHTML+='<span class=txt_p>'+str__money_type+':</span> <select id=selmoney disabled><option>'+str__loaded+'...</option></select>';
	newobjt.innerHTML+='<br><center><input style="margin-top:5px;" id=btnmoney disabled  onclick="changmoney();" type=button value="'+str__continue+'"></center>';

	newobjt.style.top=pos.y+obj.offsetHeight+'px';
	newobjt.style.display='';
	document.body.appendChild(newobjt);
	objSelc=document.getElementById('selmoney');
	objBtn=document.getElementById('btnmoney');
	
	ObjAx=CnnData();

	ObjAx.open('get',UrlRquets+'service?ssid='+Sid+'&task=1');
	ObjAx.send(null);
	ObjAx.onreadystatechange=function() {
		 if(ObjAx.readyState==4){
		eval(ObjAx.responseText);
		 }
	  }
}
function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1].substring(0,2) : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	if(x2.search('.')==-1)x2+='.00';
	return x1 + x2;
}

function changmoney(){
	objSelc=document.getElementById('selmoney');
	objSelc=objSelc.options[objSelc.selectedIndex].value.split('-');
	document.getElementById('moneyViw').innerHTML=addCommas(parseFloat(moneyUsd)/parseFloat(objSelc[0]));
	document.getElementById('premoney').innerHTML=unescape(objSelc[2]);
	
	ObjAx=CnnData();

	ObjAx.open('get',UrlRquets+'service?ssid='+Sid+'&task=2&moneyId='+objSelc[1]+'&price='+objSelc[0]+'&premoney='+objSelc[2]);
	ObjAx.send(null);
	
	}
	
	function setGraphic(typ){
		im=document.getElementById('img_graphic');
		Set_Cookie('typ_graph',typ,24);
		
		im.src=im.src.replace(/(\?|\&)tg\=([^\&]*)/g,'')+'&tg='+typ;
	}
	
	function viewMsgSmp(obj_assoc,objmsg,m){
	pos=PosElement(obj_assoc);
	
	if(objmsg.style.position!='absolute'){
		objmsg.style.position='absolute';
		objmsg.style.border='1px solid #6692B3';
		objmsg.style.backgroundColor='#F1F5F8';
	    objmsg.style.padding='5px;';
	
	   if(objmsg.style.opacity!=null){
       objmsg.style.opacity='0.95';
	   }else{objmsg.style.filter='Alpha(Opacity=95);';}

	}
	
	if(m==0){
		objmsg.style.left=pos.x+'px';
		objmsg.style.top=pos.y+obj_assoc.offsetHeight+'px';
		}else if(m==1){
		objmsg.style.left=(pos.x+10)+'px';
		objmsg.style.top=(pos.y+10)+'px';
		}
		
	
	if(objmsg.style.display=='none'){
		
		objmsg.style.display='';
		obj_assoc.style.fontWeight='bold';
		window.scroll(0,pos.y+objmsg.offsetWidth);
	}else{
		objmsg.style.display='none';
		obj_assoc.style.fontWeight='normal';
	}
	
	

	
	}
	function selc(id){r=document.getElementById(id); r.focus(); r.select();}
	function copysl(id){
    r = document.getElementById(id).createTextRange();
    r.select();
    r.execCommand("COPY");
   }
   
   function send_vote(obj){
	  
	   
	   objF=document.getElementById('sndvt');valueVt=-1;
	   for(i=0; i<objF.length; i++){ if(objF[i].type!='radio')continue;
	   if(objF[i].checked){ valueVt=objF[i].value;}
	   }
	   if(valueVt==-1){ alert(str__he); return false; }
	  
	ObjAx=CnnData();
    obj.value=str__loaded;
	obj.disabled=true;
	
	ObjAx.open('get',UrlRquets+'service?ssid='+Sid+'&task=3&v='+valueVt+'&u='+usrid);
	ObjAx.send(null);
	ObjAx.onreadystatechange=function() {
		 if(ObjAx.readyState==4){
		//alert(ObjAx.responseText);
		obj.disabled=false;
		obj.value=str__continue;
		document.getElementById('emvt').onclick();
		
		eval(ObjAx.responseText);
		 }
	  }

}
function closess(){
	ObjAx=CnnData();
	ObjAx.open('get',UrlRquets+'service?ssid='+Sid+'&task=4');
	ObjAx.send(null);
}
function usrisonline(){
	ObjAx=CnnData();
	ObjAx.open('get',UrlRquets+'service?ssid='+Sid+'&task=5');
	ObjAx.send(null);

}
function addResultPoll(arrysOptions,addM){
	var polloptions=document.getElementById('pollvw');
	polloptions.innerHTML='<span id=mvt>'+addM+'</span>'; 
	if(addM!=''){
		setTimeout(function(){
							document.getElementById('mvt').style.display='none';
							},2000);
	}
	allvt=0;
	for(i=0; i<arrysOptions.length; i++){
    arrysOptions[i][1]=parseInt(arrysOptions[i][1]);
	allvt+=arrysOptions[i][1];
	}
	var inr='<div style="font:bold 90% arial; margin:10px 0px 10px 0px;">'+str__results_poll+':</div>';
    for(i=0; i<arrysOptions.length; i++){
	arrysOptions[i][2]=Math.round((arrysOptions[i][1]*100)/allvt);
	inr+='<div style="margin:10px 0px 10px 0px;"><div style="float:right; font-size:0px;margin-top:5px; background-color:#E1E2E3; width:50px; height:7px;"><div id=ghc_'+i+' style="background-color:red; height:100%; width:0%"></div></div> '+arrysOptions[i][0]+' - <span id="ps_'+i+'">0%</span> </div>';
	}
	inr+='<div style="background-color:#EEF5FB; padding:10px; text-align:center; margin:10px 0px 10px;">'+str__tv.replace(/%s/,allvt)+'</div>';
	
	polloptions.innerHTML+=inr;
	nxtid=0;
	intv=setInterval(function(){
						var ob=document.getElementById('ghc_'+nxtid);
						if(ob==null){  clearInterval(intv);  return;}
						var w=parseInt(ob.style.width);
						w=w+10;
						if(w>=arrysOptions[nxtid][2]){
						w=arrysOptions[nxtid][2];
						document.getElementById('ps_'+nxtid).innerHTML=w+'%';
						nxtid++;

						}else document.getElementById('ps_'+nxtid).innerHTML=w+'%';
						ob.style.width=w+'%';
						},20);
}

function nwpoll(btn,form){
	
	   var voteOption=-1;
	   for(i=0; i<form.length; i++){ if(form[i].type!='radio')continue;
	   if(form[i].checked){ voteOption=form[i].value;}
	   }
	   if(voteOption==-1){ alert(str__he); return false; }
	   
	   btn.value=str__loaded+'...';
	   for(i=0; i<form.length; i++){form[i].disabled=true;}
	   ObjAx=CnnData();

	   ObjAx.open('get',UrlRquets+'service?ssid='+Sid+'&task=9&pollid='+document.getElementById('pollid').value+'&value='+voteOption);
	   ObjAx.send(null);
	   ObjAx.onreadystatechange=function(){if(ObjAx.readyState==4){eval(ObjAx.responseText);}}
}
