    function setCookie(c_name,value,exdays) {
        var exdate=new Date();
        exdate.setDate(exdate.getDate() + exdays);
        var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
        document.cookie=c_name + "=" + c_value;
    }

    function getCookie(c_name)
    {
        var i,x,y,ARRcookies=document.cookie.split(";");
        for (i=0;i<ARRcookies.length;i++) {
            x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
            y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
            x=x.replace(/^\s+|\s+$/g,"");
            if (x==c_name) {
                return unescape(y);
            }
        }
    }
    
    function GoToSignUpPage() {
        setCookie('home_competition', 'false', 1095);
        window.location = "http://kappa.ecommzone.com/lz/HEMEL/005TJC/06cee91217dc37a1c04e76235a3baefb3a/home.htm";
    }
    
    function ClosePopupDoNotShowAgain() {
        setCookie('home_competition', 'false', 1095);
        $('#fade , #popuprel').fadeOut();
    }

    function ClosePopup() {
        $('#fade , #popuprel').fadeOut();
    }

if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)) {
	// don't show on iphone, ipad and ipod
}
else {
    // check if we should show popup
    var show_pop = getCookie("home_competition");
    if (show_pop==null || show_pop!='false') {
        setCookie('home_competition', 'false', 60);
        $(document).ready(function() {                                    
            var popupid = 'popuprel';
            $('#' + popupid).fadeIn();
            $('body').append('<div id="fade"></div>');
            $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();
            var popuptopmargin = ($('#' + popupid).height() + 10) / 2;
            var popupleftmargin = ($('#' + popupid).width() + 10) / 2;
            $('#' + popupid).css({'margin-top' : -popuptopmargin, 'margin-left' : -popupleftmargin});
            $('#fade').click(function() {
            $('#fade , #popuprel').fadeOut()
            return false;
            });
        });
    }
}
