function verifySearch () {
    if (document.search.searchstring.value == "") {
        alert("Please enter a word to search for!");
        document.search.searchstring.focus();
        return false;
    }

    if (document.search.searchstring.value.length < 2) {
        alert("Please provide at least two (2) characters!");
        document.search.searchstring.focus();
        return false;
    }

    return true;
}

function bookmarksite(title, url){
  if (document.all)
    window.external.AddFavorite(url, title);
  else if (window.sidebar)
    window.sidebar.addPanel(title, url, "")
}


function toggle( targetId ) {
   if ( document.getElementById ) {
    target = document.getElementById( targetId );
    if ( target.style.display == "none" ) {
     target.style.display = "";
    } else {
     target.style.display = "none";
    }
   }
}

function OnViewMerch( merch_idchar) {
	document.dealform.action = "/coupons_and_deals/" + merch_idchar;
	document.dealform.submit();	
	return true;
}

function myOpenWin(url,name) {
  winfeat = "location=1,directories=1,resizable=1,status=1,menubar=1,scrollbars=1,toolbar=1,top=5,left=5";
  owin = window.open(url,name,winfeat);
  if (window.focus) {owin.focus();}
  return true;
}

function myOpenPopup(url,popstyle) {
  var myWidth=512; var myHeight=384;  
  winfeat = "location=1,directories=1,resizable=1,status=1,menubar=1,scrollbars=1,toolbar=1,width="+myWidth+",height="+myHeight+",top=5,left=5";
  owin = window.open(url,"preload",winfeat);
  //if (window.focus) {self.focus();} old style
  if ((popstyle == 1) && (window.focus)) {self.focus(); } 
  if (popstyle == 2)  {owin.focus(); }
  return true;
}

function myClosePopup() {
  return true;
  winfeat = "location=1,directories=1,resizable=1,status=1,menubar=1,scrollbars=1,toolbar=1,top=5,left=5,width=1,height=1";
  window.open("/closepopup.html", "preload", winfeat);
  return true;
}

function vote(merch_idchar, vote) {
  //newloc = window.location.href+"&r="+vote;
  var conf = confirm("Please confirm your rating of "+vote+" out of 5 ");
  if (conf) {
    newloc = "/coupons_and_deals/"+merch_idchar+"&r="+vote;
    window.location.href=newloc;
    return true;
  } else {
    return false;
  }
}