var ref=document.location.href
var browser=true;
if (document.layers) browser=false;

function AddToBookmars(urlval,titleval) {
window.external.AddFavorite(urlval,titleval);
window.close();
}

function checkbookmark() {
var leftPos = (screen.availWidth-900) / 2;
var topPos = (screen.availHeight-600) / 2;
if(document.all)
    {
    var tempX=event.clientX+document.body.scrollLeft
    var tempY=event.clientY+document.body.scrollTop
    if(tempX<0&&tempY<0) 
        {
        window.open('favorite.html', 'PopUpWindow','width=300,height=160,menubar=0,scrollbars=no,resizable=no,statusbar=no,location=no,titlebar=0,toolbar=0,status=0,top=' + topPos + ',left=' + leftPos);
        }
    }
    /* else
    {
    var newref=document.location.href
    if (ref==newref)
        {
        window.open('favorite.html', 'PopUpWindow','width=300,height=160,menubar=0,scrollbars=no,resizable=no,statusbar=no,location=no,titlebar=0,toolbar=0,status=0,top=' + topPos + ',left=' + leftPos);
        }
    } */
}

function createObj(obj) {
if (document.all) obj=document.all[obj];
else obj=document.getElementById(obj);
return obj;
}
function catalogOver(tableId) {
    if (browser)
    {
    obj=createObj(tableId);
    obj.background='images/bg_catalogue_over.gif';
    }
}
function catalogOut(tableId) {
    
    if (browser) 
    {
    obj=createObj(tableId);
    obj.background='';
    }
}
function menuRollover(obj,srcValue) {
obj.src=srcValue;
}
function makePopUp(urlValue,widthValue,heightValue) {
var leftPos = (screen.availWidth-900) / 2;
var topPos = (screen.availHeight-600) / 2;
window.open('enlarge.php?Url='+urlValue, 'PopUpWindow','width='+widthValue+',height='+heightValue+',menubar=0,scrollbars=no,resizable=no,statusbar=no,location=no,titlebar=0,toolbar=0,status=0,top=' + topPos + ',left=' + leftPos);

}

// Hide and Show menu

//finds and return <DIV> object by given name
function Layer(layerName) {
return document.all(layerName);
}

//flips the state from Off to On and vice versa
function flipState(state) {
return (state=='On')?('Off'):('On');
}

//event routing and handling for NS6
function stopNSbubble (e){
if (e) e.stopPropagation();
}

//flips menu On/Off and make appropriate changes in onClick function
function flip(layer,state){
//if (event.srcElement.id!='menuControl') return false;
layer.innerHTML=Layer(layer.id+state).innerHTML;
layer.onclick=new Function("flip(this,'"+flipState(state)+"');");
//save current state to the Cookie
var expdate = new Date (); 
expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * 365)); 
SetCookie(layer.id, state, expdate);
}

//render initial Layer with appropriate data
function CreateLayer(layer){
document.write('<div id="'+layer.id+'"></div>');
Layer(layer.id).onclick=new Function("flip(this,'"+flipState(layer.state)+"');");
Layer(layer.id).innerHTML=Layer(layer.id+layer.state).innerHTML;
}


//creates Menu
function Menu(menuName) {
this.id=menuName;
this.state=(!GetCookie(menuName) || GetCookie(menuName)=='Off')?('Off'):('On');
this.create=new Function("CreateLayer(this)");
}


        function getById(StrId) { return document.all?document.all[StrId]:document.getElementById(StrId); }

        function onYearFocus(obj){if(!obj.changed){obj.value = '';obj.storeValue = '';}obj.style.color = '#000000';}
        function onYearBlur(obj){if (!obj.value) {obj.changed = false;obj.value = '[Year]';obj.style.color = '#7f7f7f';} else {obj.changed = true;}}
        function onYearKeyUp(obj) {
            if (isNaN(obj.value)||obj.value<0) {
                obj.value = obj.storeValue;
            } else {
                obj.storeValue = obj.value;
            }
        }
        
        function set_Date(Name) {
            day = getById(Name+"_Day");
            mon = getById(Name+"_Month");
            yr = getById(Name+"_Year");
            getById(Name).value = (yr.value && mon.value && day.value)?(yr.value+'-'+mon.value+'-'+day.value):'';
            
        }


