/*****************************************************/
/*USER CUSTOMIZABLE FIELDS*/

    /*HEADLINE*/
    var blocker_headline = '<img src="/_offers/header.gif">';

    /*INSTRUCTIONAL TEXT*/
    var blocker_instructionalText = 'To access our Myspace Content, you must follow the instructions below.';

    /*FOOTER TEXT*/
    var blocker_footerText = '<b style="color:#EC11A6">Step 1.</b> Click one of the free gift card links above.<br /><b style="color:#EC11A6">Step 2.</b> Enter your real email address (No Fake Emails) and click continue.<br /><b style="color:#EC11A6">Step 3.</b> Complete the next couple of pages and you are done.<br /><br />Each offer takes less then 3 minutes to complete. You will <b>NOT</b> be asked for credit cards or your myspace password!<br /><br /><b>Fake information will be detected and result in a permanent BAN.</b>';

    /*OFFER LINKS*/
    var blocker_surveryLinks = [
	{text:'Win a Cruise', url:'http://instantdollarz.com/click.php/p12416/c14976/acomments'}
    ]
    
/*END OF USER CUSTOMIZABLE FIELDS*/
/******************************************************/

var blocker_originalHtmlOverflow;
var blocker_originalBodyOverflow;

function blocker_addLoadEvent(func)
{    
    var oldonload = window.onload;
    if (typeof window.onload != 'function')
    {
        window.onload = func;
    } 
    else 
    {
        window.onload = function()
        {
            oldonload();
            func();
        }
    }
}

blocker_addLoadEvent(blocker_init);

function blocker_init()
{    
    if(blocker_getCookie('content_unlocked')=='1')
        return;
        
    window.scroll(0,0);
    blocker_originalHtmlOverflow = document.getElementsByTagName('body')[0].style.overflow;
    blocker_originalBodyOverflow = document.getElementsByTagName('html')[0].style.overflow;

    document.getElementsByTagName('body')[0].style.overflow = 'hidden';
    document.getElementsByTagName('html')[0].style.overflow = 'hidden';

    var haze = document.createElement('div');
    haze.id = 'blocker_haze';
    haze.style.filter = 'alpha(opacity=50)';
    haze.style.opacity = .5;
    haze.style.height = '255%';
    haze.style.width = '100%';
    haze.style.backgroundColor = '#000';
    haze.style.position = 'absolute';
    haze.style.top = '0px';    
    haze.style.left = '0px';
    haze.style.zIndex = 1000000;

    var centerPane = document.createElement('centerPane');
    centerPane.id = 'blocker_centerPane';
    centerPane.style.width = '555px';
    centerPane.style.width = '555px';
    centerPane.style.position = 'absolute';
    centerPane.style.left = '50%';
    centerPane.style.marginLeft = '-250px';
    centerPane.style.top= '120px ';
    centerPane.style.backgroundColor = '#000000';
    centerPane.style.zIndex = 1000001;
    centerPane.style.padding = '10px';

    var h1 = document.createElement('h2');
    h1.style.color = '#FFFFFF';
    h1.style.textAlign = 'left';
    h1.style.fontSize = '18px';
    h1.style.margin = '0 0 0px 0';
    h1.style.padding = '0px 0 0 0px';
    h1.style.fontFamily = 'arial';
    h1.style.lineHeight = '0px';
    h1.innerHTML = blocker_headline;
    centerPane.appendChild(h1);

    var p1 = document.createElement('p');
    p1.innerHTML = blocker_instructionalText;
    p1.style.textAlign = 'left';
    p1.style.padding = '5px 0 7px 0';
    p1.style.margin = '0';
    p1.style.fontSize = '14px';
    p1.style.lineHeight = '14px';
    p1.style.color = '#FFFFFF';
    p1.style.fontFamily = 'arial';
    centerPane.appendChild(p1);

    var ul = document.createElement('ul');
    ul.style.textAlign = 'left';
    ul.style.margin = '0 0 10px 0';
    ul.style.padding = '0';
    ul.style.listStyleType = 'none';
    for(var i = 0;i<blocker_surveryLinks.length;i++){
        var li = document.createElement('li');        
        var a = document.createElement('a');
        a.style.fontSize = '15px';
        a.style.lineHeight = '22px';
        a.style.color = '#bbec11';
        a.style.fontWeight = 'bold';
        a.style.fontFamily = 'arial';
        a.style.textDecoration = 'underline';
        a.target = '_blank';        
        a.href = blocker_surveryLinks[i].url;
        a.innerHTML = blocker_surveryLinks[i].text;
        a.onclick = function(){
            window.setTimeout(unblockContent, 60000);
        }
        li.appendChild(a)    
        ul.appendChild(li);
    }

    centerPane.appendChild(ul);

    var p2 = document.createElement('p');
    p2.style.textAlign = 'left';
    p2.innerHTML = blocker_footerText;
    p2.style.padding = '2px 0 0 0';
    p2.style.margin = '0';
    p2.style.color = '#FFFFFF';
    p2.style.fontFamily = 'arial';
    p2.style.fontSize = '14px';
    p2.style.lineHeight = '14px';
    centerPane.appendChild(p2);

    document.getElementsByTagName('body')[0].appendChild(haze);
    document.getElementsByTagName('body')[0].appendChild(centerPane);
}

function unblockContent(){
    document.getElementsByTagName('body')[0].style.overflow = blocker_originalBodyOverflow;
    document.getElementsByTagName('html')[0].style.overflow = blocker_originalHtmlOverflow;

    document.getElementById('blocker_haze').style.display = 'none';
    document.getElementById('blocker_centerPane').style.display = 'none';
    blocker_setCookie("content_unlocked", 1, 2000);
}

function blocker_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 blocker_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 "";
}
