var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);
var _obj;
function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
    var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
    var imgTitle = (myImage.title) ? 
               "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
    var imgStyle = "display:inline-block;" + myImage.style.cssText
    var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
    myImage.outerHTML = strNewHTML   
    }
} 
/*Buy Page*/
function Checkmail(myMail)
{
    var email = myMail.value
    var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
    var flag = pattern.test(email);
    if (flag)
    {
        return true;
    }
    else
    {
        alert('The format of the mail address is wrong!');
        return false;
    }
}
function CheckEmpty(myValue)
{
    if (myValue.value.length == 0)
    {
        alert('The item can\'b be Null!');
        return false;
    }
    else
    {
        return true;
    }
}
function nowTime()
{
    var YTime = new Date();
    var YTime2 = new Date(YTime.getFullYear(),YTime.getMonth(),YTime.getDate() + 0);
    var YMonth = YTime2.getMonth();
    if(YMonth == 0)
       YMonth = "Jan";
    else if(YMonth == 1)
       YMonth = "Feb";
    else if(YMonth == 2)
       YMonth = "Mar";
    else if(YMonth == 3)
       YMonth = "Apr";
    else if(YMonth == 4)
       YMonth = "May";
    else if(YMonth == 5)
       YMonth = "Jun";
    else if(YMonth == 6)
       YMonth = "Jul";
    else if(YMonth == 7)
       YMonth = "Aug";
    else if(YMonth == 8)
       YMonth = "Sept";
    else if(YMonth == 9)
       YMonth = "Oct";
    else if(YMonth == 10)
       YMonth = "Nov";
    else if(YMonth == 11)
       YMonth = "Dec";
    else
       YMonth = "N/A";
    document.writeln(" " + YMonth + " " + YTime2.getDate() + ", " + YTime2.getFullYear());
}
/*YDSoft.PerfectOptimizer*/
function createOBJ()
{
    //try
    //{
    //    _obj = new ActiveXObject("YDSoft.PerfectOptimizer");
    //    return true;
    //}
    //catch (e)
    //{
        return false;
    //}
}
function getRegistryErrors()
{
    var regErros = 0;
    if(createOBJ())
    {
        regErros = _obj.RegistryErrors();
        if(regErros == -1)
        {
            return "<font color=\"#FF0000\">System Alert!</font>"
        }
        else
        {
            if(regErros < 200)
            {
                document.getElementById("regerror").src = "images/hamulus.gif";
            }
            else
            {
                document.getElementById("regerror").src = "images/hamulus2.gif";
            }
            return "<font color=\"#FF0000\">" + regErros + " Errors Found</font>";
        }
    }else
    {
        return "<font color=\"#FF0000\">System Alert!</font>"
    }
}
function getJunkFile()
{
    var junkFiles = 0;
    if(createOBJ())
    {
        junkFiles = _obj.JunkFileSize();
        if(junkFiles == -1)
        {
            return "<font color=\"#FF0000\">System Alert!</font>"
        }
        else
        {
            if(junkFiles < 100)
            {
                document.getElementById("junkfiles").src = "images/hamulus.gif";
            }
            else
            {
                document.getElementById("junkfiles").src = "images/hamulus2.gif";
            }
            return "<font color=\"#FF0000\">" + junkFiles + " MB Junk Found</font>"
        }
    }
    else
    {
        return "<font color=\"#FF0000\">System Alert!</font>"
    }
}
function showButton()
{
    if(createOBJ())
    {
        return "<a href=\"PerfectOptimizer://Regscan\" class=\"RepairAll\"></a>";
    }else
    {
        return "<a href=\"download.aspx?dl=PERFECTOPTIMIZER.EXE\" class=\"FullScan\"></a>";
    }
}
