function changeType(what) {
  if (what == '1') {	
		number=document.getElementById('type_number');
		phonebook=document.getElementById('type_phonebook');
		group=document.getElementById('type_group');
		user=document.getElementById('type_user');
		outsides=document.getElementById('type_outside');
		mynum=document.getElementById('type_mynum');		
		outsides.style.display = 'none';		
		number.style.display = '';
		phonebook.style.display = 'none';
		group.style.display = 'none';
		user.style.display = 'none';
		mynum.style.display = '';		
	}
  if (what == '2') {
		number=document.getElementById('type_number');
		phonebook=document.getElementById('type_phonebook');
		group=document.getElementById('type_group');
		user=document.getElementById('type_user');
		outsides=document.getElementById('type_outside');
		mynum=document.getElementById('type_mynum');		
		outsides.style.display = 'none';
		number.style.display = 'none';
		phonebook.style.display = '';
		group.style.display = 'none';
		user.style.display = 'none';
		mynum.style.display = '';			
	} 
  if (what == '3') {
		number=document.getElementById('type_number');
		phonebook=document.getElementById('type_phonebook');
		group=document.getElementById('type_group');
		user=document.getElementById('type_user');
		outsides=document.getElementById('type_outside');
		mynum=document.getElementById('type_mynum');		
		outsides.style.display = 'none';
		number.style.display = 'none';
		phonebook.style.display = 'none';
		group.style.display = '';
		user.style.display = 'none';
		mynum.style.display = '';			
	}
  if (what == '4') {
		number=document.getElementById('type_number');
		phonebook=document.getElementById('type_phonebook');
		group=document.getElementById('type_group');
		user=document.getElementById('type_user');
		outsides=document.getElementById('type_outside');
		mynum=document.getElementById('type_mynum');		
		outsides.style.display = 'none';
		number.style.display = 'none';
		phonebook.style.display = 'none';
		group.style.display = 'none';
		user.style.display = '';
		mynum.style.display = '';			
	}	

   if (what == '6') {
		number=document.getElementById('type_number');
		phonebook=document.getElementById('type_phonebook');
		group=document.getElementById('type_group');
		user=document.getElementById('type_user');
		outsides=document.getElementById('type_outside');
		mynum=document.getElementById('type_mynum');		
		outsides.style.display = '';
		number.style.display = 'none';
		phonebook.style.display = 'none';
		group.style.display = 'none';
		user.style.display = 'none';
		mynum.style.display = 'none';			
  } 
 
}
var MWJ_progBar = 0;
function getRefToDivNest( divID, oDoc ) {
	if( !oDoc ) { oDoc = document; }
	if( document.layers ) {
		if( oDoc.layers[divID] ) { return oDoc.layers[divID]; } else {
			for( var x = 0, y; !y && x < oDoc.layers.length; x++ ) {
				y = getRefToDivNest(divID,oDoc.layers[x].document); }
			return y; } }
	if( document.getElementById ) { return document.getElementById(divID); }
	if( document.all ) { return document.all[divID]; }
	return document[divID];
}
function progressBar( oBt, oBc, oBg, oBa, oWi, oHi, oDr ) {
	MWJ_progBar++; this.id = 'MWJ_progBar' + MWJ_progBar; this.dir = oDr; this.width = oWi; this.height = oHi; this.amt = 0;
	document.write( '<table border="0" cellspacing="0" cellpadding="'+oBt+'"><tr><td bgcolor="'+oBc+'">'+
		'<table class="imag" cellspacing="0" cellpadding="0" ><tr><td height="'+oHi+'" width="'+oWi+'" bgcolor="'+oBg+'">' );
	if( document.layers ) {
		document.write( '<ilayer height="'+oHi+'" width="'+oWi+'"><layer bgcolor="'+oBa+'" name="MWJ_progBar'+MWJ_progBar+'"></layer></ilayer>' );
	} else {
		document.write( 'SMS kiekis: <span id="smscount" class="small">1/6</span> - Simboliai: <span id="charcount">160</span><div style="position:relative;top:0px;left:0px;height:'+oHi+'px;width:'+oWi+';">'+
			'<div style="position:absolute;top:0px;left:0px;height:0px;width:0;font-size:1px;background-color:'+oBa+';" id="MWJ_progBar'+MWJ_progBar+'"></div></div>' );
	}
	document.write( '</td></tr></table></td></tr></table>\n' );
	this.setBar = resetBar;
	this.setCol = setColour;
}
function resetBar( a, b ) {
	this.amt = ( typeof( b ) == 'undefined' ) ? a : b ? ( this.amt + a ) : ( this.amt - a );
	if( isNaN( this.amt ) ) { this.amt = 0; } if( this.amt > 1 ) { this.amt = 1; } if( this.amt < 0 ) { this.amt = 0; }
	var theWidth = Math.round( this.width * ( ( this.dir % 2 ) ? this.amt : 1 ) );
	var theHeight = Math.round( this.height * ( ( this.dir % 2 ) ? 1 : this.amt ) );
	var theDiv = getRefToDivNest( this.id ); if( !theDiv ) { window.status = 'Progress: ' + Math.round( 100 * this.amt ) + '%'; return; }
	if( theDiv.style ) { theDiv = theDiv.style; theDiv.clip = 'rect(0px '+theWidth+'px '+theHeight+'px 0px)'; }
	var oPix = document.childNodes ? 'px' : 0;
	theDiv.width = theWidth + oPix; theDiv.pixelWidth = theWidth; theDiv.height = theHeight + oPix; theDiv.pixelHeight = theHeight;
	if( theDiv.resizeTo ) { theDiv.resizeTo( theWidth, theHeight ); }
	theDiv.left = ( ( this.dir != 3 ) ? 0 : this.width - theWidth ) + oPix; theDiv.top = ( ( this.dir != 4 ) ? 0 : this.height - theHeight ) + oPix;
}
function setColour( a ) {
	var theDiv = getRefToDivNest( this.id ); if( theDiv.style ) { theDiv = theDiv.style; }
	theDiv.bgColor = a; theDiv.backgroundColor = a; theDiv.background = a;
}
var smsMaxlen = 160;
var smsConcatMaxlen = 153;

