//*******************//
// BUAT REGISTRATION //
//*******************//
function toggleSet(rad) 
{ 
  var type = rad.value; 
  for(var k=0,elm;elm=rad.form.elements[k];k++) 
    if(elm.className=='item') 
      elm.style.display = elm.id==type? 'block':''; 
} 

function chkGuild(){
	var str = document.regForm.reg_memberID.value;   
	if (1 > str.length || str.length >= 13){   
		alert("Minimal 4 karakter huruf,angka,minus dan underscore");
		document.regForm.reg_memberID.focus();
		return false;
	}
	else{  
		var chk=true
		return chk;
	}
}

function put_id(id){
	document.regForm.reg_memberID.value = id;
	document.regForm.reg_pass.focus();
}

function guild_check(){
	if(chkGuild()){	
		var url = '../../membership/chkGuild.asp?id=' + document.regForm.reg_memberID.value ;
		window.open(url,'chkGuild','width=336,height=153,scrollbars=no');
	}
	return false;
}

//-------------------------------------------------------------------------------------
// Function : Pre-value search box
// Author: Wilson
// Date: 27 August 2008
//------------------------------------------------------------------------------------
function focus_text(e,warna,text)
{
	if(e.value==text)
	{
		e.style.color=warna;
		e.value="";
	}
}
function blur_text(e,warna,text)
{
	if(e.value=="")
	{
		e.style.color=warna;
		e.value=text;
	}
}


//-------------------------------------------------------------------------------------
// Function : Formatting Number (123456 -> 123.456)
// Author: Wilson
// Date: 27 August 2008
//------------------------------------------------------------------------------------

function FormatNumber(num, decpoint, sep) {
  // check for missing parameters and use defaults if so
  if (arguments.length == 2) {
    sep = ",";
  }
  if (arguments.length == 1) {
    sep = ".";
    decpoint = ",";
  }
  // need a string for operations
  num = num.toString();
  // separate the whole number and the fraction if possible
  a = num.split(decpoint);
  x = a[0]; // decimal
  y = a[1]; // fraction
  z = "";


  if (typeof(x) != "undefined") {
    // reverse the digits. regexp works from left to right.
    for (i=x.length-1;i>=0;i--)
      z += x.charAt(i);
    // add seperators. but undo the trailing one, if there
    z = z.replace(/(\d{3})/g, "$1" + sep);
    if (z.slice(-sep.length) == sep)
      z = z.slice(0, -sep.length);
    x = "";
    // reverse again to get back the number
    for (i=z.length-1;i>=0;i--)
      x += z.charAt(i);
    // add the fraction back in, if it was there
    if (typeof(y) != "undefined" && y.length > 0)
      x += decpoint + y;
  }
  return x;
}

function layerview(obj,id){
	var Tlayer = document.getElementById(id);
	var divs = document.getElementsByTagName('DIV');
	for(i = 0; divs.length > i; ++i){
		if ("itemshop_parentcontainer" == divs[i].className) {
			divs[i].style.zIndex = 1;
		}

		if (/(^|\s)item_layer($|\s)/.test(divs[i].className)) {
			divs[i].parentNode.style.display = 'none';
		}
	}
	if(Tlayer.style.display == 'none'){
		Tlayer.style.display = 'block';
		Tlayer.parentNode.parentNode.parentNode.style.zIndex = 2;
	}
}