// Search Logic affiliate cookie controller for hidded DIVS

var searchSTR = window.location.search.substring(1);
var Parameters = new Object();
var nameValuePairs = searchSTR.split(/&/);
var nameValuePair;
var name;
var value;
 
for (var i = 0; i < nameValuePairs.length; i++) {
    nameValuePair = nameValuePairs[i].split(/=/);
 
    name = nameValuePair[0];    
    value = nameValuePair[1];
	// document.write(name);
	
	if (name == 'SLNetwork') 
	{
	//document.write(name);
	pathname = '/';
	myDomain = 'shytobuy.co.uk';
	Set_Cookie( name, value, 1, '/', myDomain, '' );    
	}
}


// Functions
function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}
function showHideLayer(layerid,v)
{
var thelayer=document.getElementById(layerid);
thelayer.style.visibility=v;
}
function LocateCookieVal (offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
      endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}
function LocateCookie (name) {  
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
                var j = i + alen;
                if (document.cookie.substring(i, j) == arg)
                        return LocateCookieVal (j);
                i = document.cookie.indexOf(" ", i) + 1;
                        if (i == 0)
                                break;
                }
   return null;
}  
 