function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}function submit_form(nm){	document.getElementById(nm).submit();}function select_list(nm){	var layer = document.getElementById(nm + '_select_layer').style;	if(layer.visibility == 'hidden'){		layer.visibility = 'visible';	} else {		layer.visibility = 'hidden';	}}function select_item(nm, val, val_nm){	document.getElementById(nm + '_select_layer').style.visibility = 'hidden';	document.getElementById('search_' + nm).value = val;	document.getElementById(nm + '_select_link').innerHTML = val_nm;}function dbitem(name,path){	this.name = name // nice user visible catagory name	this.path = path // fully hidden database path which may be ids}function loadcats(myselector){	if(items.length){		var upath=document.getElementById('LocationPath' + myselector).value;		var pp=upath.split("/");		var ulvl=pp.length-1;		if (upath=="") ulvl = -1;		var mysel=new Array;		for (var i=0 ; i < 4;i++){			mysel[i] = document.getElementById('Location' + myselector + i);			mysel[i].options.length = 0;//clear array			mysel[i].options[mysel[i].options.length] = new Option("SELECT","xxxxx",0,1);			mysel[i].style.visibility = "hidden";			mysel[i].style.display = "none";		}		var dbg="";		for (var i=0 ; i < items.length;i++){			var obj=items[i];			var p= obj.path			var s=p.split("/");			// make a short path with last level missing			var sp=p.split("/");			if (sp.length>0) sp.length--;			var spath=sp.join("/");				var dblvl=s.length-1;			if (dblvl <= ulvl+1){				if (upath.indexOf(spath)==0){  // -1 is not found , 0= match from start					var sel;					if (dblvl == ulvl){						sel= (upath==p)?1:0;					}else{						sel= (upath.indexOf(p+"/")==0)?1:0;					}					if (upath=="") sel=0;					var nm = s[s.length-1];// last item in array					dbg += "upath=" + upath+ "  add name="+obj.name+"  value="+nm+"  path="+obj.path+ " sel="+sel+"\n";					mysel[dblvl].options[mysel[dblvl].options.length] = new Option(obj.name,nm,0,sel);					mysel[dblvl].style.visibility = "visible";					mysel[dblvl].style.display = "block";				}			}		}	}}function chg_cat(selta, obj, lvl){	var upath = document.getElementById('LocationPath' + selta).value;	var pp = upath.split("/");	pp[lvl] = obj.options[obj.selectedIndex].value;  // VALUE IS NOT WHAT YOU SEE IN THE DROP DOWN IT IS THE VALUE=""	pp.length = lvl + 1;	document.getElementById('LocationPath' + selta).value = pp.join('/');	loadcats(selta);}function do_search(site_url){	var search_box = document.getElementById('keywords');	var search_layer = document.getElementById('search_layer');	var search_iframe = document.getElementById('search_output');		set_layer(search_box, search_layer, -122, 20);	search_layer.style.visibility = "visible";	search_iframe.src = site_url + "widgets/search.php?keywords=" + search_box.value;	if(!search_box.value) search_layer.style.visibility = "hidden";}// Height checker to adjust on resultsfunction check_iframe_height(n){	var search_iframe = document.getElementById('search_output');		if(n < 1) n = 1;	search_iframe.height = (n * 80);	if(search_iframe.height < 100) search_iframe.height = 110;}var txt = '...searches as you type';function search_box(state){	var search_box = document.getElementById('keywords');	if((state == 1) || (search_box.value == '')) search_box.value = txt;	if((state == 2) && (search_box.value == txt)) search_box.value = '';}function clear_search(){	var search_box = document.getElementById('keywords');	var search_layer = document.getElementById('search_layer');		search_layer.style.visibility = "hidden";	search_box.value = txt;}function change_price(idx){	var price_split = document.getElementById('OptionID_' + idx + '').value;	var price_me = price_split.split("%%");		var button_split = document.getElementById('buy_' + idx).src;	var button_me = button_split.split("=");	document.getElementById('buy_' + idx).src = button_me[0] + "=" + price_me[1] + "&tm=" + Math.random();}// Find layer positionfunction find_pos_x(obj){	var curleft = 0;	if (obj.offsetParent){		while (obj.offsetParent){			curleft += obj.offsetLeft			obj = obj.offsetParent;		}	}	else if (obj.x)		curleft += obj.x;	return curleft;}function find_pos_y(obj){	var curtop = 0;	if (obj.offsetParent){		while (obj.offsetParent){			curtop += obj.offsetTop			obj = obj.offsetParent;		}	}	else if (obj.y)		curtop += obj.y;	return curtop;}function set_layer(obj, lyr, xoff, yoff){	var newX = find_pos_x(obj) + xoff;	var newY = find_pos_y(obj) + yoff;	lyr.style.top = newY + 'px';	lyr.style.left = newX + 'px';}function add_to_basket(idx, site_url) {	var http_request = false;	if (window.XMLHttpRequest) { // Mozilla, Safari, ...		http_request = new XMLHttpRequest();		if (http_request.overrideMimeType) {			http_request.overrideMimeType('text/xml');		}	} else if (window.ActiveXObject) { // IE		try {			http_request = new ActiveXObject("Msxml2.XMLHTTP");		} catch (e) {			try {				http_request = new ActiveXObject("Microsoft.XMLHTTP");			} catch (e) {}		}	}	if (!http_request) {		alert('I am afraid your browser does not correctly support JavaScript, You are probably using the last version of Internet Explorer for the Mac which has been discontinued.\nPlease use an alternative browser or add products directly in the basket where this level of javascript is not required.\n\nApollogies for the inconvenience\n\nPro Audio Stash');		return false;	}	http_request.onreadystatechange = function() { alert_contents(http_request, idx); };		var price_split = document.getElementById('OptionID_' + idx + '').value;	var price_me = price_split.split("%%");	http_request.open('GET', site_url + 'includes/basket.php?ProductOptionID=' + price_me[1] + '&ProductQty=' + document.getElementById('qty_' + idx).value, true);	http_request.send(null);}function alert_contents(http_request, idx) {	if (http_request.readyState == 4) {		if (http_request.status == 200) {			if(http_request.responseText == 'done'){				 window.location.href = unescape(window.location.pathname);			} else {				document.getElementById('qty_' + idx).value = 1;				document.getElementById('buy_' + idx).src = document.getElementById('buy_' + idx).src + "&tm=" + Math.random();				document.getElementById('mini_basket').innerHTML = http_request.responseText;			}		} else {			alert('There is a problem adding this product to you basket.');		}	}}function change_contents(idx, template, detination_id) {	var http_request = false;	if (window.XMLHttpRequest) { // Mozilla, Safari, ...		http_request = new XMLHttpRequest();		if (http_request.overrideMimeType) {			http_request.overrideMimeType('text/xml');		}	} else if (window.ActiveXObject) { // IE		try {			http_request = new ActiveXObject("Msxml2.XMLHTTP");		} catch (e) {			try {				http_request = new ActiveXObject("Microsoft.XMLHTTP");			} catch (e) {}		}	}	if (!http_request) {		alert('I am afraid your browser does not correctly support JavaScript, You are probably using the last version of Internet Explorer for the Mac which has been discontinued.\nPlease use an alternative browser or add products directly in the basket where this level of javascript is not required.\n\nApollogies for the inconvenience');		return false;	}	http_request.onreadystatechange = function() { change_inner(http_request, detination_id); };	http_request.open('GET', '/includes/contents.php?template=' + template + '&id=' + idx, true);	http_request.send(null);}function change_inner(http_request, detination_id) {	if (http_request.readyState == 4) {		if (http_request.status == 200) {			if(http_request.responseText == 'done'){				 window.location.href = unescape(window.location.pathname);			} else {				document.getElementById(detination_id).innerHTML = http_request.responseText;			}		} else {			alert('There is a problem with this template.');		}	}}function toggleCheck(nm){	var e = document.getElementById(nm);	if(e.checked == ''){		e.checked = 'true';	} else {		e.checked = '';	}}var activex = ((navigator.userAgent.indexOf('Win')  != -1) && (navigator.userAgent.indexOf('MSIE') != -1) && (parseInt(navigator.appVersion) >= 4 ));var CantDetect = ((navigator.userAgent.indexOf('Safari')  != -1) || (navigator.userAgent.indexOf('Opera')  != -1));function oopsPopup() {    if((navigator.language && navigator.language.indexOf("ja") != -1) || (navigator.systemLanguage && navigator.systemLanguage.indexOf("ja") != -1) || (navigator.userLanguage && navigator.userLanguage.indexOf("ja") != -1)) {        var URLtoOpen = "http://download.skype.com/share/skypebuttons/oops/oops_ja.html";    } else {        var URLtoOpen = "http://download.skype.com/share/skypebuttons/oops/oops.html";    }	var windowName = "oops";	var popW = 540, popH = 305;	var scrollB = 'no';	w = screen.availWidth;	h = screen.availHeight;	var leftPos = (w-popW)/2, topPos = (h-popH)/2;	oopswindow = window.open(URLtoOpen, windowName,'width=' + popW + ',height=' + popH + ',scrollbars=' + scrollB + ',screenx=' +leftPos +',screeny=' +topPos +',top=' +topPos +',left=' +leftPos);	return false;}if(typeof(detected) == "undefined" && activex) {    document.write(        ['<script language="VBscript">',        'Function isSkypeInstalled()',        'on error resume next',        'Set oSkype = CreateObject("Skype.Detection")',        'isSkypeInstalled = IsObject(oSkype)',        'Set oSkype = nothing',        'End Function',        '</script>'].join("\n")    );}function skypeCheck() {    if(CantDetect) {        return true;    } else if(!activex) {        var skypeMime = navigator.mimeTypes["application/x-skype"];        detected = true;        if(typeof(skypeMime) == "object") {            return true;        } else {            return oopsPopup();        }    } else {        if(isSkypeInstalled()) {            detected = true;            return true;        }    }        detected = true;    return oopsPopup();}function loadDetection() {    if(document.getElementById && document.getElementsByTagName) {        if (window.addEventListener) window.addEventListener('load', addDetection, false);        else if (window.attachEvent) window.attachEvent('onload', addDetection);    }}function addDetection() {    var pageLinks = document.getElementsByTagName("a");    for (var i=0; i < pageLinks.length; i++) {        if(pageLinks[i].childNodes[0] && pageLinks[i].childNodes[0].src) {            if((pageLinks[i].childNodes[0].src.indexOf('download.skype.com\/share\/skypebuttons') != -1 || pageLinks[i].childNodes[0].src.indexOf('mystatus.skype.com') != -1) && (typeof(pageLinks[i].onclick) == "undefined" || pageLinks[i].onclick == null)) {                pageLinks[i].onclick = function sChk() { return skypeCheck(); }            }        }    }}loadDetection();