function formval(taa,tab,tac,tad,tae,taf,tag,tah,tai,taj,tak,tcons,agrt,brik,ade,amm,ayy,emlk,secu) {
  if (tab.value=="" || tac.value=="" || tad.value=="" || taf.value=="" || secu.value=="" ) {
	alert("Please fill all required fields.");
	return false; }
	
  if (agrt.checked == false) {
	alert("You must agree with our terms of service and used.");
	return false;   
  }
  
  if (emlk.value != tac.value) {
	alert("Email Mismatch! Please double check your email address and the re-type email address.");
	return false;     
  }
	
  if (brik.value.length > 600) {
	alert('Maximum of 600 characters long, please check the total count of your Brief Description characters.');
	return false; }

  marks = kaarawankoa(ade,amm,ayy);
  if (marks==0) {
	 return false
  }
document.forms['regme'].submit();
return true;
}

function formAdregT(taa,tab,tac,tad,tae,taf,tag,tah,tai,taj,tak,tal,tcons,agrt,emlk) {
  if (taa.value=="" || tab.value=="" || tac.value=="" || tad.value=="" || taf.value=="" || tag.value=="" || taj.value=="" || tak.value=="" || tal.value=="") {
	alert("Please fill all required fields.");
	return false; }
	
  if (agrt.checked == false) {
	alert("You must agree with our terms of service and used.");
	return false;   
  }
  
  if (emlk.value != tac.value) {
	alert("Email Mismatch! Please double check your email address and the re-type email address.");
	return false;     
  }
  
  if (tak.value.length > 200) {
	alert('Maximum of 600 characters long, please check the total count of your Text Ad characters.');
	return false; }
	
  if (tae.length <= 0) {
	//alert("Choose at least one of the following wine preference.");
	//return false; 
  }

  if (tai.length <= 0) {
	//alert("Choose at least one of the following type of user.");
	//return false; 
  }

document.forms['regme'].submit();
return true;
}

function formAdBack(retro) {
document.forms['regme'].stRetry.value = 'yes';
document.forms['regme'].submit();
return true;
}

function formAdreg(taa,tab,tac,tad,tae,taf,tag,tah,tai,taj,tak,tal,tcons,agrt,secu) {
  if (taa.value=="" || tab.value=="" || tac.value=="" || tad.value=="" || taj.value=="" || tak.value=="" || tal.value=="" || secu.value=="" ) {
	alert("Please fill all required fields.");
	return false; }
	
  if (agrt.checked == false) {
	alert("You must agree with our terms of service and used.");
	return false;   
  }

document.forms['regme'].submit();
return true;
}

function moreCondi(trsa,selObj,restore){
  var slt = selObj.options[selObj.selectedIndex].value;
  if (slt=="") { return false;}
  if (slt!="") {
document.forms['viewtop'].valvoka.value = slt; 
document.forms['viewtop'].valtyp.value = trsa; 
document.forms['viewtop'].submit();
return true;
  }
  
}


function kaarawankoa (tdd, tmm, tyy) {
 today = new Date();
 dateStr = today.getDate();
 monthStr = today.getMonth();
 yearStr = today.getFullYear();
  
 toryy = (yearStr-tyy.value);
 tormm = (monthStr-tmm.value);
 tordd = (dateStr-tdd.value);
 
 if (tormm < 0 || (tormm==0 && tordd < 0)) {
 toryy = toryy-1;
 }
 
 if (toryy <= 20) {
	 mans = 0;
	 alert('Your underage ('+toryy+' yrs old). Please check your birthday, you age must be 21 and above');
 } else {
	 mans = 1;
 }
return mans;
}

function formvalt(taa,tab,tac,tad,tae,taf,tag,tah,tai,taj,tak,tcons,brik,ade,amm,ayy) {
  if (tab.value=="" || tac.value=="" || tad.value=="" || taf.value=="" || tah.value=="" || tai.value=="" || taj.value=="" || tak.value=="" ) {
	alert("Please fill all required fields.");
	return false; }
	

  if (brik.value.length > 600) {
	alert('Maximum of 600 characters long, please check the total count of your Brief Description characters.');
	return false; }
	
  marks = kaarawankoa(ade,amm,ayy);
  if (marks==0) {
	 return false
  }
  
document.forms['regme'].submit();
return true;
}


