function clearInput(theInput){
if (theInput.defaultValue==theInput.value)
theInput.value = ""
}


function checkEmailAddress(email){

if(email.value.indexOf('@') == -1 || email.value.indexOf('@') == 0 || email.value.indexOf('.') < 2 ){

		alert("The email you gave doesn't look right - please check");
		return false;
} else {

return true;

}

}


function toggleLayer(whichLayer) {

  var elem, vis;
  if( document.getElementById )
    elem = document.getElementById( whichLayer );
  else if( document.all )
      elem = document.all[whichLayer];
  else if( document.layers )
    elem = document.layers[whichLayer];
  vis = elem.style;

  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}


function showMyPawFunEditForm(){
toggleLayer('formDisplay');
toggleLayer('formEdit');
}


function checkMyPawFunEditForm(){

return true;
}


function deleteImageConfirm(id, permalink, productType) {
var agree=confirm("Really delete this image?");
  if (agree){
  window.location = permalink+'?delete_image='+id+'&product_type='+productType;
  	return true ;
  	} else{
  	return false ;
  }
}


function deletePetConfirm(id, permalink) {
var agree=confirm("Really delete this pet?");
  if (agree){
  window.location = permalink+'?delete_pet='+id;
  	return true ;
  	} else{
  	return false ;
  }
}




function voteForIt( content_type, content_id, voter_id, blog_url, vote_value) {


var url = blog_url+"/wp-content/plugins/voting-components/add-vote.php";

document.getElementById('voteBox'+content_id+vote_value).innerHTML = "Voting...";
nocache = Math.random();

http.open("GET", url + '?content_type='+content_type+'&content_id='+content_id+'&voter_id='+voter_id+'&vote_value='+vote_value+'&nocache='+nocache, true);
http.onreadystatechange = addVoteHttpResponse;


http.send(null);
}

function addVoteHttpResponse() {

if (http.readyState == 4) {
/* php sends back the content_id */

document.getElementById('voteBox'+http.responseText).innerHTML = "Voted!";
var prevTotal = document.getElementById('voteTotalBox'+http.responseText).innerHTML;


document.getElementById('voteTotalBox'+http.responseText).innerHTML = Number(prevTotal)+1;

}
}




function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject();

