//Ajax Functions
function rateUp(uid,cid,update){
	$(update).innerHTML='updating';
	var url = 'user.functions.php?method=rate';   
	var data = 'uid='+uid+'&cid='+cid+'&rating=1';
	var myAjax = new Ajax.Updater({success: update},url,{method: 'post', parameters: data});
}

function rateDn(uid,cid,update){
	$(update).innerHTML='updating';
	var url = 'user.functions.php?method=rate';   
	var data = 'uid='+uid+'&cid='+cid+'&rating=-1';
	var myAjax = new Ajax.Updater({success: update},url,{method: 'post', parameters: data});
}

function deleteComment(cid){
	if(confirm("Are you sure you wish to FOREVER DELETE this comment?")){
		var url = 'user.functions.php?method=deleteComment';   
		var data = 'cid='+cid;
		var myAjax = new Ajax.Request(url,{method: 'post', parameters: data});
		return true;
	} else {
		return false;
	}
}

function ss(w,id){window.status=w;return true;}
function cs(){window.status='';}

function installExtension() {
	if(checkBrowser()) {
		InstallTrigger.install({'SiteSays Web Comments':'http://releases.mozilla.org/pub/mozilla.org/extensions/sitesays_web_comments/sitesays_web_comments-1.0.3-fx.xpi'});
	}
	return true;
}

function checkBrowser(){
  // check the browser
  if (navigator.userAgent.match(/Firefox\/1\.5/)) {
    return true;
  } else if (navigator.userAgent.match(/Firefox/)) {
    if (confirm("You are using an unsupported version of Firefox.\n\n" + 
		"Would you like to get the latest version?")) {
      // User wants to download newest Firefox
      window.location.href = "http://www.mozilla.org/products/firefox/";
    }
  } else {
    // This browser isn't Firefox.
    if (confirm("The SiteSays Extension requires Firefox 1.5 or later.\n\n" +
		"Would you like to get the latest version of Firefox?")) 
      window.location.href = "http://www.mozilla.org/products/firefox/";
  }
	return false; // don't post the form
}

function validateSearch(){
	var q = document.getElementById('q');
	if(q.value=="") { 
		alert("Please enter something to search on. Thanks!"); 
		return false; 
	} else {
		return true;
	}
}