function postWine(taa,tab,tac,tad,tae,taf,tag,tah,tai,taj,tak,tal,tam,tank) {
  if (taa.value=="" || tab.value=="" || tad.value=="" || tae.value=="" || tag.value=="" || tai.value=="" || tak.value=="" || tank.value=="") {
	alert("Please fill all required fields.");
	return false; }

  if (tab.value=='0') {
	  if (tac.value=='') { 
	  alert("Please fill Other Type fields.");
	  return false; }
  }
  
  if (tae.value=='0') {
	  if (taf.value=='') { 
	  alert("Please fill Wine Region fields.");
	  return false; }
  }
	
  if (tag.value=='0') {
	  if (tah.value=='') { 
	  alert("Please fill Vineyard fields.");
	  return false; }
  }
	
  if (tad.value.length > 600) {
	alert('Maximum of 600 characters long, please check the total count of your Description characters.');
	return false; }
	
  if (tam.value.length > 600) {
	alert('Maximum of 600 characters long, please check the total count of your Tasting Note characters.');
	return false; }
	
document.forms['postwine'].submit();
return true;
}

function gagoka (trk, tra, idka) {
	if (trk.value=='0') {
		tra.disabled=false;
		document.getElementById(idka).style.display = "block";
	} else {
		tra.disabled=true;
		document.getElementById(idka).style.display = "none";
	}
	return true;
}


function formcons(tab,tac,tad,tae,cap) {
  if (tab.value=="" || tac.value=="" || tad.value=="" || tae.value=="" || cap.value=="") {
	alert("Please fill all fields.");
	return false; }
document.forms['emailfrm'].submit();
return true;
}

function postcellar(tab,tac,tad) {
  //if (tab.value=="" || tac.value=="" || tad.value=="") {
	//alert("Please fill all fields.");
	//return false; }
document.forms['pcellar'].submit();
return true;
}

function loginmenu(usrval,passval) {
  if (usrval.value=="" || passval.value=="") {
	return false; }

document.forms['logintop'].submit();
return true;
}

function rateWine(rid,valz) {
  if (rid.value=="" || valz.value=="") {
	return false; }

document.forms['rate'].submit();
return true;
}

function archivmsg() {
document.msglist.mana.value=1;
document.msglist.submit();
}

function delmsg() {
document.msglist.mana.value=0;
document.msglist.submit();
}

function forUp(upls) {
  if (upls.value=="") {
	return false; }

document.forms['uplods'].submit();
return true	
}


function remmsg() {
if (!confirm("Are you sure you want to permanent delete this records?")) {return false;}
document.msglist.mana.value=2;
document.msglist.submit();
}

function blogsend(ids,valb,valc) {
  if (valb.value=="" || valc.value=="") {
	alert('Please complete all the fields.');
	return false; }

document.forms['blogm'].submit();
return true;
}

function msgSendj(vala,valb,valc) {
  if (vala.value=="" || valb.value=="" || valc.value=="") {
	alert('Please complete all the fields.');
	return false; }

document.forms['sendmsg'].submit();
return true;
}

function commentAlrt(rid,valz) {
  if (rid.value=="" || valz.value=="") {
	alert('Please complete the fields.');
	return false; }

document.forms['comment'].submit();
return true;
}

var xmlHttp;

