function newwindow(url, w, h)
{
    var width = screen.availWidth*.8;
    var height = screen.availHeight*.7;
    if(w>0) width = w;
    if(h>0) height = h;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
    var windowFeatures = "width=" + width + ",height=" + height + ",status=0,resizable=1,scrollbars=1,toolbar=0,location=0,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
    myWindow = window.open(url, "subWind", windowFeatures).focus();
}
 function trim(value) {
    if(value==undefined) return '';
    value = value.replace(/^\s+/,'');
  value = value.replace(/\s+$/,'');
  return value;
}
function goto_url(url)
{
    alert(url);
    document.location.href=url; 
}
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
function fadeOut(query)
{
    $j(query).each(function(){
        if($j(this).css('display')!='none')
            $j(this).fadeOut();
    })
}
function checkEmptyFocusIn(event)
{
        if($j(this).hasClass('empty'))
        {
            $j(this).removeClass('empty');
            $j(this).val('');
        }
    
}
function checkEmptyFocusOut(event)
{
        if($j(this).val()=='')
        {
            $j(this).addClass('empty');
            $j(this).val($j(this).attr('name'));
        }
}
function checkEmail(val)
{
    var emailfilter =  /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 
    return emailfilter.test(val);
}
function isNumberKey(evt)
{
  var charCode = (evt.which) ? evt.which : event.keyCode
  if (charCode != 46 && charCode > 31 
    && (charCode < 48 || charCode > 57))
     return false;

  return true;
}
