arrname = new Array ("logo", "logo__", "logo-", "bkl-", "pix", "bul-", "bul1", "go", "go-", "matr", "uploading", "home", "home-", "about", "about-", "preview", "preview-", "upload", "upload-", "download", "download-", "hits", "hits-", "lastest", "lastest-", "profile", "profile-", "joinnow", "joinnow-", "login", "login-", "logout", "logout-", "payout", "payout-", "search", "search-", "support", "support-");
arrimg = new Array ();
for (var i = 0; i < arrname.length; i++) {
	arrimg[arrname[i]] = new Image();
	arrimg[arrname[i]].src = "img/"+arrname[i]+".gif";
}

function setimg(imgid, imgname) {imgid.src = arrimg[imgname].src;}

function textareacounter(area,maxlen,show)
{
if(area.value.length>maxlen) area.value=area.value.substring(0,maxlen);
if(show) show.value = (maxlen - area.value.length);
}

function countpers(form)
{
form.txtcost.value=form.txtcost.value.replace(/[^0-9.]/,'');
cost=(!isNaN(cost=parseFloat(form.txtcost.value)))?cost:0;
cost=parseInt(cost*100)/100;
//form.txtcost.value=cost;
pers=parseInt(cost*brokerage)/100;
form.persent.value=pers;
form.all.value=pers+cost;
}

function counttrcost(form)
{
form.txtsize.value=form.txtsize.value.replace(/[^0-9.]/,'');
size=(!isNaN(size=parseInt(form.txtsize.value)))?size:0;
trcost=parseInt(size*trafcost/1024/1024/1024*100)/100;
trcost=(trcost==0)?0.01:trcost;
form.trcost.value=trcost;
}

function menuplay()
{
document.all.sound.src = "menu.wav";
}

function CheckMaxLength(field, maxlen) {
	if(field.value.length > maxlen)
		field.value = field.value.substring(0, maxlen);
	return true;
}

function CheckMinLength(field, minlen, name) {
	if(field.value.length < minlen) { 
		field.focus();
		alert('Field "' + name + '" should be not less than ' + minlen + ' chars!');
		return false;
	} else return true;
}

function CheckMinValue(field, minvalue, name) {
	if(field.value < minvalue) { 
		field.focus();
		alert('Minimum value of field "' + name + '" is ' + minvalue + '!');
		return false;
	} else return true;
}

function CheckMaxValue(field, maxvalue, name) {
	if(field.value > maxvalue) { 
		field.focus();
		alert('Maximum value of field "' + name + '" is ' + maxvalue + '!');
		return false;
	} else return true;
}
