function ShowOrHide(d1, d2) {
if (d1 != '') DoDiv(d1);
if (d2 != '') DoDiv(d2);
}
function DoDiv(id) {
var item = null;
if (document.getElementById) {
item = document.getElementById(id);
} else if (document.all){
item = document.all[id];
} else if (document.layers){
item = document.layers[id];
}
if (!item) {
}
else if (item.style) {
if (item.style.display == "none"){ item.style.display = ""; }
else {item.style.display = "none"; }
}else{ item.visibility = "show"; }
}




function changePage(page, number, panel_id, template, cat){
	var ajaxRequest;
	try{
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				alert("Your browser broke!");
				return false;
			}
		}
	}
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById(panel_id).innerHTML = ajaxRequest.responseText;
		}
	}
		var hn = window.location.hostname;
	ajaxRequest.open("GET", 'http://'+hn+"/cms/index.php?page="+page+"&number="+number+"&panel_id="+panel_id+"&template="+template+"&category="+cat, true);
	ajaxRequest.send(null); 
}


function addComment(id, template){
	var name     = document.getElementById('cName').value
	var comment  = document.getElementById('cComment').value
	var template = template
	var comments = comment.replace("\n", '(br)')
	comment = comment.replace(/\n\r/g, '(br)')
	comment = comment.replace(/\n/g, '(br)')
	
	if(name == "") alert('You must enter a name.')
	else if(comment == "") alert('You must enter a comment.')
	else {
	document.getElementById('comments_container').innerHTML = 'Loading';
	
	var ajaxRequest;
	try{
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				alert("Your browser broke!");
				return false;
			}
		}
	}
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.getElementById('comments_container').innerHTML = ajaxRequest.responseText;
		}
	}
		var hn = window.location.hostname;
	ajaxRequest.open("GET", 'http://'+hn+"/cms/modules/addcomment.php?name="+name+"&comment="+comment+"&id="+id+"&t="+template, true);
	ajaxRequest.send(null); 
	}
}