function sendComment(form)
{
    
    if (!isValidComment(form))
        return false;
    var formInputs=extractFormInputs(form);
	var feedBack=document.getElementById('feedBack');
	if (feedBack && feedBack!="undefined")
		feedBack.innerHTML="<img src='images/loading2.gif' border=0/>";
    AJAXPost("ajaxcommon.php", commentCallBack, formInputs);
    return false;
}

function sendRecommendation(form)
{
    
    if (!isValidRecommendation(form))
        return false;
    var formInputs=extractFormInputs(form);
	var feedBack=document.getElementById('feedBack');
	if (feedBack && feedBack!="undefined")
		feedBack.innerHTML="<img src='images/loading2.gif' border=0/>";
    AJAXPost("ajaxcommon.php", recommendCallBack, formInputs);
    return false;
}

function extractFormInputs(form)
{
    var elements=form.elements;
    var delimiter="";
    var result="";
    for (i=0; i<elements.length; i++)
    {
        result+=delimiter+elements[i].name+"="+elements[i].value;
        delimiter="&";
    }
    return result;
}

function isEmpty(myValue)
{
    if (typeof myValue=="object")
    {
        if (myValue.value==null || trim(myValue.value)=='') 
            return true;
    }
    else if (typeof myValue=="string")
        {
            if (myValue==null || trim(myValue)=='')
                return true;
        }
    return false;
}

function trim(text)
{
    var re=/\s/g;
    return text.replace(re, '');
}
function isEmail(email) 
{
    var re=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/i
    return re.test(email);
}

function openPopUp(url, width, height, options)
{
    
    if (!options)
        options='toolbar=0, menubar=0, location=0, scrollbars=1, resizable=0';

    var bestLeft=(screen.availWidth-width)/2;
    var bestTop=(screen.availHeight-height)/2;
    options+=", left= "+bestLeft+", top="+bestTop;
   myWindow=window.open ( url,'rsnpPopup','width='+width+',height='+height+','+options );
   myWindow.focus();
}

