

var _g_eceDefCookieName = "_eceCartv2_" + "6888";
var _g_eceDefCookieMax = 5; 
var _g_eceDefCookieSizeMax = 4000; 
var _g_eceDefExpDate = new Date();
_g_eceDefExpDate.setTime(new Date().getTime() + (2 * 24 * 60 * 60 * 1000));

function _eceGetSubDomain()
{
    if (document.getElementById && location && location.hostname)
    {
        var _eceUseDomain = location.hostname.toLowerCase();
        var _eceUseDomainArray = _eceUseDomain.split(".");

        if (_eceUseDomainArray.length >= 2)
        {
            if (_eceUseDomainArray[_eceUseDomainArray.length - 1].length >= 2)
            {
                if (isNaN(_eceUseDomainArray[_eceUseDomainArray.length - 1]))
                {
			var _eceTmpDomainStr = _eceUseDomainArray[_eceUseDomainArray.length - 2] + "." + _eceUseDomainArray[_eceUseDomainArray.length - 1];
					
			if ((_eceUseDomainArray[_eceUseDomainArray.length - 2].length <= 2 || _eceUseDomainArray[_eceUseDomainArray.length - 2] == "com") && _eceUseDomainArray.length > 2)
				_eceTmpDomainStr = _eceUseDomainArray[_eceUseDomainArray.length - 3] + "." + _eceTmpDomainStr;
						
			return ("; domain=." + _eceTmpDomainStr);

                    	//return ("; domain=." + _eceUseDomainArray[_eceUseDomainArray.length - 2] + "." + _eceUseDomainArray[_eceUseDomainArray.length - 1]);
                }
            }
        }
    }
    
    return "";
}

function _eceGetCookie (cookieName)
{
    var retStr = "";
    if (document.cookie)
    {
        if (!cookieName)
            cookieName = _g_eceDefCookieName;
            
        var cookieArray = document.cookie.split(";")
        var nCount = 0;

        for (var n = 0; n < cookieArray.length; n++)
        {
            while(cookieArray[n].charAt(0) == ' '){cookieArray[n] = cookieArray[n].substring(1)}
            if (cookieArray[n].indexOf(cookieName) == 0)
            {
                retStr += cookieArray[n].substring(cookieName.length+1 + (nCount > 0 ? 1 : 0));
                nCount++;
            }
        }
    }

    return retStr;
}


function _eceWriteCookie (cookieValue, cookieName)
{

    if (cookieValue.length > (_g_eceDefCookieMax * _g_eceDefCookieSizeMax))
    {
        alert("Maximum cart size exceeded.");
        return "";
    }

    if (!cookieName)
            cookieName = _g_eceDefCookieName;
            
    _eceResetCart(cookieName);
            
    for (var n = 0; n < _g_eceDefCookieMax; n++)
    {
         if ( cookieValue.length > _g_eceDefCookieSizeMax)
         {
            var setCookie = cookieName + (n > 0 ? n : "") + "=" + cookieValue.substring(0, _g_eceDefCookieSizeMax);
            document.cookie = setCookie + "; expires=" + _g_eceDefExpDate.toGMTString() + "; path=/" + _eceGetSubDomain();
            cookieValue = cookieValue.substring(_g_eceDefCookieSizeMax);
         }
         else
         {
            var setCookie = cookieName + (n > 0 ? n : "") + "=" + cookieValue;
            document.cookie = setCookie + "; expires=" + _g_eceDefExpDate.toGMTString() + "; path=/" + _eceGetSubDomain();
            break;
         }
    }

    return "";
}

function _eceResetCart(cookieName)
{
    if (!cookieName)
            cookieName = _g_eceDefCookieName;
            
    var cookieArray = document.cookie.split(";")
    
    for (var n = 0; n < cookieArray.length; n++)
    {
        while(cookieArray[n].charAt(0) == ' '){cookieArray[n] = cookieArray[n].substring(1)}
        
        for (var x = 0; x < _g_eceDefCookieMax; x++)
        {
            var useCookiename = cookieName + (x > 0 ? x : "") + "=";
            if (cookieArray[n].indexOf(useCookiename) == 0)
                document.cookie = useCookiename + "" + "; expires=-1; path=/" + _eceGetSubDomain();
        }
    }
}


var _g_eceDefCartButton = "http://allbackgroundchecks.safestorefront.com/images/sample_add.jpg";
var _g_eceMerchantID = "6888";
var _g_eceCartButton = "";
var _g_ecePostAddLink = "ViewCart.aspx?m=6888";
var _g_eceDefQtyText = "Quantity:";
var _g_eceImgAltText = 'alt="' + "Add To Cart" + '"';
var _g_eceQtyText = "Quantity:";

if (!_g_eceQtyText)
    _g_eceQtyText = _g_eceDefQtyText;
    
