﻿function clickButton(e, buttonid) {
        if (navigator.appName.indexOf("Netscape") > (-1)) {
            if (e.keyCode == 13) {
                searchKey_onclick();
                return false;
            }
        }
        if (navigator.appName.indexOf("Microsoft Internet Explorer") > (-1)) {
            if (event.keyCode == 13) {
                searchKey_onclick();
                return false;
            }
        }
}

function searchKey_onclick() {
    if (document.getElementById("searchKey").value != "") {
        window.location.href = "Search.aspx?q=" + document.getElementById("searchKey").value;
        return true;
    }
    else {
        return false;
    }
}

function bookmark(url, title){
    if (window.sidebar)
    {
        // firefox
        window.sidebar.addPanel(title, url, "");
    } 
    else if(window.opera && window.print)
    {
        // opera
        var elem = document.createElement('a');
        elem.setAttribute('href',url);
        elem.setAttribute('title',title);
        elem.setAttribute('rel','sidebar');
        elem.click();
    }
    else if(document.all)
    {
        // ie
        window.external.AddFavorite(url, title);
    } 
}
function expendDiv( id, hideId, showId ) {
    $("#"+id).height(  $("#"+id+" .expendable-inner").height() + 5 );
    $("#"+hideId).hide();
    $("#"+showId).show();
}
function closeExpendedDiv( id, hideId, showId ) {
    $("#"+id).height( 370 );
    $("#"+hideId).toggle();
    $("#"+showId).toggle();
}

function DrawImage(ImgD,iwidth,iheight){
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0 && (image.width>iwidth | image.height>iheight))
    {
    if(image.width/image.height>= iwidth/iheight){
        	ImgD.width=iwidth;
        	ImgD.height=(image.height*iwidth)/image.width;
        }
    else{
        	ImgD.height=iheight;
        	ImgD.width=(image.width*iheight)/image.height;
        }
    }
}
