// JavaScript Document

function email_addr(name,isLink,otherName) {
	var host = "bizbuysell.com"
    var email = name + "@" + host;
    var linktext = email;   // text to display within link
    if (otherName) {
        linktext = otherName;
        isLink = 1;  // only makes sense for live link
    }
    if ( isLink ) document.write("<a href=\"mailto:" + email + "\">");
    document.write(linktext);
    if ( isLink ) document.write("</a>");
    document.close();
}

function convEM(sUser,sSubj){
  var sDom = "bizbuysell%23com";
  if (sSubj == null) {
  return("mail"+"to:"+sUser+"@"+sDom.replace(/%23/g,"."));
  	} else {
  return("mail"+"to:"+sUser+"@"+sDom.replace(/%23/g,".")+"?Subject="+sSubj);  
  }
}

function VerifyData(form,field) {

	
	/* check if the email address field is empty */
	var CheckEmptyEmail = form.field.value
	
	if (CheckEmptyEmail == null || CheckEmptyEmail == "")
		{
		alert("Please enter your Email Address");
		form.email.focus();
		return false
		}

		
/* The validation process determines if the email 
is less than 9 characters. If so, then it sets 
the return variable to true indicating a failed 
validation. It also adds the appropriate message 
to the existing message string. */
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
		if (CheckEmptyEmail.length < 9)  {
			alert("Please enter a valid Email Address");
			form.email.focus();
			return false
			}
		}

		
/* Next, we check for the existence of the @ character */
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
 	    var charA = CheckEmptyEmail.indexOf("@");
		if (charA == -1)  {
			alert("Please enter a valid Email Address");
			form.email.focus();
			return false
			}
		}

	
/* Once it has been determined that there is an 
@ character, the validation process checks to see if 
it is it more than two characters in from the left 
side of the string. */	
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
 	    var charA = CheckEmptyEmail.indexOf("@");		
			if (charA < 2 )  {
			alert("Please enter a valid Email Address");
			form.email.focus();
			return false
			}
		}

		
/* The check continues to determine if a . (period) 
exists. It begins the search from the right side of 
the string. */
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
		var charP = CheckEmptyEmail.lastIndexOf(".");
		if (charP == -1)  {
			alert("Please enter a valid Email Address");
			form.email.focus();
			return false
			}
		}


/* Now that we have a . (period), is it at
the proper place at the end of the string. */
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
		var charP = CheckEmptyEmail.lastIndexOf(".");
		if (charP != CheckEmptyEmail.length - 3 && charP != CheckEmptyEmail.length - 4 && charP != CheckEmptyEmail.length - 5)  {
			alert("Please enter a valid Email Address");
			form.email.focus();
			return false
			}
		}


/* Okay, now that we have both the @ and . (period)
characters, are they separated by at least two characters? */
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
		var charP = CheckEmptyEmail.lastIndexOf(".");

			if (charP < charA + 3)  {
			alert("Please enter a valid Email Address");
			form.email.focus();
			return false
			}
		}


	return true
}

