function checkSEO() {
    if (window.location.href == "http://www.bingoliner.co.uk/") {
        //if a seo cookie exists
        var seo;
        var seo_created;
        var set_seo = false;
        if (getCookie("LK%5FSEO") != "") {
            seo = getCookie("LK%5FSEO");
            seo_created = getCookie("LK%5FSEO%5FCREATED").replace("_", " ").replace("_", " ").replace("_", " ");
        }

        //if google seo cookie exists, check if its newer
        if (getCookie("__utmz") != "") {
            var utmzCookie = getCookie("__utmz");
            if ((utmzCookie.search("google") > 0) || (utmzCookie.search("live") > 0) || (utmzCookie.search("yahoo") > 0) || (utmzCookie.search("bing") > 0)) { //bing = msn
                seo = utmzCookie;
                seo_created = new Date();
                setCookie("LK%5FSEO", seo, 30);
                setCookie("LK%5FSEO%5FCREATED", seo_created, 30);
                if (window.location.href.search("cid=") == -1) {
                    set_seo = true;
                    setCookie("LK%5Fcid", 13052830, 30);
                    setCookie("LK%5FCID%5FCREATED", Date(), 30);
                }
            }
        }

        if ((set_seo) && (window.location.href.search("cid=") == -1)) {
            window.location.href = "http://www.bingoliner.co.uk/?cid=" + getCookie("LK%5Fcid");
        }
    }
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date()
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function getCookie(c_name)
{
	if (document.cookie.length > 0)
	{
	
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1)
		{ 
			c_start=c_start + c_name.length+1 
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end=document.cookie.length
				return unescape(document.cookie.substring(c_start,c_end))
		} 
	}
	return "";
}