function charLimit(field,maxLength,countTarget){
	var inputLength=field.value.length;
	if(inputLength>=maxLength){
		field.value=field.value.substring(0,maxLength);
		}
	document.getElementById(countTarget).innerHTML=maxLength-field.value.length;
	}

function showtab(active, passive, activeLink, passiveLink) {
	document.getElementById(active).style.display='';
	document.getElementById(passive).style.display='none';
	
	document.getElementById(activeLink).className='active'; 
	document.getElementById(passiveLink).className=''; 
	return false;
}
function switcher(activeBlock, passiveBlocks, activeClass, passiveClasses, className) {
	document.getElementById(activeBlock).style.display='';
	document.getElementById(activeClass).className=className;
	for (i in passiveBlocks){ 
		document.getElementById(passiveBlocks[i]).style.display='none';
		}
	for (i in passiveClasses){ 
		document.getElementById(passiveClasses[i]).className='';
		}
	return false;
}
function vote(direction, replacement, id){
	var aa;
	if(direction == "up")
		getData('http://www.hotstocked.com/', 'rating=up&nid='+id, aa, replacement);
	else
		getData('http://www.hotstocked.com/', 'rating=down&nid='+id, aa, replacement);
}
function logFlash(version){ 
	getDataWithoutResponse('http://www.hotstocked.com/', 'flash='+version);
}
function vote_article(direction, replacement, id, domain){
	var aa;
	if(domain == null)
		domain = "www";
	if(direction == "up")
		getData('http://'+domain+'.hotstocked.com/', 'arating=up&aid='+id, aa, replacement);
	else
		getData('http://'+domain+'.hotstocked.com/', 'arating=down&aid='+id, aa, replacement);
}
function getData(requestUrl, requestPost, requestResult, replacement) {
	var xmlHttpReq = false;
	var self = this;
	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
		}
	else if (window.ActiveXObject) {
		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
	self.xmlHttpReq.open('POST', requestUrl, true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	self.xmlHttpReq.onreadystatechange = function() {
		if (self.xmlHttpReq.readyState == 4) {
			holder = document.getElementById(replacement);
			holder.innerHTML = self.xmlHttpReq.responseText;
			if (requestResult) window.setTimeout(requestResult+'()', 0);
			}
		}
	self.xmlHttpReq.send(requestPost);
	}
function getDataWithoutResponse(requestUrl, requestPost) {
	var xmlHttpReq = false;
	var self = this;
	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
		}
	else if (window.ActiveXObject) {
		self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
		}
	self.xmlHttpReq.open('POST', requestUrl, true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	self.xmlHttpReq.send(requestPost);
	}
var state = 1;
function selectAll(formObj) {
	for (var i=0;i < formObj.length;i++) {
		fldObj = formObj.elements[i];
		if (fldObj.type == 'checkbox') { 
			if (state) fldObj.checked = true;
			else fldObj.checked = false; 
			}
		}
	state==1?state=0:state=1;
	}

