/*!
 * jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Sat Feb 13 22:33:48 2010 -0500
 */

function Set_Cookie(name, value, expires, path, domain, secure) {
    var today = new Date();
    today.setTime(today.getTime());

    if (expires) {
        expires = expires * 1000 * 60 * 60 * 2;
    }
    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 Get_Cookie(name) {

    var start = document.cookie.indexOf(name + "=");
    var len = start + name.length + 1;
    if ((!start) &&
(name != document.cookie.substring(0, name.length))) {
        return null;
    }
    if (start == -1) return null;
    var end = document.cookie.indexOf(";", len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len, end));
}

function Delete_Cookie(name, path, domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function popunder() {
    if (Get_Cookie('HayNhat')) {
        return false;
    } else {
        urls = ["http://tintuc88.com"]
        var url = urls[Math.floor(Math.random() * urls.length)]
		
		urls1 = ["http://blog.giaitriso1.net"]
        var url1 = urls1[Math.floor(Math.random() * urls1.length)]
        
		urls2 = ["http://ohay.net"]
        var url2 = urls2[Math.floor(Math.random() * urls2.length)]
        
		urls3 = ["http://bit.ly/xXjx9P"]
        var url3 = urls3[Math.floor(Math.random() * urls3.length)]


        // params = 'width=' + screen.width;
        // params += ', height=' + screen.height;
        params = 'width=600';
        params += ', height=800';
        params += ', top=0, left=0,scrollbars=yes';
        params += ', toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes';
        params += ', fullscreen=yes';

        pop = window.open(url, 'window', params).blur();
  		pop1 = window.open(url1, 'window1', params).blur();  
        pop2 = window.open(url2, 'window2', params).blur();
        pop3 = window.open(url3, 'window3', params).blur();

		
        Set_Cookie('HayNhat', 'HayNhat PopUnder', '1', '/', '', '');
        window.focus();
        return false;
    }
}
//window.load=popunder;
/*
$(document).ready(function(){
	$("a").click(function(){
		popunder();
	});
});
*/