function updateProgress() { 
	var numChars = document.send.smstext.value.length;
	if (numChars > smsConcatMaxlen*6) {
		document.send.smstext.value = document.send.smstext.value.substring(0, smsConcatMaxlen*6);
	}
	numChars = document.send.smstext.value.length;
	var numSMS = 1;
	var numCurrentChars = smsMaxlen-numChars;
	var percentChars = (numCurrentChars == 0) ? 1 : (numChars/smsMaxlen)%1;
	if (numChars > smsMaxlen) {
		numSMS = 1 + Math.ceil((numChars-smsConcatMaxlen)/smsConcatMaxlen);
		numCurrentChars = smsConcatMaxlen-(numChars%smsConcatMaxlen == 0 ? smsConcatMaxlen : numChars%smsConcatMaxlen);
		percentChars = (numCurrentChars == 0) ? 1 : (((numSMS*smsConcatMaxlen)-numCurrentChars)/smsConcatMaxlen)%1;
	}
	myProgBar.setBar(1-percentChars);
	document.getElementById('numSMS').value = numSMS;
	var smscount = document.getElementById('smscount');
	var charcount = document.getElementById('charcount');
	smscount.innerHTML = numSMS+"/6";
	charcount.innerHTML = numCurrentChars;

}

function changeClass(id) {
	obj = document.getElementById(id);
	if(obj.className == 'item') {
		obj.className = 'item_active';
	}
	else {
		if(obj.className == 'item last') {
			obj.className = 'item_active last';
		}
		else {
			if(obj.className == 'item_active last') {
				obj.className = 'item last';
			}
			else {
				obj.className = 'item';
			}		
		}
	}
}
