//<!--
var Widgets_baseurl="http://www.wine-searcher.com/widgets";
function ws_widgets_addLoadEvent(func){
	var oldonload = window.onload;   
	if (typeof window.onload != 'function') {   
	 window.onload = func;   
	} else {   
	 window.onload = function() {   
	   if (oldonload) {   
		 oldonload();   
	   }   
	   func();   
	  }   
	}   
  }   
function ws_avg_sendrequest(divid,winename,vintage,location,state,cy,displayName,isIP,  ismax,ismin ){
	ws_widgets_addLoadEvent(function() {   ws_avg_append(divid,winename,vintage,location,state,cy,displayName,isIP,  ismax,ismin ) }) ;
 } 
function ws_avg_append(divid,winename,vintage,location,state,cy,displayName,isIP,  ismax,ismin ){
	var url = Widgets_baseurl;
	url+='/average-price/ws_average_price.php';
	url=url +"?mod=Json&divid="+divid+"&winename="+winename +"&vintage="+vintage +"&location="+location+"&state="+state+"&cy="+cy+"&displayName="+displayName+"&isIP="+isIP+"&ismax="+ismax+"&ismin="+ismin ;
	this.scriptObj = document.createElement("script");
	this.scriptObj.setAttribute("type", "text/javascript");
	this.scriptObj.setAttribute("charset", "iso-8859-1");
	this.scriptObj.setAttribute("src", url);
	document.body.appendChild(this.scriptObj);
} 
function ws_avg_showData(data) {
	var nameid;
	var pid;
	thisid=data.divid;
	nameid=thisid;
	pid=thisid + "p"; 
	
    var nameField =
	   document.getElementById(nameid) ;	 
    if (nameField != null)     
		if( (nameField.innerHTML).replace(/\s+/g,"") == "")						
			nameField.innerHTML =data.vin.replace(/&amp;/g,"&").replace(/&/g,"&amp;").replace(/&amp;#/g,"&#"); 
			
	document.getElementById(pid).innerHTML ='&#160;('+ data.price.replace(/&#128;/g,"&#8364;") +')'; 
	 
 }	 
//-->  
