function lite(obj) {
 if(document.all&&!window.opera) {
  obj.filters.blendTrans.apply();
  obj.filters.blendTrans.play();
 }
}
function ExplorerFix()
{
for (a in document.links) document.links[a].onfocus =
document.links[a].blur;
}
if (document.all)
{
document.onmousedown = ExplorerFix;
}
if (top != self) top.document.title = document.title;
defaultStatus= document.title;
function goto_URL(object) {
    window.location.href = object.options[object.selectedIndex].value;
}

defaultStatus="Bartletts HiFI - contact us... it's worth it!";

function basketoption(form) {
  if (form.sku.selectedIndex == 0) {
    alert('Select an option');
    return false;
  }
  return true;
}

function regular(string) {
    if (!string) return false;
    var Chars = "0123456789";
    for (var i = 0; i < string.length; i++) {
       if (Chars.indexOf(string.charAt(i)) == -1)
	   
          return false;
    }
    return true;
} 
if( top.location != location )
    top.location.href = location.href;
	function getLabelForId(id) {
    var label, labels = document.getElementsByTagName('label');
    for (var i = 0; (label = labels[i]); i++) {
        if (label.htmlFor == id) {
            return label;
        }
    }
    return false;
}
function checkEmail() {
    var email = document.getElementById('email');
    var label = getLabelForId('email');
    if (email.value.indexOf('@') == -1 || email == '') { // Naive check for non empty string with @ sign
        label.className = 'problem';
    } else {
        label.className = 'completed';
    }
}
function checkPhone() {
    var phone = document.getElementById('phone');
    var label = getLabelForId('phone');
    var digits = phone.value.replace(/[^0-9]/ig, '');
    if (!digits) {
        label.className = '';
        phone.value = '';
        return;
    }
    if (digits.length == 10) {
        phone.value = '(' + digits.substring(0, 3) + ') ' + 
            digits.substring(3, 6) + '-' + 
            digits.substring(6, 10);
        label.className = 'completed';
    } else {
        label.className = 'problem';
        phone.value = digits;
    }
}
function checkRequired(id) {
    var formfield = document.getElementById(id);
    var label = getLabelForId(id);
    if (formfield.value.length == 0) {
        label.className = 'problem';
    } else {
        label.className = 'completed';
    }
}
addEvent(window, 'load', function() {
    var input;
    var inputs = document.getElementsByTagName('input');
    for (var i = 0; (input = inputs[i]); i++) {
        addEvent(input, 'focus', oninputfocus);
        addEvent(input, 'blur', oninputblur);
    }
    var textareas = document.getElementsByTagName('textarea');
    for (var i = 0; (textarea = textareas[i]); i++) {
        addEvent(textarea, 'focus', oninputfocus);
        addEvent(textarea, 'blur', oninputblur);
    }
});
function oninputfocus(e) {
    /* Cookie-cutter code to find the source of the event */
    if (typeof e == 'undefined') {
        var e = window.event;
    }
    var source;
    if (typeof e.target != 'undefined') {
        source = e.target;
    } else if (typeof e.srcElement != 'undefined') {
        source = e.srcElement;
    } else {
        return;
    }
    /* End cookie-cutter code */
    source.style.border='2px solid #000';
}
function oninputblur(e) {
    /* Cookie-cutter code to find the source of the event */
    if (typeof e == 'undefined') {
        var e = window.event;
    }
    var source;
    if (typeof e.target != 'undefined') {
        source = e.target;
    } else if (typeof e.srcElement != 'undefined') {
        source = e.srcElement;
    } else {
        return;
    }
    /* End cookie-cutter code */
    source.style.border='1px solid #000';
}
function addEvent(obj, evType, fn){
    if (obj.addEventListener){
        obj.addEventListener(evType, fn, true);
        return true;
    } else if (obj.attachEvent){
        var r = obj.attachEvent("on"+evType, fn);
        return r;
    } else {
        return false;
    }
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}



/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}



