function inputValue(){
	var el = get_el('keywords');
	// change class
	if(el.className == 'search-default'){
		el.className = 'search-selected';
	}else{
		el.className = 'search-default';
	}
	// change value
	if(el.value == 'enter keywords'){
		el.value = '';
	}else{
		el.value = 'enter keywords';
	}
}

function getHTTPObject() {
	var http = false;
	//Use IE's ActiveX items to load the file.
	if(typeof ActiveXObject != 'undefined') {
		try {http = new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e) {
			try {http = new ActiveXObject("Microsoft.XMLHTTP");}
			catch (E) {http = false;}
		}
	//If ActiveX is not available, use the XMLHttpRequest of Firefox/Mozilla etc. to load the document.
	} else if (XMLHttpRequest) {
		try {http = new XMLHttpRequest();}
		catch (e) {http = false;}
	}
	return http;
}
function post_rating(url, parameters){
	var http = getHTTPObject();
	get_el('rating_wrapper').innerHTML = "Loading&hellip;";
	http.onreadystatechange = alertContents;
	http.open('POST', url, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Charset", "windows-1251");
	http.setRequestHeader("Content-length", parameters.length);
	http.setRequestHeader("Connection", "close");
	http.send(parameters);
}
function rate(article_id, vote){
	post_rating('/pitchpage/assets/rate.php', 'article_id=' +article_id+'&vote='+vote);
}
function alertContents() {
	if (this.readyState == 4) {
		if (this.status == 200) {
			result = this.responseText;
			get_el('rating_wrapper').innerHTML = result;
		}else{
			alert('Please try again later.');
		}
	}
}

function check_user(a,v){
	var http = getHTTPObject();
	var params = 'action=' + a + '&user=' + v;
	http.open("POST", "/pitchpage/assets/form_checks.php", true);
	
	//Send the proper header infomation along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = function(){
		switch(http.readyState){
			case 4:
				if(http.status == 200){
					if(http.responseText == 'true'){
						get_el(a + '_check').innerHTML = a + ' is taken. Try another.';
						get_el(a + '_check').style.display = 'inline';
					}else{
						get_el(a + '_check').style.display = 'none';
						get_el(a + '_check').innerHTML = '';
					}
				}else{
					get_el(a + '_check').innerHTML = 'Error occured while checking email.';
				}
			break;
			case 1:
				get_el(a + '_check').innerHTML = 'Checking&hellip;';
			break;
		}
	}
	http.send(params);
}

function get_el(){var r=[],a=arguments;for(var i=0,j=a.length;i<j;i++){(typeof a[i]=='string')?(r.push(document.getElementById(a[i]))):(r.push(a[i]))}
return(r.length==1)?r[0]:r}