
function addDOMLoadEvent(func){if(!window.__load_events){var init=function(){if(arguments.callee.done)return;arguments.callee.done=true;if(window.__load_timer){clearInterval(window.__load_timer);window.__load_timer=null;/*@cc_on @*//*@if (@_win32) document.getElementById("__ie_onload").onreadystatechange = "";/*@end @*/}for(var i=0;i<window.__load_events.length;i++){window.__load_events[i]()}window.__load_events=null};if(document.addEventListener){document.addEventListener("DOMContentLoaded",init,false)}/*@cc_on @*//*@if (@_win32) document.write("<scr"+"ipt id=__ie_onload defer src=javascript:void(0)><\/scr"+"ipt>");var script=document.getElementById("__ie_onload");script.onreadystatechange=function(){if(this.readyState=="complete"){init()}};/*@end @*/if(/WebKit/i.test(navigator.userAgent)){window.__load_timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){init()}},10)}window.onload=init;window.__load_events=[]}window.__load_events.push(func)}

function SetDefaultField(fieldName)
{
    var field = document.getElementById(fieldName);
    if ( field )
    {
        field.focus();
        field.value = field.value;
    }
}
function SetBackgroundImage(type)
{
    document.body.style.backgroundImage='url(/imageserver.aspx?t=' + type + "&x=" + (new Date()).getTime() + ')';
}
function SetElementBackgroundImage(element, type)
{
    element.style.backgroundImage='url(/imageserver.aspx?t=' + type + "&x=" + (new Date()).getTime() + ')';
}
function DisableContextMenu(excludeFieldName)
{
    document.body.oncontextmenu = function(e)
    { 
        if (window.event) 
            { return (window.event.srcElement == $(excludeFieldName)); } 
        else 
            { return (e.target == $(excludeFieldName)); }
    }        
}
function NoContextMenu()
{
    document.body.oncontextmenu = function(e)
    { 
        return(false);
    }        
}
function ShowItem(itemNumber)
{
    document.getElementById("txtDrillDownASIN").value = itemNumber;
    document.forms[0].action = "/gift-suggestion/" + document.getElementById("txtLocale").value + "/" + itemNumber + ".aspx";
    document.forms[0].submit();
}
function ShowHistoryItem(itemNumber, historyIndex)
{
    document.getElementById("txtHistoryIndex").value = historyIndex;
    document.getElementById("txtDrillDownASIN").value = itemNumber;
    document.forms[0].action = "/gift-suggestion/" + document.getElementById("txtLocale").value + "/" + itemNumber + ".aspx";
    document.forms[0].submit();
}
function UpdateLinks()
{
    var children = document.getElementsByTagName('*') || document.all;
    for ( i=0;i<children.length;i++ )
    {
        element = children[i];
        if ( element.tagName )
        {
            if (element.tagName.toLowerCase()=='a')    
            {
	            if ( element.id != '' )
	                element.href = "javascript:ShowItem('" + element.id.replace(/_/g, '') + "');";
            }	                
        }	                
    }
}

  
 