function OpenTipWindow(Url, Width, Height) {
    var opts = "width=" + Width +",height=" + Height;
    window.open("/Framework/Pages/Common/Tip.aspx?URL=" +Url, "TipWindow", opts);
}

function OpenTipWindowWithName(Url, Width, Height, Name) {
    var opts = "width=" + Width +",height=" + Height;
    window.open("/Framework/Pages/Common/Tip.aspx?URL=" +Url, Name, opts);
}

function bookmark() {
    window.external.AddFavorite(EPiServer.Global.EPLang.Translate("/Julia/Javascript/BookmarkUrl"), EPiServer.Global.EPLang.Translate("/Julia/Javascript/BookmarkLabel"))                       
}

function OpenWindowScroll(Url, Width, Height) {
    var opts = "width=" + Width +",height=" + Height + ",scrollbars=yes";
    window.open(Url, "JuliaWindow", opts);
}

function OpenWindow(Url, Width, Height) {
    var opts = "width=" + Width +",height=" + Height + ",scrollbars=no";
    window.open(Url, "JuliaWindow", opts);
}

function fnTrapKD(btn, event){
    if (document.all){
        if (event.keyCode == 13){
            event.returnValue=false;
            event.cancel = true;
            btn.click();
        }
    }
    else if (document.getElementById){
        if (event.which == 13){
            event.returnValue=false;
            event.cancel = true;
            btn.click();
        }
    }
    else if(document.layers){
        if(event.which == 13){
            event.returnValue=false;
            event.cancel = true;
            btn.click();
        }
    }
}

function fnDisableENTER(event){
    if (document.all){
        if (event.keyCode == 13) {
            event.keyCode = 0;
            event.returnValue = false;
            event.cancel = true;
        }
    }
    else if (document.getElementById){
        if (event.which == 13) {
            event.keyCode = 0;
            event.returnValue = false;
            event.cancel = true;
        }
    }
    else if(document.layers){
        if(event.which == 13) {
            event.which = 0;
            event.returnValue = false;
            event.cancel = true;
        }
    }
}


function previewAvatar() 
{
    var a = document.forms['aspnetForm'].ctl00_FullRegion_ctl00_ctl00_ddlAvatar;
    var avatar = a[a.selectedIndex].value;
    
    var img = document.getElementById('ctl00_FullRegion_ctl00_ctl00_imgCurrent');
    if(img!= null)
        img.src = avatar;
    //alert(avatar);
}


function showReportWindow(ReportUrl) 
{    
    var opts = "width=" + 400 +",height=" + 450;
    window.open("/Framework/Pages/Common/Report.aspx?ReportUrl=" + escape(ReportUrl), "ReportWindow", opts);
    //window.open("/Mitt-Julia/Report-post?ReportUrl=" + escape(ReportUrl), "ReportWindow", opts);
}

function showEditBlogHeaderSettingsPopUp() 
{    
    var opts = "width=" + 400 +",height=" + 260 + ",scrollbars=1";
    window.open("/Forside/PopUps/Ny-bloggheader/", "EditBlogHeaderSettingsPopUp", opts);
}


function ChangeClass(Element, Class) {
    var elm = document.getElementById(Element);
    if(elm != null) {
        elm.setAttribute("class", Class);
        elm.setAttribute("className", Class);
    }
    return;
}

function WriteFlashCountDown(Days) 
{
    var flash = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="146" height="98" id="countdown_v1_kv" align="middle">' +
        '<param name="allowScriptAccess" value="sameDomain" />'+
        '<param name="movie" value="/Flash/countdown_v1_kv.swf?intNumber=' + Days + '" />'+
        '<param name="quality" value="high" />'+
        '<param name="bgcolor" value="#ffffff" />'+
        '<param name="wmode" value="transparent">'+
        '<embed src="/Flash/countdown_v1_kv.swf?intNumber='+ Days + '" quality="high" bgcolor="#ffffff" width="146" height="98" name="countdown_v1_kv" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
    '</object>';
    
    document.write(flash);
}

function showReplyWindow(user) 
{
    var opts = "width=" + 300 +",height=" + 260;
    window.open("/Framework/Pages/Community/WriteReply.aspx?user=" + user, EPiServer.Global.EPLang.Translate("/Julia/Javascript/ShowReplyWindowTitle"), opts);
}

function showReplyWindowWithTitle(user, Title) 
{
    var opts = "width=" + 300 +",height=" + 260;
    window.open("/Framework/Pages/Community/WriteReply.aspx?user=" + user, Title, opts);
}

function isdefined( variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}