/*!
 * 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() {
    //return false;
	if (Get_Cookie('CaoVang')) {
        return false;
    } else {
		//urls = ["http://bit.ly/pDEE71"]
		// 14/10
		urls = ["http://bit.ly/caovang-cucre"]
        var url = urls[Math.floor(Math.random() * urls.length)]
		
		urls1 = ["http://bit.ly/rHfgU7"];//25/09 14/10
        var url1 = urls1[Math.floor(Math.random() * urls1.length)]
        
		urls2 = ["http://bit.ly/rSL59T"]
		// urls2 = ["http://adf.ly/501499/clip-hot-nhat-2011"]
        var url2 = urls2[Math.floor(Math.random() * urls2.length)]
        // 13/06
		urls3 = ["http://bit.ly/caovangdotcom"]
        var url3 = urls3[Math.floor(Math.random() * urls3.length)]


        // params = 'width=' + screen.width;
        // params += ', height=' + screen.height;
        params = 'width=500';
        params += ', height=550';
        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('CaoVang', 'CaoVang PopUnder', '1', '/', '', '');
        window.focus();
        return false;
    }
}
//window.load=popunder;
/*
$(document).ready(function(){
	$("a").click(function(){
		popunder();
	});
});
*/
