function showAndHide(theId){ 
	var el = document.getElementById(theId) 
	if (el.style.display=="none") { 
		el.style.display="block"; //show element 
	} 
	else { 
		el.style.display="none"; //hide element 
	} 
} 

function gotoPage(strURL){
	var ajaxRequest;  // The variable that makes Ajax possible!	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			//document.myForm.time.value = ajaxRequest.responseText;
			document.getElementById("contentArea").innerHTML = ajaxRequest.responseText;
			initLightbox();
			myLightbox.updateImageList();
		}
	}
	ajaxRequest.open("GET", strURL, true);
	ajaxRequest.send(null);
}

function popUp(strURL,h,w){
	newwindow=window.open(strURL,'name',"menubar=no,width="+w+",height="+h+",toolbar=no,resizable=no");
	if (window.focus) {newwindow.focus()}
}
function popUp2(strURL,h,w){
	newwindow=window.open(strURL,'name',"menubar=no,width="+w+",height="+h+",toolbar=no,resizable=no,scrollbars=yes");
	if (window.focus) {newwindow.focus()}
}
function toggleEnabled(el){
	if(document.getElementById(el).value != ""){
		document.getElementById(el).disabled = false;
	}
}

function sortBlogElements(){
	//alert('Starting to Sort');
	var elements = $($('ul#all_blog_list li').remove().get().sort(sortByDate)).appendTo('#all_blog_list');		
	//alert('Finished Sorting');
}
function sortByDate(a, b){
	var a_int = parseInt(a.getAttribute('timestamp'));
	var b_int = parseInt(b.getAttribute('timestamp'));
	if(a_int>b_int){
		return -1;
	}
	if(a_int>b_int){
		return 1;
	}
	return 0; 
}
