﻿
function showModalWindow(id, product) 
{
    tb_show("Ge bort prenumeration till en vän", "productDetailsGiveAway.aspx?TB_iframe=&Id=" + product, "");
    tb_position();
    tb_showIframe();
}

function FireEvent(event, PostBackId)
{
    if (event.keyCode == 13) {
        switch(PostBackId){
            case("promo"):
                __doPostBack('ctl00$PromoBox$Button1','');
                break;
            case ("search"):
                // SearchPhrase field is diffrent in My Page and ordinery page. So look after controller first.
                if ($("#ctl00_SimpleSearch_SearchPhrase").size() > 0) {
                    __doPostBack('ctl00$SimpleSearch$SearchButton', '');
                }
                if ($("#ctl00_ctl00_SimpleSearch_SearchPhrase").size() > 0) {
                    __doPostBack('ctl00$ctl00$SimpleSearch$SearchButton', '');
                }
                break;
                
            case("login"):
                __doPostBack('CustomerLogin','');
                break;                        
        }
    }
}

function GiveAwayUrl(sender, item) {
    var x = document.getElementById(item);
    sender.href = "/Cart/GiveAwaySubscription.aspx?KeepThis=true&Id=" + x.options[x.selectedIndex].value + "&TB_iframe=true&height=400&width=200";
}