function showResults(str,sortedby,alignment,reviewID)
{
if (!sortedby){
	var sortedby = "producer";
}
if (!alignment){
	var alignment = "ASC";
}
if(!reviewID){
	var reviewID = "none";
}

var theData;
if (str.length == 0)
{
  theData = "action=reset";
}else if(document.getElementById("CountrySelection")){
  c = document.getElementById("CountrySelection").value;
  r = document.getElementById("RegionSelection").value;
  p = document.getElementById("ProducerSelection").value;
  w = document.getElementById("WineSelection").value;
  v = document.getElementById("VintageSelection").value;
  pu = document.getElementById("PublicationSelection").value;
  s = document.getElementById("ScoreSelection").value;
  d = document.getElementById("DateSelection").value;
  theData = "action="+str+"&cou="+c+"&reg="+r+"&pro="+p+"&win="+w+"&vin="+v+"&pub="+pu+"&sco="+s+"&dat="+d+"&sort="+sortedby+"&ascDes="+alignment+"&reviewID="+reviewID+"&ignoreMe=" + new Date().getTime();;
}

$("#reviewSection").slideUp("fast");
$.ajax({
	method: "post",url: "display.php",data: theData,
	beforeSend: function(){$("#loading").show("fast");}, //show loading just when link is clicked
	complete: function(){ $("#loading").hide("fast");}, //stop showing loading when the process is complete
	success: function(html){ //so, if data is retrieved, store it in html
		if(str == "submit") { $("#reviewSection").show("slow"); } //animation
		else { $("#reviewSection").show("fast"); } //animation
		$("#reviewSection").html(html); //show the html inside .content div
	}
}); //close $.ajax(
}

function noCache(){
var l=CreateEl("meta"), m=CreateEl("meta");
l.setAttribute("HTTP-EQUIV","Expires");
l.setAttribute("CONTENT","Tue, 01 Jan 1980 1:00:00 GMT");

m.setAttribute("HTTP-EQUIV","Pragma");
m.setAttribute("CONTENT","no-cache");

document.getElementsByTagName("head")[0].appendChild(l);
document.getElementsByTagName("head")[0].appendChild(m);
}


function updateReviews(str)
{
var action;
var theData = "action=updateReview&ignoreMe=" + new Date().getTime();
  if (str.length > 0)
  {
	  theData = theData + "&producer=" + str;
  }
  $.ajax({
	method: "post",url: "display.php",data: theData,
	success: function(html){ //so, if data is retrieved, store it in html
		$("#addReview").html(html); //show the html inside .content div
	}
  }); //close $.ajax(

}

function modifyReviews(str, producer)
{
var action;
var theData = "action=modifyReview&ignoreMe=" + new Date().getTime();
if (!producer)
{
	producer = '';
}
  if (str.length > 0)
  {
	  theData = theData + "&reviewID=" + str;
  }
  if(producer.length > 0)
  {
	  theData = theData + "&producer=" + producer;
  }
  $.ajax({
	method: "post",url: "display.php",data: theData,
	success: function(html){ //so, if data is retrieved, store it in html
		$("#modifyReview").html(html); //show the html inside .content div
	}
  }); //close $.ajax(

}

function updateLink(str)
{
var action;
if (window.XMLHttpRequest)
  {
    // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {
    // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("theLink").innerHTML=xmlhttp.responseText;
    }
  }
  if (str.length == 0)
  {
    xmlhttp.open("GET","display.php?action=displayLink",true);
    xmlhttp.send();
  }else{
//	alert("creating   : display.php?action=displayLink&myLink="+str);
	xmlhttp.open("GET","display.php?action=displayLink&path="+str,true);
	xmlhttp.send();
  }
}

function whatsVisible(producer)
{
var theData = "ignoreMe=" + new Date().getTime();
if (!producer)
{
	producer = 'none';
}
  theData = theData + "&producer=" + producer;
  $.ajax({
	method: "post",url: "whatsVisible.php",data: theData,
	success: function(html){ //so, if data is retrieved, store it in html
		$("#whatsVisible").html(html); //show the html inside .content div
	}
  }); //close $.ajax(

}

