var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;

function mopen(id) {
 var offset = $("#languageSelect").position();
 $("#langs").css("position","absolute").css("top",offset.top+28).css("left",offset.left);
 mcancelclosetime();
 if (ddmenuitem) ddmenuitem.style.display = 'block';
 ddmenuitem = document.getElementById(id);
 ddmenuitem.style.display = 'block';
}

function mclose() {
 if (ddmenuitem) ddmenuitem.style.display = 'none';
}

function mclosetime() {
 closetimer = window.setTimeout(mclose, timeout);
}

function mcancelclosetime() {
 if (closetimer) {
 window.clearTimeout(closetimer);
 closetimer = null;
 }
}

document.onclick = mclose;

var params = "";
function CreateConversion(id, currency, revenue)
{
  if (!currency) currency = "USD";
  if (!revenue) revenue = 0;
  if (!id) id = '';
  var rnd = "&rnd=" + Math.random();
  var imgSrcProtocol = "http"+(window.location.protocol == "https:" ? "s" : "");
  var img = new Image();
  img.src = imgSrcProtocol + "://69ae5080-91f8-45c0-ad6e-52d4d7973025.statcamp.net/logging/conversion.ashx?id=" + id + "&revenue=" + revenue + "&currency=" + currency + params + rnd;
  params = "";
}

function AddParam(id, value)
{
  params += "&" + id + "=" + escape(value);
}


function signpopuptoggle()
{
	var offset = $("#member").position();
	$("#signpopup").css("top",offset.top+34).css("left",offset.left).slideToggle();
	return false;
}

function showByCode(code) {
  if(code ==  'howto_step1') {
    document.getElementById( 'howto_step1').style.display =  'block';
    document.getElementById( 'howto_step2').style.display =  'none';
    document.getElementById( 'howto_step3').style.display =  'none';
    }
  if(code ==  'howto_step2') {
    document.getElementById( 'howto_step1').style.display =  'none';
    document.getElementById( 'howto_step2').style.display =  'block';
    document.getElementById( 'howto_step3').style.display =  'none';
    }
  if(code ==  'howto_step3') {
    document.getElementById( 'howto_step1').style.display =  'none';
    document.getElementById( 'howto_step2').style.display =  'none';
    document.getElementById( 'howto_step3').style.display =  'block';
    }  
return false;
}

jQuery(function($) {
	$("#langs .link a").click(langselect);
});

function langselect()
{
	$("#alangbtn").attr("href",$(this).attr("href"));
	$("#activelang #flag").attr("src",$(this).children("img").attr("src"));
	$("#activelang #slang").html($(this).children("span").html());
	mclose();
	return false;
}