// JavaScript Document<!--userAgent = window.navigator.userAgent;browserVers = parseInt(userAgent.charAt(userAgent.indexOf("/")+1),10);function newImage(arg) {	if (document.images) {		rslt = new Image();		rslt.src = arg;		return rslt;	}}function findElement(n,ly) {	if (browserVers < 4)		return document[n];	var curDoc = ly ? ly.document : document;	var elem = curDoc[n];	if (!elem) {		for (var i=0;i<curDoc.layers.length;i++) {			elem = findElement(n,curDoc.layers[i]);			if (elem) return elem;		}	}	return elem;}function changeImages() {	if (document.images) {		var img;		for (var i=0; i<changeImages.arguments.length; i+=2) {			img = null;			if (document.layers) {				img = findElement(changeImages.arguments[i],0);			}			else {				img = document.images[changeImages.arguments[i]];			}			if (img) {				img.src = changeImages.arguments[i+1];			}		}	}}function MM_jumpMenu(targ,selObj,restore){ //v3.0  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");  if (restore) selObj.selectedIndex=0;}function reorder() {  document.generic_form.submit();}function winefilter(selection) {    reorder();}function MM_preloadImages() { //v3.0  var d=document;  if(d.images){    if(!d.MM_p) d.MM_p=new Array();    var i,j=d.MM_p.length,a=MM_preloadImages.arguments;    for(i=0; i<a.length; i++) {      if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}    }  }}function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr;  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document;  if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);  }  if(!(x=d[n])&&d.all) x=d.all[n];  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n);  return x;}function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments;  document.MM_sr=new Array;  for(i=0;i<(a.length-2);i+=3) {   if ((x=MM_findObj(a[i]))!=null) {     document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];   }  }}function MM_openBrWindow(theURL,winName,features) { //v2.0  window.open(theURL,winName,features);}function check_insert(type) {  document.generic_form.action += '&action=ins';  document.generic_form.submit();}function check_update(type) {  if ( document.generic_form.id.selectedIndex < 0 ) {    alert('Select a row first!');  } else {    document.generic_form.action += '&action=upd&id=' + document.generic_form.id[document.generic_form.id.selectedIndex].value;    document.generic_form.submit();  }}function check_delete(type) {  if ( document.generic_form.id.selectedIndex < 0 ) {    alert('Select a row first!');  } else {    if (confirm("Are you sure you want to delete")) {	if ( typeof document.generic_form.id.selectedIndex == 'undefined' ) {	  document.generic_form.action += '&action=del&id=' + document.generic_form.id.value;	} else {	  document.generic_form.action += '&action=del&id=' + document.generic_form.id[document.generic_form.id.selectedIndex].value;	}	document.generic_form.submit();    }  }}function do_popup(url, l_width, l_height, l_scroll){  if (document.all)    var xMax = screen.width, yMax = screen.height;  else    if (document.layers)      var xMax = window.outerWidth, yMax = window.outerHeight;    else      var xMax = 640, yMax=480;  var xOffset = (xMax - l_width)/2, yOffset = (yMax - l_height)/2;  var details = 'location=0,status=0,scrollbars='+l_scroll+',width='+l_width+',height='+l_height+',';  details = details + 'screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset;  window.open(url,'title',details);}function check_wine_form(){	if ( document.generic_form.winename.value == '') {	    alert('You must enter a wine name!');	    return FALSE;	}	if ( document.generic_form.year.value == '') {	    alert('You must enter a year for the wine!');	    return FALSE;	}	if ( document.generic_form.countryId.options[document.generic_form.countryId.selectedIndex].value == '0') {	    alert('You must select an country!');	    return FALSE;	}	if ( document.generic_form.regionId.options[document.generic_form.regionId.selectedIndex].value == '0') {	    alert('You must select an region!');	    return FALSE;	}	if ( document.generic_form.typeId.options[document.generic_form.typeId.selectedIndex].value == '0') {	    alert('You must select an type!');	    return FALSE;	}	if ( document.generic_form.varietyId.options[document.generic_form.varietyId.selectedIndex].value == '0') {	    alert('You must select an variety!');	    return FALSE;	}	if ( document.generic_form.price.value == '') {	    alert('Price must not be blank!');	    return FALSE;	}	if ( document.generic_form.shortdesc.value == '') {	    alert('Short description must not be blank!');	    return FALSE;	}	if ( document.generic_form.longdesc.value == '') {	    alert('Long description must not be blank!');	    return FALSE;	}	document.generic_form.submit();}function check_country_form(){	if ( document.generic_form.countryname.value == '') {	    alert('You must enter a value for the country name!');	    return FALSE;	}	document.generic_form.submit();}function check_region_form(){	if ( document.generic_form.countryId.options[document.generic_form.countryId.selectedIndex].value == '0') {	    alert('You must select an country name in the lookup!');	    return FALSE;	}	if ( document.generic_form.regionname.value == '') {	    alert('You must enter a value for the region name!');	    return FALSE;	}	document.generic_form.submit();}function check_type_form(){	if ( document.generic_form.typename.value == '') {	    alert('You must enter a value for the type!');	    return FALSE;	}	document.generic_form.submit();}function check_variety_form(){	if ( document.generic_form.varietyname.value == '') {	    alert('You must enter a value for the variety!');	    return FALSE;	}	document.generic_form.submit();}function check_price_form(){	if ( document.generic_form.price.value == '') {	    alert('You must enter a value for the price!');	    return FALSE;	}	document.generic_form.submit();}function check_blackboard_form(){	if ( document.generic_form.blackboardname.value == '') {	    alert('You must enter a value for the blackboard name!');	    return FALSE;	}	if ( document.generic_form.shortdesc.value == '') {	    alert('You must enter a value for the short description!');	    return FALSE;	}	document.generic_form.submit();}function check_case_form(){	if ( document.generic_form.casename.value == '') {	    alert('You must enter a value for the case promotion name!');	    return FALSE;	}	if ( document.generic_form.wineId.options[document.generic_form.wineId.selectedIndex].value == '0') {	    alert('You must select an wine in the lookup!');	    return FALSE;	}	if ( document.generic_form.shortdesc.value == '') {	    alert('You must enter a value for the short description!');	    return FALSE;	}	document.generic_form.submit();}function check_review_form(){	if ( document.generic_form.wineId.options[document.generic_form.wineId.selectedIndex].value == '0') {	    alert('You must select an wine in the lookup!');	    return FALSE;	}	if ( document.generic_form.review.value == '') {	    alert('You must enter a value for the review!');	    return FALSE;	}	document.generic_form.submit();}function check_user_form(){	if ( document.generic_form.username.value == '') {	    alert('You must enter a value for the username!');	    return FALSE;	}	if ( document.generic_form.psswd.value == '') {	    alert('You must enter a value for the password!');	    return FALSE;	}	if ( document.generic_form.psswd.value == document.generic_form.username.value) {	    alert('username and password cannot be the same!');	    return FALSE;	}	if ( document.generic_form.psswd.length < 6) {	    alert('password must be more than six characters!');	    return FALSE;	}	document.generic_form.submit();}function bookmark(url, title){  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {	window.external.AddFavorite(url,title);  } else {	alert('Sorry this is not supported in Netscape. Press CTRL-D.')  }}function do_search(){	if ( document.search_form.listingtypename.selectedIndex > 0 ) {document.search_form.page.value = document.search_form.listingtypename.options[document.search_form.listingtypename.selectedIndex].value;	}	document.search_form.submit();}function hideshowsearch(){  if (document.search_form.listingtypename.options[document.search_form.listingtypename.selectedIndex].text == 'Sales' ) {     document.search_form.salespricefrom.style.display = 'inline';     document.search_form.salespriceto.style.display = 'inline';     document.search_form.letpricefrom.style.display = 'none';     document.search_form.letpriceto.style.display = 'none';     //reset to zero so search works if they have already looked for rentals     document.search_form.letpricefrom.selectedIndex = 0;     document.search_form.letpriceto.selectedIndex = 0;  } else {     document.search_form.salespricefrom.style.display = 'none';     document.search_form.salespriceto.style.display = 'none';     document.search_form.letpricefrom.style.display = 'inline';     document.search_form.letpriceto.style.display = 'inline';     //reset to zero so search works if they have already looked for rentals     document.search_form.salespricefrom.selectedIndex = 0;     document.search_form.salespriceto.selectedIndex = 0;  }}// Declaring required variablesvar digits = "0123456789";// non-digit characters which are allowed in phone numbersvar phoneNumberDelimiters = "()- ";// characters which are allowed in international phone numbers// (a leading + is OK)var validWorldPhoneChars = phoneNumberDelimiters + "+";// Minimum no of digits in an international phone no.var minDigitsInIPhoneNumber = 10;function isInteger(s){   var i;    for (i = 0; i < s.length; i++)    {        // Check that current character is number.        var c = s.charAt(i);        if (((c < "0") || (c > "9"))) return false;    }    // All characters are numbers.    return true;}function stripCharsInBag(s, bag){   var i;    var returnString = "";    // Search through string's characters one by one.    // If character is not in bag, append to returnString.    for (i = 0; i < s.length; i++)    {        // Check that current character isn't whitespace.        var c = s.charAt(i);        if (bag.indexOf(c) == -1) returnString += c;    }    return returnString;}function checkInternationalPhone(strPhone){ s=stripCharsInBag(strPhone,validWorldPhoneChars); return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);}function echeck(str){	var at="@"	var dot="."	var lat=str.indexOf(at)	var lstr=str.length	var ldot=str.indexOf(dot)	if (str.indexOf(at)==-1){ return false; }	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false; }	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false; }	if (str.indexOf(at,(lat+1))!=-1){ return false; }	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false; }	if (str.indexOf(dot,(lat+2))==-1){ return false; }	if (str.indexOf(" ")!=-1){ return false; }	return true;}//-->//-->// Set up the image files to be used.var theImages = new Array() // do not change this// To add more image files, continue with the// pattern below, adding to the array.theImages[0] = 'images/shop1.gif'theImages[1] = 'images/shop2.gif'theImages[2] = 'images/shop3.gif'theImages[3] = 'images/shop1.gif'var j = 0var p = theImages.length;var preBuffer = new Array()for (i = 0; i < p; i++){   preBuffer[i] = new Image()   preBuffer[i].src = theImages[i]}var whichImage = Math.round(Math.random()*(p-1));function showImage(){document.write('<img src="'+theImages[whichImage]+'">');}


function search_selected() {
  if ( document.search_form.search.value == "Search wine by name..." ) { document.search_form.search.value = ''; }
  document.search_form.search.className='searchtext_on';
}

//-->