closelang = "true";
loginErrs = 0;
function closeLang(){
	closelang = "true";
	if($('chooselanghidden').style.display=='block'){
		setTimeout(closeLangClose, 750);	
	}
}

function changePassBg(lang){
		value=$('loginpass').value;
		if(value!="" || value!=null)
			$('loginpass').removeClassName("passbg"+lang);
	}
function changePassBgReturn(lang){
		value=$('loginpass').value;
		if(value=="" || value==null)
			$('loginpass').addClassName("passbg"+lang);
		else
			$('loginpass').removeClassName("passbg"+lang);
	}
	
	function changePassBg2(lang){
		value=$('D2passwordlogin').value;
		if(value!="" || value!=null)
			$('D2passwordlogin').removeClassName("passbg"+lang);
	}
function changePassBgReturn2(lang){
		value=$('D2passwordlogin').value;
		if(value=="" || value==null)
			$('D2passwordlogin').addClassName("passbg"+lang);
		else
			$('D2passwordlogin').removeClassName("passbg"+lang);
	}
	
function changeFlash(url,objectid,embedid){
var d=document;

(d.all)? d.all(objectid).movie = url :
d.embeds[embedid].src = url;
}
function closeLangClose(){
	if(closelang=="true")
		$('chooselanghidden').style.display='none';
}
function cancelCloseLang(){
	closelang = "false";
}
function changeNavBg(num){
	position = 48 + num*21;
	position = position + "px";
	$('navbg').setStyle({
		top: position
	});
}
function setNavBg(){
	navpannelrows = $$("div.navpanneltext");
	for(i=0;i<navpannelrows.length;i++){
		if(navpannelrows[i].hasClassName("navpanneltextcurrent")){
			changeNavBg(i);
		}
	}
}


function sendLoginForm(evt) {
	
	Event.stop(evt);
	formData = $('loginFormForm').serialize();
	new Ajax.Request($('loginFormForm').action+"login.php", {
		method: 'post',
		postBody: formData,
		onComplete: function(resp) {
			txt = resp.responseText;
			
			if(txt=="err"){
				
				$('loginerror').style.display='block';

			}
			else 
			{
				//alert(txt);
				$('nameview').innerHTML=txt;
				$('fades').style.display='none';
				$('logout1').style.display='block';
				$('hello').style.display='block';
				
				//Login sucssesfull
			}
		}
	});
}

function DsendLoginForm(evt) {
	Event.stop(evt);
	formData = $('DloginFormForm').serialize();
	new Ajax.Request($('DloginFormForm').action+"login.php", {
		method: 'post',
		postBody: formData,
		onComplete: function(resp) {
			txt = resp.responseText;
			
			if(txt=="err"){
				
				$('DloginError').style.display='block';

			}
			else 
			{
				
				
				location.reload(true)
			}
		}
	});
}

function reloadkap(){
	$('kap').src='parts/regpiccode.php?gf='+Math.random();
	kapcheck();
}



function changelocation(type){
	switch (type){
		case "newAccount":
			url = "newAccount.php";	
			break;
		case "newDemoAccount":
			url = "newAccountDemo.php";
			break;
		case "partnership":
			url = "partnership.php";
			break;
		case "downloads":
			url = "downloads.php";
			break;
		case "credit":
			url = "credit.php";
			break;
		default:
			url = "";
			break;
	}
	window.location = (url);
}

function sendpaymb()
{
	//langmb
sum=$('contact_sum').value;
mbaccount=$('contact_email4mb').value;
currencyaccount=$("contact_currency").value;
currency=$("contact_currency").options[$("contact_currency").selectedIndex].text;
if(checkform()==true){
	$('framid').src='https://www.moneybookers.com/app/payment.pl?pay_to_email='+currencyaccount+'&pay_from_email='+mbaccount+'&language=EN&amount='+sum+'&currency='+currency+'&detail1_description=account:&detail1_text='+amb+'&merchant_fields=metaac='+amb+'&recipient_description=forex place&logo_url=http://www.4xp.com/img/logo.jpg&return_url=http://www.4xp.com/'+langmb+'/moneyB.php?g=1&cancel_url=http://www.4xp.com/'+langmb+'/moneyB.php?g=2&status_url=http://www.4xp.com/parts/mbtest.php&status_url2=mailto:daniel@4xp.com';
    $('framid').style.display='';
}
}

function showHide(id)
{
	oDiv = document.getElementById(id);
	if (oDiv)
	{
		if (oDiv.style.display == "none")
		{
			oDiv.style.display = "";
		}
		else
		{
			oDiv.style.display = "none";
		}
	}
}

function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function NewRegularWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes';
win=window.open(mypage,myname,settings);}