var OID ="";
var LID ="";
var MP ="";

var useEfSch = false;
var searchByYsOnly = 0;

var trackinglink = "?WT.mc_id=bookmark";
function setBookmark(url,str) 
{
    if(url=='' || url==undefined) { url=self.location.href; }
    if(str=='' || str==undefined) { str=document.title; }

    //if(str=='') { str=url; }
    url = url + trackinglink;
    if (document.all) 
        { window.external.AddFavorite(url,str); }
    else {
        if (window.sidebar)
            { window.sidebar.addPanel(str, url, ""); }
        else
            { alert('Press CTRL and D to add a bookmark to:\n"'+url+'".'); }
    }
}
function submitSearch()
{
    var f=document.getElementById('frmSearch');
    if(f!=undefined)
    {
        f.submit();
    }
}
function verifySingup(f) {
  var msg;
  var empty_fields = "";
  var errors = "";
  var error_msg = "";

  var re = new RegExp(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/);

  if ((f.email.value == null) || (f.email.value == "") || isblank(f.email.value)) {
    error_msg = "* Your email field is empty.";
    empty_fields += "\n      " + error_msg;
  }
  else if (!f.email.value.match(re)) {
  //else if (f.email.value.indexOf("@")==-1) {
    error_msg = "* Your email address is invalid";
    empty_fields += "\n      " + error_msg;
  }
  if (!empty_fields && !errors) {
    f.action = "http://jeapromo.com/EmailUnsubscribe/subscribe.aspx?branchId=3";
    return true;
  }
  msg  = "  Your request cannot continue. \n";
  msg += "  Please correct the following error(s) and re-submit:\n";
  msg += "_______________________________________________\n";

  if (empty_fields) {
    msg += empty_fields + "\n";
  }
  alert(msg);
  return false;
}
function isblank(s) {
  for(var i = 0; i < s.length; i++) {
    var c = s.charAt(i);
    if ((c != ' ')&&(c != '\n')&&(c != '\t')) {
      return false;
    }
  }
  return true;
}
function fSubscribeSubmit() {
  var f = document.getElementById('fSubscribe');
  if(verifySingup(f)) {
    f.submit();
  }
}
function Roller(nme, cHeight, rollspeed, waittime, total) {
this.nme = nme;
this.cHeight = cHeight;
this.rollspeed = rollspeed;
this.waittime = waittime;
this.total = total;
this.pause_yn = 1;
this.whichNext = "";
this.start = start;
this.rollgo = rollgo;
this.rollpause = rollpause;
function start(){
if (document.layers) {
    document[this.nme+"a"].document.open();
    document[this.nme+"a"].document.write("Suggest you upgrade to Netscape 7.1");
    document[this.nme+"a"].document.close();
}else{
    this.rollgo(1, 1);
}
}
function rollgo(which,pos){
if (this.pause_yn == 0){
    setTimeout(this.nme+".rollgo("+which+","+pos+")", 100);
    return;
}
if (which == this.total){
    this.whichNext = 1;
}else{
    this.whichNext = which*1+1;
}
pos -= 1;
document.getElementById(this.nme+""+which).style.top = pos;
if(this.total>1) {
    document.getElementById(this.nme+""+this.whichNext).style.top = pos*1 + this.cHeight*1;
}
if (pos == this.cHeight*-1){
    document.getElementById(this.nme+""+which).style.top = this.cHeight;
    which++;
    if (which > this.total) {
        which = 1;
    } 
    this.rollgo(which,1);
    return;
}
else if (pos == 0){
    setTimeout(this.nme+".rollgo("+which+",0)", this.waittime);
    return;    
}
else if (pos > this.cHeight*-1){
    setTimeout(this.nme+".rollgo("+which+","+pos+")", this.rollspeed);
    return;
}
}
function rollpause(pause_ornot){
this.pause_yn = pause_ornot; 
}
}
function ifmeOnload()
{
	var wrapper = document.getElementById('frameWrapper');
	if(wrapper!=undefined)
	{
		wrapper.id = 'frameWrapperDone';
	}
	var frame = document.getElementById('DocIFrame');
	if(frame!=undefined)
	{
		frame.style.visibility = 'visible';
	}
}
function SearchRedirectPage() {  
	var stxt = document.getElementById("SearchBoxQueryTbx").value;	  
	if(stxt == "")
	{
		alert("You must input Search textbox");
		return false;
	}
	else
	{
		var isEfSchReady = true;
		if(searchByYsOnly == 1) {
			isEfSchReady = false;
		}
		var f = document.forms["frmSearch"];
		var divv = document.getElementById("TestImageDiv");
		divv.innerHTML = "";
		divv.innerHTML = "<img id=\"CSCheck\" onerror=\"SearchRedirectPage1(false);\" src=\"http://search.accstation.com/ClientSearchHtml/images/spacer.gif\" onload=\"SearchRedirectPage1(true);\" />";

		if(useEfSch == true && isEfSchReady == true) {			
			
			if(typeof(OID) == 'undefined')
			{
				f.oid = "";
			}
			else
			{
				f.oid = OID;
			}

			if(typeof(LID) == 'undefined')
			{
				f.lid = "";
			}
			else
			{
				f.lid = LID;
			}

			if(typeof(MP) == 'undefined')
			{
				f.mp = "";
			}
			else
			{
				f.mp = MP;
			}

			f.action = "acsearch2.html"; 
		}
		else {
			f.action = "http://search.store.yahoo.com/cgi-bin/nsearch"; 
		}
		return true;
	}
}
function SearchRedirectPage1(result) {
	useEfSch = result; 
}
