function popup(url, windowName) {
        popupWindow = window.open(url, windowName, 'width=400,height=300,scrollbars=yes,' + find_center(400,300))
        popupWindow.focus()
}

function popup2(url, windowName, wdth, hght) {
        popupWindow = window.open(url, windowName, 'width='+(wdth*1.1)+',height='+(hght*1.1)+',scrollbars=yes,' + find_center((wdth*1.1),(hght*1.1)))
        popupWindow.focus()
}
        
function find_center(w, h) {
        // find position like 'width=x,height=y' for window of given dimensions
        var width = window.outerWidth;
        var height = window.outerHeight;
        if (screen.availWidth) {
                width = screen.availWidth;
                height = screen.availHeight;
           }
        var x = (width - w)/2;
        var y = (height - h)/2;
        if (x < 0) x = 0;
        if (y < 0) y = 0;
        return 'left='+ x +',top='+ y;
}

function jumpTo(pageSelected) {
   newPage=pageSelected.options[pageSelected.selectedIndex].value
   if (newPage!="") {
      window.location.href=newPage
   }
}

// video search timeout

var qVideoSearch_timeout;

function qVideoSearchSubmit() {
        
    clearTimeout(qVideoSearch_timeout);
    qVideoSearch_timeout = setTimeout("qVideoSearch_after_timeout();", 350);
}
        
function qVideoSearch_after_timeout() {
        
    clearTimeout(qVideoSearch_timeout);
    xajax_videoSearch(xajax.$('videoSearch').value,0);
            
        }

// comments search timeout
        
var qCommentsSearch_timeout;

function qCommentsSearchSubmit() {
        
    clearTimeout(qCommentsSearch_timeout);
    qCommentsSearch_timeout = setTimeout("qCommentsSearch_after_timeout();", 350);
}
        
function qCommentsSearch_after_timeout() {
        
    clearTimeout(qCommentsSearch_timeout);
    xajax_commentsSearch(xajax.$('commentsSearch').value,0);
            
        }

function showInline (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "inline";
	}
}
function hideInline (elName) {
	var theElemenet = document.getElementById(elName);
	if (theElemenet) {
		theElemenet.style.display = "none";
	}
}