<!-- Begin
function emailCheck (emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	alert("Email address seems incorrect (check @ and .'s)")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert("The username doesn't seem to be valid.")
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!")
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The domain name doesn't seem to be valid.")
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert("The address must end in a three-letter domain, or two letter country.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
   alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}
//  End -->

function FSBOViewAd()
	{
		if(document.viewad.q.value=='')
		{ alert("Please enter the Ad Number"); return false; }
		return true;
	}
	
function FSBOViewAdcheck() {
    if (FSBOViewAd())
        document.viewad.submit();
}


//FSBO entry screen script Page 1 - highlight rows when rodio button checked/unchecked
function changeTypeTableBG(id, BGColor, BGColorOff) {
	var IDValue = 'FSBOTypeTableBG'+id;
	var identity1 = document.getElementById(IDValue);
	var identity2 = document.getElementById(IDValue+"t");
	identity1.style.backgroundColor = BGColor;
	identity2.style.backgroundColor = BGColor;
	
	var allRadioButs = document.getElementsByName("PF")
	var allRadioButsID = document.getElementById("PF"+id)
	//alert(allRadioButsID.value);
	if (identity1 && allRadioButsID) {
		allRadioButsID.checked = true;
	}
	
		for (var i=0;i<allRadioButs.length;i++) {	
			//alert (allRadioButs[i].value)
			if (allRadioButs[i].value != 2) {				
				if (allRadioButs[i].checked == false) {
					var IDValue1 = 'FSBOTypeTableBG'+allRadioButs[i].value;	
					//alert(IDValue1);
					var identity3 = document.getElementById(IDValue1);
					var identity4 = document.getElementById(IDValue1+"t");
					identity3.style.backgroundColor = BGColorOff;
					identity4.style.backgroundColor = BGColorOff;
				}
			}			
		}

}

function changeTableBG(id, BGColor, BGColorOff) {
	var IDValue = 'FSBOTypeTableBG'+id;
	var identity1 = document.getElementById(IDValue);
	var identity2 = document.getElementById(IDValue+"t");
	identity1.style.backgroundColor = BGColor;
	identity2.style.backgroundColor = BGColor;
	identity1.style.cursor = "pointer";
	identity2.style.cursor = "pointer";

	
	var allRadioButs = document.getElementsByName("PF")
	
		for (var i=0;i<allRadioButs.length;i++) {	
			//alert (allRadioButs[i].value)
			if (allRadioButs[i].value != 2) {				
				if (allRadioButs[i].value == id) {
				
					if (allRadioButs[i].checked == false) {
						var IDValue1 = 'FSBOTypeTableBG'+allRadioButs[i].value;	
						//alert(IDValue1);
						var identity3 = document.getElementById(IDValue1);
						var identity4 = document.getElementById(IDValue1+"t");
						identity3.style.backgroundColor = BGColorOff;
						identity4.style.backgroundColor = BGColorOff;
					} else {
						identity1.style.backgroundColor = BGColor;
						identity2.style.backgroundColor = BGColor;
					}
				}
			}
		}

}

function SBAaspnetFormLoginHP()
	{
		if (!(false) && !(false))
		{
			if(document.aspnetForm.email.value != ''){document.aspnetForm.email.style.backgroundImage='none'};
			if(document.aspnetForm.password.value != ''){document.aspnetForm.password.style.backgroundImage='none'};			
		}
	}

function ShowSBAPopup(elementId) {
	//alert("ShowSBAPopup elementId " + elementId); 
	var BbsSBAPopBasic1 = document.getElementById(elementId);
	BbsSBAPopBasic1.style.visibility = "visible";
}

function CloseSBAPopup(elementId) {
	//alert("CloseSBAPopup elementId " + elementId); 
	var BbsSBAPopBasic1 = document.getElementById(elementId);
	BbsSBAPopBasic1.style.visibility = "hidden";
}

// Removing sFIR -BT 04/07/09 (WI #7385)
/*
var myriadProSemiBold = {
  src: '/flash/myriadProSemiBold_v8.swf'
};

var myriadProLight = {
  src: '/flash/myriadProLight_v8.swf'
};

sIFR.activate(myriadProSemiBold); // From revision 209 and onwards
sIFR.activate(myriadProLight);

sIFR.replace(myriadProLight, {
  selector: '.Title_bd'
  ,wmode: 'transparent'
  ,css: {
	  '.sIFR-root': { 'color': '#3f7abd', 'font-size': '18.3px', 'font-weight': 'bold' }
	  }
  ,tuneHeight: '0'
  ,offsetTop: '0'
});
sIFR.replace(myriadProLight, {
  selector: '.Title_lt'
  ,wmode: 'transparent'
  ,css: {
	  '.sIFR-root': { 'color': '#3f7abd', 'font-size': '18.3px', 'font-weight': 'normal' }
	  }
  ,tuneHeight: '0'
  ,offsetTop: '0'
});
sIFR.replace(myriadProLight, {
  selector: '.Title_bd_sm'
  ,wmode: 'transparent'
  ,css: {
	  '.sIFR-root': { 'color': '#3f7abd', 'font-size': '16.12px', 'font-weight': 'bold' }
	  }
  ,tuneHeight: '0'
  ,offsetTop: '0'
});
sIFR.replace(myriadProLight, {
  selector: '.Title_lt_sm'
  ,wmode: 'transparent'
  ,css: {
	  '.sIFR-root': { 'color': '#3f7abd', 'font-size': '16.12px', 'font-weight': 'normal' }
	  }
  ,tuneHeight: '0'
  ,offsetTop: '0'
});
sIFR.replace(myriadProLight, {
  selector: '.Title_bold'
  ,wmode: 'transparent'
  ,css: {
	  '.sIFR-root': { 'color': '#384c7e', 'font-size': '20.0px', 'font-weight': 'bold' }
	  }
  ,tuneHeight: '0'
  ,offsetTop: '0'
});
sIFR.replace(myriadProLight, {
  selector: '.Title_bold_sm'
  ,wmode: 'transparent'
  ,css: {
	  '.sIFR-root': { 'color': '#384c7e', 'font-size': '16.12px', 'font-weight': 'bold' }
	  }
  ,tuneHeight: '0'
  ,offsetTop: '0'
});
sIFR.replace(myriadProLight, {
  selector: '.fsboConf_TitleHeaderName'
  ,wmode: 'transparent'
  ,css: {
	  '.sIFR-root': { 'color': '#384c7e', 'font-size': '20.3px', 'font-weight': 'bold' }
	  }
  ,tuneHeight: '0'
  ,offsetTop: '0'
});
*/