function cellaraddsa(rid,valz,urlv,idvid) {
xmlHttp=GetXmlHttpObject();
  if (valz.value=="") {
	alert('Please complete the fields.');
	return false; }
	
var postvars = "wid=" + encodeURI(valz.value);
var mysesid = Math.random()*5;
var ssid = Math.random()*6;
var url= urlv+'/'+ssid;

xmlHttp.onreadystatechange= function () {
if (xmlHttp.readyState==4) { 
document.getElementById(rid).style.display = "block";
document.getElementById(idvid).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", postvars.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(postvars);

}

function revcellajax(rid,valz,urlv,idvid,vala,valb,valc,vald,vale,valf,valg) {
xmlHttp=GetXmlHttpObject();
  if (rid=="" || valz.value=="" || vala.value=="" || valb.value=="" || valc.value=="" || vald.value=="") {
	alert('Please complete the fields.');
	return false; }
  if (valz.value.length > 600) {
	alert('Maximum of 600 characters long, please check the total count of your comment characters.');
	return false; }
var vartis = '';
for(var x=0; x < vald.length; x++)  {
if(vald[x].checked == true) {
vartis = vald[x].value;
}
}

var postvars = "comment=" + encodeURI(valz.value) + "&idv=" + encodeURI(rid) + "&bottles=" + encodeURI(vala.value) + "&locmo=" + encodeURI(valb.value) + "&ratemo=" + encodeURI(valc.value) + "&pripot=" + encodeURI(vartis) + "&ddd=" + encodeURI(vale.value) + "&mmm=" + encodeURI(valf.value) + "&yyy=" + encodeURI(valg.value);
var mysesid = Math.random()*5;
var ssid = Math.random()*6;
var url= urlv+'/'+ssid;

xmlHttp.onreadystatechange= function () {
if (xmlHttp.readyState==4) { 
document.getElementById(idvid).innerHTML=xmlHttp.responseText;
document.getElementById('qbottle-'+rid).innerHTML=vala.value;
}
}

xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", postvars.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(postvars);

}

function revajaxchk(rid,valz,urlv,idvid) {
xmlHttp=GetXmlHttpObject();
  if (rid=="" || valz.value=="") {
	alert('Please complete the fields.');
	return false; }
  if (valz.value.length > 600) {
	alert('Maximum of 600 characters long, please check the total count of your comment characters.');
	return false; }
	
var postvars = "comment=" + encodeURI(valz.value) + "&id=" + encodeURI(rid);
var mysesid = Math.random()*5;
var ssid = Math.random()*6;
var url= urlv+'/'+ssid;

xmlHttp.onreadystatechange= function () {
if (xmlHttp.readyState==4) { 
document.getElementById(idvid).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", postvars.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(postvars);

}

function revajaxchkB(rid,valz,urlv,idvid) {
xmlHttp=GetXmlHttpObject();
  if (rid=="" || valz.value=="") {
	alert('Please complete the fields.');
	return false; }
  if (valz.value.length > 600) {
	alert('Maximum of 600 characters long, please check the total count of your comment characters.');
	return false; }
	
var postvars = "comment=" + encodeURI(valz.value) + "&id=" + encodeURI(rid);
var mysesid = Math.random()*5;
var ssid = Math.random()*6;
var url= urlv+'/'+ssid;

xmlHttp.onreadystatechange= function () {
if (xmlHttp.readyState==4) { 
document.getElementById('qbottle-'+rid).innerHTML=valz.value;
document.getElementById(idvid).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", postvars.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(postvars);

}

function emailSfnd(rid,valz,vald,vals,urlv,idvid) {
xmlHttp=GetXmlHttpObject();
  if (valz.value=="" || vald.value=="" || vals.value=="") {
	alert('Please complete all the fields.');
	return false; }
  if (valz.value.length > 600) {
	alert('Maximum of 600 characters long, please check the total count of your message characters.');
	return false; }
	
var postvars = "msgko=" + encodeURI(valz.value) + "emailto=" + encodeURI(vald.value) + "emailfr=" + encodeURI(vals.value) + "&id=" + encodeURI(rid);
var mysesid = Math.random()*5;
var ssid = Math.random()*6;
var url= urlv+'/'+ssid;

xmlHttp.onreadystatechange= function () {
if (xmlHttp.readyState==4) { 
document.getElementById(idvid).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", postvars.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(postvars);

}

function msgAlrt(rid,valz,vala,valb,urlv,idvid) {
xmlHttp=GetXmlHttpObject();
  if (rid.value=="" || valz.value=="") {
	alert('Please fill the message field. ');
	return false; }

  if (valz.value.length > 700) {
	alert('Maximum of 700 characters long, please check the total count of your message characters.');
	return false; }
	
var postvars = "msgkoto=" + encodeURI(valz.value) + "&msgto=" + encodeURI(vala.value) + "&msgsubject=" + encodeURI(valb.value) + "&id=" + encodeURI(rid);
var mysesid = Math.random()*5;
var ssid = Math.random()*6;
var url= urlv+'/'+ssid;

xmlHttp.onreadystatechange= function () {
if (xmlHttp.readyState==4) { 
document.getElementById(idvid).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", postvars.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(postvars);

}

function wincellarTab(ilink,idname,urlv) {
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Your browser does not support AJAX!");
return;
} 
var ssid = Math.random()*6;
var url= urlv+'/'+ssid;
document.getElementById(ilink).style.display = "none";
document.getElementById(idname).style.display = "block";
document.getElementById(idname).innerHTML="Loading...";
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
document.getElementById(idname).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

function msgTool(ids,idname,urlv) {
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Your browser does not support AJAX!");
return;
} 
var ssid = Math.random()*6;
var url= urlv+'/'+ssid;
if (idname=='viewerbox') {
document.getElementById('rreply').style.display = "none";	
}
document.getElementById('ontis-'+ids).style.fontWeight="normal"
document.getElementById(idname).style.display = "block";
document.getElementById(idname).innerHTML="Loading...";
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
document.getElementById(idname).innerHTML=xmlHttp.responseText;
ToggleTinyMCEEditors();
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

function reviewDel(ids,idname,urlv) {
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Your browser does not support AJAX!");
return;
} 
var ssid = Math.random()*6;
var url= urlv+'/ss'+ssid;

document.getElementById(idname).style.display = "block";
document.getElementById(idname).innerHTML="Loading...";
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
document.getElementById(idname).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

function cellarEdit(ids,idname,urlv) {
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Your browser does not support AJAX!");
return;
} 
var ssid = Math.random()*6;
var url= urlv+'/ss'+ssid;

	if(document.getElementById){ 
	var el = document.getElementById(idname);
	var ar = document.getElementById("mycellar").getElementsByTagName("div");
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="mycelleditbar") {
				ar[i].style.display = "none"; 
				ar[i].innerHTML='';
				}
			}
			el.style.display = "block"; 
		}else{ 
			el.style.display = "none";
		}
	}

document.getElementById(idname).style.display = "block";
document.getElementById(idname).innerHTML="Loading...";
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
document.getElementById(idname).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);



}

function revstEdit(ids,idname,urlv) {
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Your browser does not support AJAX!");
return;
} 
var ssid = Math.random()*6;
var url= urlv+'/ss'+ssid;

	if(document.getElementById){ 
	var el = document.getElementById(idname);
	var ar = document.getElementById("myreview").getElementsByTagName("div");
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="editrevbox") {
				ar[i].style.display = "none"; 
				ar[i].innerHTML='';
				}
			}
			el.style.display = "block"; 
		}else{ 
			el.style.display = "none";
		}
	}

document.getElementById(idname).style.display = "block";
document.getElementById(idname).innerHTML="Loading...";
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
document.getElementById(idname).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

function reviewEdit(ids,idname,urlv) {
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Your browser does not support AJAX!");
return;
} 
var ssid = Math.random()*6;
var url= urlv+'/ss'+ssid;

document.getElementById(idname).style.display = "block";
document.getElementById(idname).innerHTML="Loading...";
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
document.getElementById(idname).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

function showlist(idname,sid,typ,urlv) {
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null) {
alert ("Your browser does not support AJAX!");
return;
} 
var ssid = Math.random()*6;
var url= urlv+'/'+ssid;

if (typ==1) {
document.getElementById('hide-'+sid).style.display = "none";
document.getElementById('show-'+sid).style.display = "inline";
document.getElementById(idname).style.display = "none";
} else {
document.getElementById('hide-'+sid).style.display = "inline";
document.getElementById('show-'+sid).style.display = "none";
document.getElementById(idname).style.display = "block";
document.getElementById(idname).innerHTML="Loading...";
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
document.getElementById(idname).innerHTML=xmlHttp.responseText;
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

}

function GetXmlHttpObject() {

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlHttp = false;
  }
 }
@end @*/
if (!xmlHttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlHttp = new XMLHttpRequest();
	} catch (e) {
		xmlHttp=false;
	}
}
if (!xmlHttp && window.createRequest) {
	try {
		xmlHttp = window.createRequest();
	} catch (e) {
		xmlHttp=false;
	}
}
return xmlHttp;
}

function chkBx(sss,rrr) {
var krb = sss.length;
var krz = sss;
if (rrr.checked == true) {
  for (var i = 0; i <= krb; i++){
  krz[i].checked = true;
  }
}

if (rrr.checked == false) {
  for (var i = 0; i <= krb; i++){
   krz[i].checked = false;
  }
}
}