if (_g_eceCartButton)
    _g_eceImgAltText = "";
else
    _g_eceCartButton = _g_eceDefCartButton;
    
function _eceAttributeOptionsStructure(ID, name, priceUnit, price, displayOrder, selected)
{
    this.ID = ID;
    this.name = name;
    this.priceUnit = priceUnit;
    this.price = price;
    this.displayOrder = displayOrder;
    this.selected = selected;
}

function _eceAttributeStructure(name, type, displayOrder, options)
{
    this.name = name;
    this.type = type;
    this.displayOrder = displayOrder;
    this.options = options
}

function _eceProductStructure(ID, name, description, price, shipping, attributesString, attributes)
{
    this.ID = ID;
    this.name = name;
    this.description = description;
    this.price = price;
    this.shipping = shipping;
    this.attributesString = attributesString;
    this.attributes = attributes;
}

function _eceAttributeInputStructure(ID, input)
{
    this.ID = ID;
    this.input = input;
}

var _g_eceProductArray = new Array();

_g_eceProductArray[0] = new _eceProductStructure("131474", "Single State Instant Criminal Database and SSN Validation Trace/Past Address History: $8.00 ", "Single State Instant Criminal + Sex Offender Database Search:  $8.00 Choice of one State<br> <br>Description and Sources Searched for Instant Single State Criminal Search in Kansas:<br><br>Kansas Dept of Corrections<br>Corrections records of persons convicted of felony and gross misdemeanor offenses and sentenced to serve time in a state correctional facility since 1987, or placed on probation and who have been released or paroled. Records may include Name, DOB, Race, Sex, County of Offense, Case Number, Offense Description, Statute, Disposition Date, and Level of Offense. Data is updated monthly.<br><br>Kansas Sex Offender<br>Data contains individuals registered with the Kansas Bureau of Investigations as sex offenders dating back to April 1994. These individuals have been convicted of a sex-related crime that has been classified in the state of Kansas as necessary to require registration. Search results may include Name, Date of Birth, Address, Physical Description, Registration Date, Length of Registration, Offender Type, Offense, Offense Date, Conviction Date, Victim Details, and Alias Information. Data is updated bi-weekly.<br><br>Johnson County<br>Data from Johnson County consists of Criminal, Juvenile and Traffic since 1941. Data consists of Case Number, Name, Race, Sex, DOB, Judge, Statute Code, and Sentence Information. Data is updated monthly.<br><br>Sedgwick County - Historical Data<br>Data contains criminal records dating back to 1990. Data can contain Name, Degree of Offense, File Date, Disposition Date. This source does not contain dates of birth. Due to court review, these records are currently unavailable. <br><br>Shawnee County<br>Data contains District Court felony and misdemeanor records dating back to 1985. Results may include Defendant Name, Alias, Case Number, File Date, Charge, Charge Date, Plea, Plea Date, Sentence, and Sentence Date. This file is updated monthly.<br><br>P.R.I.O.R.S.<br>Public Record Indexes of Record Searches. This database is comprised of proprietary criminal data compiled from previously ordered county, statewide and federal criminal requests, from KS, which contained records.<br><br>Sources offered:<br><br>Alabama Indiana Nebraska South Carolina Alaska Iowa Nevada South Dakota Arizona Kansas New Hampshire Tennessee Arkansas Kentucky New Jersey Texas California Louisiana New Mexico Utah Colorado Maine New York Vermont Connecticut Maryland North Carolina Virginia Delaware Massachusetts North Dakota Washington Florida Michigan Ohio Washington DC Georgia Minnesota Oklahoma West Virginia Hawaii Mississippi Oregon Wisconsin Idaho Missouri Pennsylvania Wyoming Illinois Montana Rhode Island<br> <br>*Applicant Release Form:  Required by the Fair Credit Reporting Act(FCRA) and enforced by the Federal Trade Commission(FTC) to Protect Consumers Privacy Rights.  To conduct a Pre-employment or Tenant Screening Reports this Form is mandatory to be in compliance with the FCRA and Federal and State Law.<br><br>You can download the form by copying and pasting the following link into your browser to download and print on 1 Page.<br><br>http://people-checks.com/ApplicantReleaseForm.aspx <br><br>The Form takes an average of 5 - 7 minutes for an Applicant to complete. After completion Fax the Form toll free to 1-877-777-5121 or e-mail to info@people-checks.com. After receipt of the form we will Process and send the Results to your preference of Fax or E-mail in 45 minutes.<br><br>We do not Search Social Security Numbers. Social Security Number are voluntarily given on a signed Applicant Release Form by the Applicant/Subject of the Search. ", "$8.00", "$0.00", '', new Array ());



