﻿try {document.execCommand('BackgroundImageCache', false, true);} catch(e) {}

var root = "" //"/miracleshopper"
var se = "/search/?q=-/-/-/"

cp = cp.toLowerCase();
var cm = cp;
if(cm == 'my list'){cm = 'blank'; cp = "list";}
else if(cm == 'home' || cm == ''){cm = 'home'; cp = "home";}
else if(cm == 'see all'){cm = 'blank'; cp = "all";} 
else if(cm == 'consumer electronics'){cm = 'electronics'; cp = cm;}
else if(cm == 'ebay'){cm = 'ebay'; cp = "ebay";} 
else if(cm == 'clothing and accessories') { cm = 'clothing'; cp = cm;}
else if(cm == 'health and beauty') { cm = 'health'; cp = cm;}
else if(cm == 'kids and family' || cm == 'toys and games') { cm = 'kids'; cp = cm;}
else if(cm == 'sports and fitness') { cm = 'sports'; cp = cm;}
else if(cm == 'video games') { cm = 'electronics'; cp = cm;}
else if(cm == 'jewellery and accessories') { cm = 'cars'; cp = cm;}
else if(cm == 'wine and gifts') { cm = 'sports'; cp = cm;}
else if(cm == 'home and garden' || cm == 'media') { cm = 'athome'; cp = cm;}

function ra(str,from,to) {var idx = str.indexOf(from); var dup = 0; while ( idx > -1 ) {if(dup+1 == idx) {str = str.replace(from,"");}else{str = str.replace(from,to);}dup = idx;idx = str.indexOf(from);}return str;}

try{document.getElementById(cp + "_tab").className = "mstab-s"}catch(e){}
try{document.getElementById(cm + "_submenu").style.display = "block"}catch(e){document.getElementById("blank_submenu").style.display = "block"}


function FSearch() {
    var temp = "";
    try{temp = document.getElementById('MSH_sBox').value;}catch(e){try{temp = document.getElementById('SB_sBox').value;}catch(e){}}
    if(temp == "") {return false;}
}

function CaptureKey() {
    if(event.keyCode==13) {
        try{document.getElementById('MSH_sbtn').click();}catch(e){try{document.getElementById('SB_sbtn').click();}catch(e){}}
        return false;
    }
}

function opener(url, target) {
    if(target == "buyit") window.open(url,'buyit');
    else window.location.href = url;
}

var inter; 
function ie(){ return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;}

function SliderOut() {
    window.onscroll = null;
    document.getElementById("la").style.display = "none";
    clearInterval(inter);
}

function PageSlider(title) {
    var dv = document.getElementById("la")
    dv.innerHTML = title
    dv.style.left = "0px";
    
    if(typeof window.pageYOffset == "number")dv.style.top = parseInt(window.pageYOffset) + "px";
    else dv.style.top = ie().scrollTop; 
    
    try{
        window.onscroll = function (e) {
            if(typeof pageYOffset == "number") dv.style.top = parseInt(window.pageYOffset) + "px";
            else dv.style.top = ie().scrollTop;
        }
    }catch(e){
        dv.style.top = "0px";
    }
    
    dv.style.display = "block";
    inter = setInterval("SliderOut()", 4000);
}

function SetList(title, url) {
    PageSlider("<b>Adding To List...</b><br />" + title);    
    if(url == "") url = window.location.href;
    createCookie(title, title + "|" + url, 365);
    return false;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = ra(name,"'","")+"="+ra(value,"'","")+expires+"; path=/";
}
