// cases-direct.co.uk

var ref = document.referrer;
var domain = document.domain;
//alert("ref " + ref + " domain " + domain);
if (ref == "")
{
	// no referrer
	//alert("no referrer");
}
else if (ref.indexOf(domain) > 0)
{
	// this is a reference within the site
	//alert("same site");
	//SetCookie("referringURL",ref,0) 

}
else
{
	// this is a reference from outside the site
	//alert("from site" + ref);
	SetCookie("referringURL",ref,0) 
}


var pathname = location.pathname;
//alert(pathname);
if (pathname == "/index.html" || pathname == "/" || pathname == "//")
{
	//do nowt
}
else if (parent.frames.length==0) 
{
	redraw()
//	top.document.location = "../loader.php#" + location.pathname
}

function redraw ()
{
top.document.clear()
document.write("<html><head>");
document.write("<title>The Roof Box Company: sales and hire of Thule roof boxes, Autoform, Fapa, Kamei and Karrite roofboxes, roof bars, bike carriers, and other car and travel accessories</title>");
document.write("<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>");
document.write("</HEAD>");


var search = location.search;
var pathname = location.pathname;
//alert(pathname)
leftpathname = "../left.html";
if (pathname == "/left.html" || pathname == "/top.html")
{
	location.pathname="/";
	return true;
	leftpathname = "../left.html";
	pathname = "/main.html"

}
if (pathname == "")
{
	pathname = "../main.html"
}
else
{
	pathname = "../" +  pathname + search
}
//alert(pathname)
//alert(leftpathname)


document.write('<frameset rows="100,*" frameborder="NO" border="0" framespacing="0" cols="*" >'); 
document.write('<frame name="topFrame" scrolling="NO" noresize src="../top.html" >');
document.write('<frame name="caseFrame" src="' + pathname + '">');
document.write('</frameset>');

document.write('</frameset></HTML>')

}



function SetCookie(cookieName,cookieValue,nDays) 
{
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString()
                 + ";path=/";
}
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return "";
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