function _eceAddToCart(itemID, itemQty, linkThrough, _ecePostAddLink, formObj, attCounter)
{
    _ecePostAddLink = unescape(_ecePostAddLink);
 
    if (itemQty.length == 0)
    {
        alert("Quantity cannot be empty.");
        return false;
    }
    else if (isNaN(itemQty))
    {
        alert("Quantity must be numeric.");
        return false;
    }
    else if (parseInt(itemQty) < 1)
    {
        alert("Quantity must be greater than 0.");
        return false;
    }
        
    var currentName = _eceGetCookie();
    var newProdArray = new Array()
    var bFound = false;
    var attribArray = new Array();
    
    if (formObj && attCounter)
    {
        for (n = 0; n < formObj.elements.length; n++)
        {
            var baseName = "a" + attCounter + "-";
            if (formObj.elements[n].name.indexOf(baseName) == 0)
            {

                switch(formObj.elements[n].type)
                {
                case "select-one":
                case "select-multiple":
                    for (var x = 0; x < formObj.elements[n].options.length; x++)
                    {
                        if (formObj.elements[n].options[x].selected)
                            attribArray[attribArray.length] = formObj.elements[n].options[x].value;
                    }
                    
                    break;
                case "radio":
                case "checkbox":
                    if (formObj.elements[n].checked)
                        attribArray[attribArray.length] = formObj.elements[n].value;
                    break;
                    
                case "text":
                case "textarea":
                    if (formObj.elements[n].value.replace(/\s/g, "").length > 0)
                    {
                        var name = formObj.elements[n].name.split("-");
                        if (name.length == 3)
                            attribArray[attribArray.length] = name[2] + "=" + escape(formObj.elements[n].value);
                    }
                    break;
                }
            }
        }
        
    }
    
    if(currentName.length > 0)
    {
        var prodArray = currentName.split(",")
        for (var n = 0; n < prodArray.length; n++)
        {
            var inputsMatch = true;
            var localFound = false;
            var item = prodArray[n].split(":")
            if (item.length == 2)
                item[2] = "";
            if (item.length == 3)
            {
                if (item[0] == itemID && item[2] == attribArray.join("&"))
                {
                    var newQty = parseInt(item[1]) + parseInt(itemQty)
                    newProdArray[newProdArray.length] = item[0] + ":" + newQty + ":" + item[2];
                    bFound = true;
                }
                else if (item[0] != 'm')
                    newProdArray[newProdArray.length] = item[0] + ":" + item[1] + ":" + item[2];
            }
        }
    }
    
    if (!bFound)
    {
        newProdArray[newProdArray.length] = itemID + ":" + itemQty + ":" + attribArray.join("&");
    }
    
    var cookie = newProdArray.join(",");
    _eceWriteCookie (cookie);
    
    //    if (document.getElementById && !_ecePostAddLink)
    //        linkThrough = false;
            
    var postAddLink = (_ecePostAddLink ? _ecePostAddLink : location.href);
        
    if (linkThrough)
        location.href = postAddLink;
    else
    {
        if (typeof(this._eceDisplayMiniCart) != 'undefined')
        {
            if (typeof(this._eceDisplayMiniCart) == 'function')
                _eceDisplayMiniCart(true);
        }
    }
}


function _eceWriteProduct(useQty, useProductInfo)
{
    var _ecePostAddLink = escape(_g_ecePostAddLink);
    
    for (var n = 0; n < _g_eceProductArray.length; n++)
    {
        document.writeln('<form method="post" name="_eceAddToCartForm' + _g_eceProductArray[n].ID + '" action="'+location.href+'" onsubmit="_eceAddToCart('+_g_eceProductArray[n].ID+', this.quantity.value, true, \''+_ecePostAddLink+'\', this, ' + (n+1) + ');return(false)">');
        document.writeln('<table cellpadding="3" cellspacing="3">');
        
        if (useProductInfo)
        {
 
            document.writeln('<tr><td align="right">' + 
                            _g_eceProductArray[n].name +
                            '</td></tr><tr><td align="right">' +
                            _g_eceProductArray[n].price +
                            '</td></tr>');
                         
 


        }
        
        document.writeln('<tr><td align="right">' +
                            _g_eceProductArray[n].attributesString +
                            '</td></tr>');
        
        if (useQty)
        {
            document.write('<tr><td align="right">');

            document.write('<b>'+_g_eceQtyText+' </b><input type="text" name="quantity" value="1" maxlength="4" size="4" />' +
                                '</td></tr><tr><td align="right"><input type="image" src="'+_g_eceCartButton+'" border="0"  '+_g_eceImgAltText+'/>');
 
   
            document.write('</td></tr>');         
        }
        else              
        {
            document.write('<tr><td align="right"><input type="image" src="'+_g_eceCartButton+'" border="0"  '+_g_eceImgAltText+'/>' + 
                            '<input type="hidden" name="quantity" value="1" /></td></tr>');
                          
        }
    
        document.writeln('</table>');
        
        document.writeln('</form>');
    }
}


