function loadimgTransparent(fileSize) {
	var img = new Image();
	var srv = new Object();
	var ajaxObj = new Array();

	ajaxObj[0] = new sack();
	ajaxObj[0].requestFile = '/runBwServerGetRandom.php';
	ajaxObj[0].method = 'GET';
	ajaxObj[0].onCompletion = function() {
	 if ( (res = ajaxObj[0].response) !== '') {
		re = /{'id':'([0-9]+)','path':'(.+)'}/;
		matches = re.exec(res);
		srv.id = matches[1];
		srv.path = matches[2];

		img.onload = function() {
			end = (new Date()).getTime();
			diff = end - start;

			//alert('loaded. timediff: ' + (end - start) + ' ms');
			connectSpeed = (Math.floor((((fileSize * 8) / (diff / 1000)) / 1024) * 10) / 10);//kbs

			//set display timeout to at least 10s
			to = ( (diff  >= 10000) ? 0 : (10000-diff)) ;

			//update db
			ajaxObj[1] = new sack();
			ajaxObj[1].requestFile = '/runBwClientDbUpdate.php';
			ajaxObj[1].method = 'GET';
			ajaxObj[1].setVar('id', srv.id);
			ajaxObj[1].setVar('speed', connectSpeed);

			ajaxObj[1].onCompletion = function() {
				//alert(ajaxObj[1].response);
			}
			ajaxObj[1].runAJAX();
		}

		start = (new Date()).getTime();
		img.src = srv.path + fileSize + '.gif?t=' + escape(start);
	 }
	}
	ajaxObj[0].runAJAX();
}

function getRandomInt(min, max) {
	return Math.floor(Math.random() * (max - min + 1)) + min;
}
function rateIt(_id, _val) {
	var div = document.getElementById('rate_subtitle');
	var h = 0;
	var ajaxObj = new sack();
	ajaxObj.requestFile = '/ajax_rateSubtitle.php';
	ajaxObj.method = 'GET';
	ajaxObj.setVar('id', _id);
	ajaxObj.setVar('val', _val);
	ajaxObj.onCompletion = function() {
		//alert(ajaxObj.response);
		div.innerHTML = ajaxObj.response;
	}
	ajaxObj.runAJAX();
}

function checkFormAction(el) {
	var inputs = el.getElementsByTagName('input');
	for (i=0; i<inputs.length; i++) {
		if ( (inputs[i].name == 'switch') && (inputs[i].value == 'substube') && inputs[i].checked ) {
			var s = document.getElementById('searchbox');
			if (s.value !== '')
				window.location = 'http://www.substube.com/divx-subtitles/' + escape(s.value) + '/';
			return false;
		}
	}
	return true;
}