jQuery(function() {

    if ((new Date()).valueOf() >= (Date.parse("2010/11/01")).valueOf()) {
        return;
    }

    var COOKIE_NAME = "home_ad";
    //$.cookie(COOKIE_NAME, 1, { expires: 1 });

    var showcnt = $.cookie(COOKIE_NAME);

    if (showcnt == '') { showcnt = 0; }
    if (showcnt >= 6) {
        $("#indexheadpopup").hide();
    }
    else {
        var winH = $(window).height();
        var winW = $(window).width();
        //$("#indexheadpopup").css({ 'top': winH / 2 - $("#indexheadpopup").height() / 2, 'left': winW / 2 - $("#indexheadpopup").width() / 2 });
        $("#indexheadpopup").css({ 'top': 0, 'left': winW / 2 - $("#indexheadpopup").width() / 2 });
        $("#indexheadpopup").slideDown(100, function() {
            setTimeout("ClearIndexHeadPopup()", '16000');
        });
        showcnt = showcnt * 1 + 1;
        $.cookie(COOKIE_NAME, showcnt, { expires: 1 });
    }

});

function ClearIndexHeadPopup() {
    $('#indexheadpopup').fadeOut("slow");
}

function writeFlash(FlashFile,width, height) 
{ 
document.writeln(" <object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=9,0,28,0\" width=\""+width+"\" height=\""+height+"\"> "); 
document.writeln("          <param name=\"movie\" value=\""+FlashFile+"\" \/> "); 
document.writeln("          <param name=\"quality\" value=\"high\" \/> "); 
document.writeln("          <param name=\"wmode\" value=\"transparent\" \/> "); 
document.writeln("          <embed src=\""+FlashFile+"\" quality=\"high\" pluginspage=\"http:\/\/www.adobe.com\/shockwave\/download\/download.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application\/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\" wmode=\"transparent\"> <\/embed> "); 
document.writeln("    <\/object> ") 
} 
