function showDevS() {
    document.getElementById('devvy').style.display='block';
}

function scaleUpU(element, scaleNumber) {
    this_timeout = setTimeout("pleaseWork('LOLOLOLOLO', 246.30);", 300);
}

function scaleUpS(element, scaleNumber) {
    this_timeout = setTimeout("pleaseWork('LOLOLOLOL', 104.16);", 300);
}

function scaleUpR(element, scaleNumber) {
    this_timeout = setTimeout("pleaseWork('LOLOLOLO', 187.50);", 300);
}

function scaleUpQ(element, scaleNumber) {
    this_timeout = setTimeout("pleaseWork('LOLOLOL', 357.14);", 300);
}

function scaleUpP(element, scaleNumber) {
    this_timeout = setTimeout("pleaseWork('LOLOLO', 156.25);", 300);
}

function scaleUpT(element, scaleNumber) {
    this_timeout = setTimeout("pleaseWork('LOLOL', 170.94);", 300);
}

function pleaseWork(element, scaleNumber) {
    OrigDim = document.getElementById(element);
    thisWidth = OrigDim.width;
    thisHeight = OrigDim.height;
    
    ScaleProp = (thisHeight / 48) * 100;
    
    new Effect.Scale(element, scaleNumber,{ duration: .7, scaleX: true, scaleY: true , scaleFromCenter: true, scaleMode: { originalHeight: 48 }, scaleFrom: ScaleProp});
    
    clearTimeout(this_timeout);
    

}

function funpsd() {
    alert('hello');
}


function PuffPuff(myid) {
    new Effect.Grow(myid);
}

function PuffPuffPuff(myid) {
    Effect.toggle(myid,'appear');
}

function scaleUp() {
    a = document.getElementById('LOLOL').style.width;
    b = document.getElementById('LOLOL').style.width;
    new Effect.Scale('LOLOL', 100,{ scaleX: true, scaleY: true , scaleFromCenter: false, scaleMode: { originalHeight: 128, originalWidth: 128 }});
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=348,height=170,left = 526.5,top = 397');");
}


function showScreenshot() {
    //setTimeout("document.getElementById('screenshotOfMenuet').style.display='block';", 250);
    clearTimeout(my_timeout);
    setTimeout("new Effect.Appear('screenshotOfMenuet');", 250);
}

function dissolveScreenshot() {
    new Effect.Fade('screenshotOfMenuet');
}



function dissolveFeatures() {
    new Effect.DropOut('firstFeature');
    setTimeout("new Effect.DropOut('secondFeature');", 50);
    setTimeout("new Effect.DropOut('thirdFeature');", 100);
}

function showFeatures() {
    new Effect.Appear('firstFeature');
    new Effect.Appear('secondFeature');
    new Effect.Appear('thirdFeature');
}

function showThanksForDownloading() {
    new Effect.Appear('DownloadingMenuet');
    my_timeout = setTimeout("showFeatures()", 5000);
    setTimeout("new Effect.Fade('DownloadingMenuet');", 5000);
    setTimeout("window.location='http://specere.net/downloader.php?file=Menuet.dmg';", 5000);
}

function goToComments(post) {
    new Effect.toggle(post,'slide')
}

function constructGravatar() {
    code = document.getElementById('gravatarEmail');
    code = code.value;
    document.getElementById('leavingGravatar').img.src = '<';
}

function nextPlz(post) {
    new Effect.Appear(post);
    document.getElementById('SelectBox').selectedIndex = post;
}

//COUPON AND CART FUNCTIONS

function validateCoupon() {
    // (1) get coupon code entered by user
    code = document.getElementById('couponInput');
    code.value = code.value.toUpperCase();
    code = code.value;
    // (2) compare against list of valid coupon codes
    for (k in couponCodes) {
        // (3) does the user's code match a code in our array?
        if (code == k) {
            // (4) store ID of coupon in cookie
            setCookie("Menuet_Discount", k);
            // (5) tell the user with a notification message (in the redemption panel)
            //document.getElementById('couponInput').style.display='none'
            //document.getElementById('whiteBG').innerHTML = 'Coupon Approved. $'+couponCodes[k]+'.00 off';
            // (6) tell the user with a notification message (in the buy panel)
            document.getElementById('whiteBG').innerHTML = '<h3>Coupon Applied: You will receive $'+couponCodes[k]+'.00 off at checkout.</h3>';
        }
    }
}

function competitorDiscount() {
    // (1) get coupon code entered by user
    code = 'MTFALPHA';
    // (2) compare against list of valid coupon codes
    for (k in couponCodes) {
        // (3) does the user's code match a code in our array?
        if (code == k) {
            // (4) store ID of coupon in cookie
            setCookie("Menuet_Discount", k);
            // (5) tell the user with a notification message (in the redemption panel)
            //document.getElementById('couponInput').style.display='none'
            //document.getElementById('whiteBG').innerHTML = 'Coupon Approved. $'+couponCodes[k]+'.00 off';
            // (6) tell the user with a notification message (in the buy panel)
            document.getElementById('whiteBG').innerHTML = '<h3>We see that you have been using another iTunes controller. As a thanks for switching, you will receive $'+couponCodes[k]+'.00 off at checkout.</h3>';
        }
    }
}


function recallPPURL( licenseType ) {
    // get coupon code (if set)
    if (couponCode = getCookie('Menuet_Discount')) {
        url = ppURLs[licenseType+'.'+couponCode];
    } else {
        url = ppURLs[licenseType];
    }
   //document.getElementById('checkout').href = url;
    window.location = url;
}

//SUPPORT NOTIFICATION FUNCTIONS

function success() {
    document.getElementById('lostsn').innerHTML = '<p>We have sent you your serial number. Please allow a few minutes for it to arrive. If you run into any problems, please send us an <a href=mailto:sales@menuetapp.com>email</a>.</p>';
}

function failure() {
    document.getElementById('lostsn').innerHTML = '<p>There was an error recovering your serial number. Please send us an <a href=mailto:sales@menuetapp.com>email</a> if you need further assistance.</p>';
}

function mailed() {
    document.getElementById('mailus').innerHTML = '<p>Your message has been sent. We try to reply to all questions and comments within 24 hours.</p>';
}
function errorm() {
    document.getElementById('mailus').innerHTML = '<p>Please fill in all fields. <a href="?">Try again</a>.</p>';
}