// JavaScript Document
function ShowMoreInfo() {
	divMoreInfo = document.getElementById("more_info");
	divAds = document.getElementById("ads");
	divAds.style.display = "none";
	divMoreInfo.style.display = "block";
	//var exp = new Date( );
	//var nowPlusOneWeek = exp.getTime( ) + (7 * 24 * 60 * 60 * 1000);
	//exp.setTime(nowPlusOneWeek);
	//document.cookie = "name=ShowMoreInfo; expires=" + exp.toGMTString( );
}

function MoreInfoDone() {
	//document.cookie = "name=; expires=";
	divMoreInfo = document.getElementById("more_info");
	divAds = document.getElementById("ads");
	divAds.style.display = "block";
	divMoreInfo.style.display = "none";

}

function HideMoreInfo() {
	divMoreInfo = document.getElementById("more_info");
	divAds = document.getElementById("ads");
	divAds.style.display = "block";
	divMoreInfo.style.display = "none";	
	document.cookie = "name=; expires=";
}

function chkMoreInfoForm() {
	for (var i = 0; i < document.form1.elements.length; i++) {
		if (document.form1.elements[i].value == "") {
			alert("Please fill in all fields");
			return false;
		}
	}
	return true;
}

function show_details_div(adid) {
	var div_details = document.getElementById('details_' + adid);
	var div = document.getElementById(adid);
	div_details.style.display = 'block';
	div.style.display = 'none';
}

function hide_details_div(adid) {
	var div_details = document.getElementById('details_' + adid);
	var div = document.getElementById(adid);
	div_details.style.display = 'none';
	div.style.display = 'block';
}

function getElementsByClass(node,searchClass,tag) {
	var classElements = new Array();
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("\b"+searchClass+"\b");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function chcolor_red() {
	txt = document.getElementsByClassName('change_color');
	if (typeof(txt) != "undefined") for (var i = 0; i < txt.length; i++) txt[i].style.color='red';
}

function chcolor_white() {
	txt = document.getElementsByClassName('change_color');
	if (typeof(txt) != "undefined") for (var i = 0; i < txt.length; i++) txt[i].style.color='grey';
}

function chcolor() {
	txt = document.getElementsByClassName('change_color');
	if (typeof(txt) != "undefined") {
		for (var i = 0; i < txt.length; i++) {
			if (txt[i].style.color=='grey') chcolor_red();
			else if (txt[i].style.color=='red') chcolor_white();
			else chcolor_red();
		}
	}
}

function stopError() { 
	return true; 
}

window.onerror = stopError; 
window.status=Date();

setInterval('chcolor()',1000);
