var dtm = null;
var prev_div = null;
var remove_anim = 1;
function detail(x){
            prev_div = dtm;
            var prot_detail_div = x.getElementsByTagName("div");
            dtm = prot_detail_div[0];
            if(prev_div != null && prev_div != dtm){
                undetail();
                remove_anim = 1;
            }
            if(remove_anim == 1){
                remove_anim = 0;
                div_to_manip = dtm.style;
                div_to_manip.backgroundColor = "#191615";
                div_to_manip.borderTopColor = "#a9a8a8";
                div_to_manip.borderTopWidth = "2px";
                div_to_manip.borderTopStyle = "solid";
                var k=1;
                for(var i=145; i>94; i--){
                    setTimeout("change_height(" + i + ")", 2 * k );
                    k++;
                }
            }
            
}
function undetail(){
        prev_div.style.backgroundColor = "#333333";
        prev_div.style.borderTopWidth = "0";
        prev_div.style.marginTop = "145px";
        //remove_anim = 1;
}
function change_height(h){
    div_to_manip.marginTop = h + "px";
}
function show_project(proj, proj_name, cat){
    var docBody = document.getElementById("main_page");
    //get the block div and block the website
    var block_div = document.getElementById("block_div");
    var bd_style = block_div.style;
    bd_style.height = docBody.offsetHeight + "px";
    bd_style.width = screen.availWidth + "px";
    bd_style.visibility = "visible";
    bd_style.backgroundColor = "#CCCCCC";
    var opacity = 50;
    bd_style.opacity = (opacity/100);
    bd_style.MozOpacity = (opacity/100);
    bd_style.KhtmlOpacity = (opacity/100);
    bd_style.filter = "alpha(opacity=" + opacity + ")";
    bd_style.zIndex = "2990";
    /*alert(docBody.offsetHeight);
    alert(screen.availWidth);*/

    var ifm_left = screen.width;
    ifm_left = (ifm_left - 500)/2;

    //now create a iframe and append the same to body element
    var portfolio_layer = document.getElementById("prt_div");
    var port_ifram = document.createElement("iframe");
    port_ifram.id = "port_ifrm";
    portfolio_layer.appendChild(port_ifram);
    port_ifram.src = "show_portfolio.php?elem=" + proj + "&cat=" + cat;

    //alert("show_portfolio.php?elem=" + proj + "&cat=" + cat);

    var port_heading = document.getElementById("port_heading");
    port_heading.innerHTML = proj_name;

    portfolio_layer.style.left = ifm_left + "px";
    portfolio_layer.style.visibility = "visible";
    portfolio_layer.style.width = "500px";
    portfolio_layer.style.height = "570px";
    portfolio_layer.style.zIndex = "3000";
}
function expand_port_layer(){

}
function close_port(){
    //docBody = document.getElementById("main_page");
    var block_div = document.getElementById("block_div");
    var portfolio_layer = document.getElementById('prt_div');
    var port_iframe = document.getElementById("port_ifrm")
    portfolio_layer.removeChild(port_iframe);

    var bd_style = block_div.style;
    bd_style.visibility = "hidden";
    bd_style.height = "0px";
    bd_style.width = "0px";
    bd_style.zIndex = "1";

    var pl_style = portfolio_layer.style;
    pl_style.visibility = "hidden";
    pl_style.height = "0px";
    pl_style.width = "0px";
    pl_style.zIndex = "1";
}